OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FILTERS_DECODER_STREAM_H_ | 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_H_ |
6 #define MEDIA_FILTERS_DECODER_STREAM_H_ | 6 #define MEDIA_FILTERS_DECODER_STREAM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <memory> | 10 #include <memory> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 typedef typename StreamTraits::DecoderType Decoder; | 43 typedef typename StreamTraits::DecoderType Decoder; |
44 typedef typename StreamTraits::OutputType Output; | 44 typedef typename StreamTraits::OutputType Output; |
45 | 45 |
46 enum Status { | 46 enum Status { |
47 OK, // Everything went as planned. | 47 OK, // Everything went as planned. |
48 ABORTED, // Read aborted due to Reset() during pending read. | 48 ABORTED, // Read aborted due to Reset() during pending read. |
49 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. | 49 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. |
50 DECODE_ERROR, // Decoder returned decode error. | 50 DECODE_ERROR, // Decoder returned decode error. |
51 }; | 51 }; |
52 | 52 |
| 53 // Callback to create a list of decoders. |
| 54 using CreateDecodersCB = base::RepeatingCallback<ScopedVector<Decoder>()>; |
| 55 |
53 // Indicates completion of a DecoderStream initialization. | 56 // Indicates completion of a DecoderStream initialization. |
54 typedef base::Callback<void(bool success)> InitCB; | 57 using InitCB = base::Callback<void(bool success)>; |
55 | 58 |
56 // Indicates completion of a DecoderStream read. | 59 // Indicates completion of a DecoderStream read. |
57 typedef base::Callback<void(Status, const scoped_refptr<Output>&)> ReadCB; | 60 using ReadCB = base::Callback<void(Status, const scoped_refptr<Output>&)>; |
58 | 61 |
59 DecoderStream( | 62 DecoderStream(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
60 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 63 const CreateDecodersCB& create_decoders_cb, |
61 ScopedVector<Decoder> decoders, | 64 const scoped_refptr<MediaLog>& media_log); |
62 const scoped_refptr<MediaLog>& media_log); | |
63 virtual ~DecoderStream(); | 65 virtual ~DecoderStream(); |
64 | 66 |
65 // Returns the string representation of the StreamType for logging purpose. | 67 // Returns the string representation of the StreamType for logging purpose. |
66 std::string GetStreamTypeString(); | 68 std::string GetStreamTypeString(); |
67 | 69 |
68 // Initializes the DecoderStream and returns the initialization result | 70 // Initializes the DecoderStream and returns the initialization result |
69 // through |init_cb|. Note that |init_cb| is always called asynchronously. | 71 // through |init_cb|. Note that |init_cb| is always called asynchronously. |
70 // |cdm_context| can be used to handle encrypted stream. Can be null if the | 72 // |cdm_context| can be used to handle encrypted stream. Can be null if the |
71 // stream is not encrypted. | 73 // stream is not encrypted. |
72 void Initialize(DemuxerStream* stream, | 74 void Initialize(DemuxerStream* stream, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 264 |
263 template <> | 265 template <> |
264 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 266 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
265 | 267 |
266 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 268 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
267 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 269 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
268 | 270 |
269 } // namespace media | 271 } // namespace media |
270 | 272 |
271 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 273 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
OLD | NEW |