| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_BASE_VIDEO_DECODER_H_ |
| 6 #define MEDIA_BASE_VIDEO_DECODER_H_ | 6 #define MEDIA_BASE_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/pipeline_status.h" | 10 #include "media/base/pipeline_status.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // Reset decoder state, fulfilling all pending ReadCB and dropping extra | 54 // Reset decoder state, fulfilling all pending ReadCB and dropping extra |
| 55 // queued decoded data. After this call, the decoder is back to an initialized | 55 // queued decoded data. After this call, the decoder is back to an initialized |
| 56 // clean state. | 56 // clean state. |
| 57 virtual void Reset(const base::Closure& closure) = 0; | 57 virtual void Reset(const base::Closure& closure) = 0; |
| 58 | 58 |
| 59 // Stop decoder and set it to an uninitialized state. Note that a VideoDecoder | 59 // Stop decoder and set it to an uninitialized state. Note that a VideoDecoder |
| 60 // should/could not be re-initialized after it has been stopped. | 60 // should/could not be re-initialized after it has been stopped. |
| 61 virtual void Stop(const base::Closure& closure) = 0; | 61 virtual void Stop(const base::Closure& closure) = 0; |
| 62 | 62 |
| 63 // Returns the natural width and height of decoded video in pixels. | |
| 64 // | |
| 65 // Clients should NOT rely on these values to remain constant. Instead, use | |
| 66 // the width/height from decoded video frames themselves. | |
| 67 // | |
| 68 // TODO(scherkus): why not rely on prerolling and decoding a single frame to | |
| 69 // get dimensions? | |
| 70 virtual const gfx::Size& natural_size() = 0; | |
| 71 | |
| 72 // Returns true if the output format has an alpha channel. Most formats do not | 63 // Returns true if the output format has an alpha channel. Most formats do not |
| 73 // have alpha so the default is false. Override and return true for decoders | 64 // have alpha so the default is false. Override and return true for decoders |
| 74 // that return formats with an alpha channel. | 65 // that return formats with an alpha channel. |
| 75 virtual bool HasAlpha() const; | 66 virtual bool HasAlpha() const; |
| 76 | 67 |
| 77 // Prepare decoder for shutdown. This is a HACK needed because | 68 // Prepare decoder for shutdown. This is a HACK needed because |
| 78 // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its | 69 // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its |
| 79 // filters, waiting for each state transition to complete before starting the | 70 // filters, waiting for each state transition to complete before starting the |
| 80 // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for | 71 // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for |
| 81 // the duration. Default implementation does nothing; derived decoders may | 72 // the duration. Default implementation does nothing; derived decoders may |
| 82 // override as needed. http://crbug.com/110228 tracks removing this. | 73 // override as needed. http://crbug.com/110228 tracks removing this. |
| 83 virtual void PrepareForShutdownHack(); | 74 virtual void PrepareForShutdownHack(); |
| 84 | 75 |
| 85 protected: | 76 protected: |
| 86 friend class base::RefCountedThreadSafe<VideoDecoder>; | 77 friend class base::RefCountedThreadSafe<VideoDecoder>; |
| 87 virtual ~VideoDecoder(); | 78 virtual ~VideoDecoder(); |
| 88 VideoDecoder(); | 79 VideoDecoder(); |
| 89 | 80 |
| 90 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 81 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 91 }; | 82 }; |
| 92 | 83 |
| 93 } // namespace media | 84 } // namespace media |
| 94 | 85 |
| 95 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 86 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
| OLD | NEW |