| 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/media_export.h" | 10 #include "media/base/media_export.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Requests a |buffer| to be decoded. The status of the decoder and decoded | 63 // Requests a |buffer| to be decoded. The status of the decoder and decoded |
| 64 // frame are returned via the provided callback. Some decoders may allow | 64 // frame are returned via the provided callback. Some decoders may allow |
| 65 // decoding multiple buffers in parallel. Callers should call | 65 // decoding multiple buffers in parallel. Callers should call |
| 66 // GetMaxDecodeRequests() to get number of buffers that may be decoded in | 66 // GetMaxDecodeRequests() to get number of buffers that may be decoded in |
| 67 // parallel. Decoder must call |decode_cb| in the same order in which Decode() | 67 // parallel. Decoder must call |decode_cb| in the same order in which Decode() |
| 68 // is called. | 68 // is called. |
| 69 // | 69 // |
| 70 // Implementations guarantee that the callback will not be called from within | 70 // Implementations guarantee that the callback will not be called from within |
| 71 // this method and that |decode_cb| will not be blocked on the following | 71 // this method and that |decode_cb| will not be blocked on the following |
| 72 // Decode() calls (i.e. |decode_cb| will be called even Decode() is never | 72 // Decode() calls (i.e. |decode_cb| will be called even if Decode() is never |
| 73 // called again). | 73 // called again). |
| 74 // | 74 // |
| 75 // After decoding is finished the decoder calls |output_cb| specified in | 75 // After decoding is finished the decoder calls |output_cb| specified in |
| 76 // Initialize() for each decoded frame. |output_cb| may be called before or | 76 // Initialize() for each decoded frame. |output_cb| may be called before or |
| 77 // after |decode_cb|. | 77 // after |decode_cb|. |
| 78 // | 78 // |
| 79 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. | 79 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. |
| 80 // |output_cb| must be called for each frame pending in the queue and | 80 // |output_cb| must be called for each frame pending in the queue and |
| 81 // |decode_cb| must be called after that. | 81 // |decode_cb| must be called after that. Callers will not call Decode() |
| 82 // again until after the flush completes. |
| 82 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 83 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 83 const DecodeCB& decode_cb) = 0; | 84 const DecodeCB& decode_cb) = 0; |
| 84 | 85 |
| 85 // Resets decoder state. All pending Decode() requests will be finished or | 86 // Resets decoder state. All pending Decode() requests will be finished or |
| 86 // aborted before |closure| is called. | 87 // aborted before |closure| is called. |
| 87 // Note: No VideoDecoder calls should be made before |closure| is executed. | 88 // Note: No VideoDecoder calls should be made before |closure| is executed. |
| 88 virtual void Reset(const base::Closure& closure) = 0; | 89 virtual void Reset(const base::Closure& closure) = 0; |
| 89 | 90 |
| 90 // Returns true if the decoder needs bitstream conversion before decoding. | 91 // Returns true if the decoder needs bitstream conversion before decoding. |
| 91 virtual bool NeedsBitstreamConversion() const; | 92 virtual bool NeedsBitstreamConversion() const; |
| 92 | 93 |
| 93 // Returns true if the decoder currently has the ability to decode and return | 94 // Returns true if the decoder currently has the ability to decode and return |
| 94 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence | 95 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence |
| 95 // this will always return true. Override and return false for decoders that | 96 // this will always return true. Override and return false for decoders that |
| 96 // use a fixed set of VideoFrames for decoding. | 97 // use a fixed set of VideoFrames for decoding. |
| 97 virtual bool CanReadWithoutStalling() const; | 98 virtual bool CanReadWithoutStalling() const; |
| 98 | 99 |
| 99 // Returns maximum number of parallel decode requests. | 100 // Returns maximum number of parallel decode requests. |
| 100 virtual int GetMaxDecodeRequests() const; | 101 virtual int GetMaxDecodeRequests() const; |
| 101 | 102 |
| 102 private: | 103 private: |
| 103 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 104 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace media | 107 } // namespace media |
| 107 | 108 |
| 108 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 109 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
| OLD | NEW |