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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class DecryptingDemuxerStream; | 29 class DecryptingDemuxerStream; |
30 | 30 |
31 // Wraps a DemuxerStream and a list of Decoders and provides decoded | 31 // Wraps a DemuxerStream and a list of Decoders and provides decoded |
32 // output to its client (e.g. Audio/VideoRendererImpl). | 32 // output to its client (e.g. Audio/VideoRendererImpl). |
33 template<DemuxerStream::Type StreamType> | 33 template<DemuxerStream::Type StreamType> |
34 class MEDIA_EXPORT DecoderStream { | 34 class MEDIA_EXPORT DecoderStream { |
35 public: | 35 public: |
36 typedef DecoderStreamTraits<StreamType> StreamTraits; | 36 typedef DecoderStreamTraits<StreamType> StreamTraits; |
37 typedef typename StreamTraits::DecoderType Decoder; | 37 typedef typename StreamTraits::DecoderType Decoder; |
38 typedef typename StreamTraits::OutputType Output; | 38 typedef typename StreamTraits::OutputType Output; |
| 39 typedef typename StreamTraits::StreamInitCB InitCB; |
39 typedef typename Decoder::Status DecoderStatus; | 40 typedef typename Decoder::Status DecoderStatus; |
40 | 41 |
41 enum Status { | 42 enum Status { |
42 OK, // Everything went as planned. | 43 OK, // Everything went as planned. |
43 ABORTED, // Read aborted due to Reset() during pending read. | 44 ABORTED, // Read aborted due to Reset() during pending read. |
44 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. | 45 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. |
45 DECODE_ERROR, // Decoder returned decode error. | 46 DECODE_ERROR, // Decoder returned decode error. |
46 }; | 47 }; |
47 | 48 |
48 // Indicates completion of a DecoderStream initialization. | |
49 typedef base::Callback<void(bool success)> InitCB; | |
50 | |
51 // Indicates completion of a DecoderStream read. | 49 // Indicates completion of a DecoderStream read. |
52 typedef base::Callback<void(Status, const scoped_refptr<Output>&)> ReadCB; | 50 typedef base::Callback<void(Status, const scoped_refptr<Output>&)> ReadCB; |
53 | 51 |
54 DecoderStream( | 52 DecoderStream( |
55 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
56 ScopedVector<Decoder> decoders, | 54 ScopedVector<Decoder> decoders, |
57 const scoped_refptr<MediaLog>& media_log); | 55 const scoped_refptr<MediaLog>& media_log); |
58 virtual ~DecoderStream(); | 56 virtual ~DecoderStream(); |
59 | 57 |
60 // Initializes the DecoderStream and returns the initialization result | 58 // Initializes the DecoderStream and returns the initialization result |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). | 148 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). |
151 void ReadFromDemuxerStream(); | 149 void ReadFromDemuxerStream(); |
152 | 150 |
153 // Callback for DemuxerStream::Read(). | 151 // Callback for DemuxerStream::Read(). |
154 void OnBufferReady(DemuxerStream::Status status, | 152 void OnBufferReady(DemuxerStream::Status status, |
155 const scoped_refptr<DecoderBuffer>& buffer); | 153 const scoped_refptr<DecoderBuffer>& buffer); |
156 | 154 |
157 void ReinitializeDecoder(); | 155 void ReinitializeDecoder(); |
158 | 156 |
159 // Callback for Decoder reinitialization. | 157 // Callback for Decoder reinitialization. |
160 void OnDecoderReinitialized(bool success); | 158 void OnDecoderReinitialized(PipelineStatus status); |
161 | 159 |
162 void CompleteDecoderReinitialization(bool success); | 160 void CompleteDecoderReinitialization(bool success); |
163 | 161 |
164 void ResetDecoder(); | 162 void ResetDecoder(); |
165 void OnDecoderReset(); | 163 void OnDecoderReset(); |
166 | 164 |
167 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 165 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
168 | 166 |
169 scoped_refptr<MediaLog> media_log_; | 167 scoped_refptr<MediaLog> media_log_; |
170 | 168 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 214 |
217 template <> | 215 template <> |
218 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 216 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
219 | 217 |
220 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 218 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
221 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 219 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
222 | 220 |
223 } // namespace media | 221 } // namespace media |
224 | 222 |
225 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 223 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
OLD | NEW |