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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 // Initializes a VideoDecoder with the given |config|, executing the | 54 // Initializes a VideoDecoder with the given |config|, executing the |
55 // |status_cb| upon completion. |output_cb| is called for each output frame | 55 // |status_cb| upon completion. |output_cb| is called for each output frame |
56 // decoded by Decode(). | 56 // decoded by Decode(). |
57 // | 57 // |
58 // Note: | 58 // Note: |
59 // 1) The VideoDecoder will be reinitialized if it was initialized before. | 59 // 1) The VideoDecoder will be reinitialized if it was initialized before. |
60 // Upon reinitialization, all internal buffered frames will be dropped. | 60 // Upon reinitialization, all internal buffered frames will be dropped. |
61 // 2) This method should not be called during pending decode or reset. | 61 // 2) This method should not be called during pending decode or reset. |
62 // 3) No VideoDecoder calls should be made before |status_cb| is executed. | 62 // 3) No VideoDecoder calls should be made before |status_cb| is executed. |
63 virtual void Initialize(const VideoDecoderConfig& config, | 63 virtual void Initialize(const VideoDecoderConfig& config, |
64 bool low_delay, | 64 bool low_delay, |
xhwang
2015/01/16 01:24:33
We need a documentation of |low_delay| here...
Sergey Ulanov
2015/01/16 01:53:39
Done.
| |
65 const PipelineStatusCB& status_cb, | 65 const PipelineStatusCB& status_cb, |
66 const OutputCB& output_cb) = 0; | 66 const OutputCB& output_cb) = 0; |
67 | 67 |
68 // Requests a |buffer| to be decoded. The status of the decoder and decoded | 68 // Requests a |buffer| to be decoded. The status of the decoder and decoded |
69 // frame are returned via the provided callback. Some decoders may allow | 69 // frame are returned via the provided callback. Some decoders may allow |
70 // decoding multiple buffers in parallel. Callers should call | 70 // decoding multiple buffers in parallel. Callers should call |
71 // GetMaxDecodeRequests() to get number of buffers that may be decoded in | 71 // GetMaxDecodeRequests() to get number of buffers that may be decoded in |
72 // parallel. Decoder must call |decode_cb| in the same order in which Decode() | 72 // parallel. Decoder must call |decode_cb| in the same order in which Decode() |
73 // is called. | 73 // is called. |
74 // | 74 // |
75 // Implementations guarantee that the callback will not be called from within | 75 // Implementations guarantee that the callback will not be called from within |
76 // this method and that |decode_cb| will not be blocked on the following | 76 // this method and that |decode_cb| will not be blocked on the following |
77 // Decode() calls (i.e. |decode_cb| will be called even if Decode() is never | 77 // Decode() calls (i.e. |decode_cb| will be called even if Decode() is never |
78 // called again). | 78 // called again). |
79 // | 79 // |
80 // After decoding is finished the decoder calls |output_cb| specified in | 80 // After decoding is finished the decoder calls |output_cb| specified in |
81 // Initialize() for each decoded frame. |output_cb| may be called before or | 81 // Initialize() for each decoded frame. In general |output_cb| may be called |
82 // after |decode_cb|. | 82 // before or after |decode_cb|, but software decoders in low-delay mode must |
83 // call |output_cb| for all frames in |buffer| before calling |decode_cb|. | |
83 // | 84 // |
84 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. | 85 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. |
85 // |output_cb| must be called for each frame pending in the queue and | 86 // |output_cb| must be called for each frame pending in the queue and |
86 // |decode_cb| must be called after that. Callers will not call Decode() | 87 // |decode_cb| must be called after that. Callers will not call Decode() |
87 // again until after the flush completes. | 88 // again until after the flush completes. |
88 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 89 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
89 const DecodeCB& decode_cb) = 0; | 90 const DecodeCB& decode_cb) = 0; |
90 | 91 |
91 // Resets decoder state. All pending Decode() requests will be finished or | 92 // Resets decoder state. All pending Decode() requests will be finished or |
92 // aborted before |closure| is called. | 93 // aborted before |closure| is called. |
(...skipping 12 matching lines...) Expand all Loading... | |
105 // Returns maximum number of parallel decode requests. | 106 // Returns maximum number of parallel decode requests. |
106 virtual int GetMaxDecodeRequests() const; | 107 virtual int GetMaxDecodeRequests() const; |
107 | 108 |
108 private: | 109 private: |
109 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 110 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
110 }; | 111 }; |
111 | 112 |
112 } // namespace media | 113 } // namespace media |
113 | 114 |
114 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 115 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
OLD | NEW |