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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // | 48 // |
49 // Implementations guarantee that the callback will not be called from within | 49 // Implementations guarantee that the callback will not be called from within |
50 // this method. | 50 // this method. |
51 // | 51 // |
52 // If the returned status is kOk: | 52 // If the returned status is kOk: |
53 // - Non-EOS (end of stream) frame contains decoded video data. | 53 // - Non-EOS (end of stream) frame contains decoded video data. |
54 // - EOS frame indicates the end of the stream. | 54 // - EOS frame indicates the end of the stream. |
55 // - NULL frame indicates an aborted decode. This can happen if Reset() or | 55 // - NULL frame indicates an aborted decode. This can happen if Reset() or |
56 // Stop() is called during the decoding process. | 56 // Stop() is called during the decoding process. |
57 // Otherwise the returned frame must be NULL. | 57 // Otherwise the returned frame must be NULL. |
58 // | 58 typedef base::Callback<void(Status, |
59 // TODO(xhwang): Rename this to DecodeCB. | 59 const scoped_refptr<VideoFrame>&)> DecodeCB; |
60 typedef base::Callback<void(Status, const scoped_refptr<VideoFrame>&)> ReadCB; | |
61 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 60 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
62 const ReadCB& read_cb) = 0; | 61 const DecodeCB& decode_cb) = 0; |
63 | 62 |
64 // Resets decoder state, fulfilling all pending ReadCB and dropping extra | 63 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra |
65 // queued decoded data. After this call, the decoder is back to an initialized | 64 // queued decoded data. After this call, the decoder is back to an initialized |
66 // clean state. | 65 // clean state. |
67 // Note: No VideoDecoder calls should be made before |closure| is executed. | 66 // Note: No VideoDecoder calls should be made before |closure| is executed. |
68 virtual void Reset(const base::Closure& closure) = 0; | 67 virtual void Reset(const base::Closure& closure) = 0; |
69 | 68 |
70 // Stops decoder, fires any pending callbacks and sets the decoder to an | 69 // Stops decoder, fires any pending callbacks and sets the decoder to an |
71 // uninitialized state. A VideoDecoder cannot be re-initialized after it has | 70 // uninitialized state. A VideoDecoder cannot be re-initialized after it has |
72 // been stopped. | 71 // been stopped. |
73 // Note that if Initialize() has been called, Stop() must be called and | 72 // Note that if Initialize() has been called, Stop() must be called and |
74 // complete before deleting the decoder. | 73 // complete before deleting the decoder. |
(...skipping 13 matching lines...) Expand all Loading... |
88 // use a fixed set of VideoFrames for decoding. | 87 // use a fixed set of VideoFrames for decoding. |
89 virtual bool CanReadWithoutStalling() const; | 88 virtual bool CanReadWithoutStalling() const; |
90 | 89 |
91 private: | 90 private: |
92 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 91 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
93 }; | 92 }; |
94 | 93 |
95 } // namespace media | 94 } // namespace media |
96 | 95 |
97 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 96 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
OLD | NEW |