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 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "media/base/audio_decoder.h" | 17 #include "media/base/audio_decoder.h" |
| 18 #include "media/base/audio_timestamp_helper.h" |
17 #include "media/base/demuxer_stream.h" | 19 #include "media/base/demuxer_stream.h" |
18 #include "media/base/media_export.h" | 20 #include "media/base/media_export.h" |
19 #include "media/base/media_log.h" | 21 #include "media/base/media_log.h" |
20 #include "media/base/moving_average.h" | 22 #include "media/base/moving_average.h" |
21 #include "media/base/pipeline_status.h" | 23 #include "media/base/pipeline_status.h" |
22 #include "media/base/timestamp_constants.h" | 24 #include "media/base/timestamp_constants.h" |
23 #include "media/filters/decoder_selector.h" | 25 #include "media/filters/decoder_selector.h" |
24 #include "media/filters/decoder_stream_traits.h" | 26 #include "media/filters/decoder_stream_traits.h" |
25 | 27 |
26 namespace base { | 28 namespace base { |
27 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
28 } | 30 } |
29 | 31 |
30 namespace media { | 32 namespace media { |
31 | 33 |
32 class CdmContext; | 34 class CdmContext; |
33 class DecryptingDemuxerStream; | 35 class DecryptingDemuxerStream; |
34 | 36 |
35 // Wraps a DemuxerStream and a list of Decoders and provides decoded | 37 // Wraps a DemuxerStream and a list of Decoders and provides decoded |
36 // output to its client (e.g. Audio/VideoRendererImpl). | 38 // output to its client (e.g. Audio/VideoRendererImpl). |
37 template<DemuxerStream::Type StreamType> | 39 template<DemuxerStream::Type StreamType> |
38 class MEDIA_EXPORT DecoderStream { | 40 class MEDIA_EXPORT DecoderStream { |
39 public: | 41 public: |
40 typedef DecoderStreamTraits<StreamType> StreamTraits; | 42 typedef DecoderStreamTraits<StreamType> StreamTraits; |
41 typedef typename StreamTraits::DecoderType Decoder; | 43 typedef typename StreamTraits::DecoderType Decoder; |
42 typedef typename StreamTraits::OutputType Output; | 44 typedef typename StreamTraits::OutputType Output; |
| 45 typedef typename StreamTraits::ConfigType Config; |
43 | 46 |
44 enum Status { | 47 enum Status { |
45 OK, // Everything went as planned. | 48 OK, // Everything went as planned. |
46 ABORTED, // Read aborted due to Reset() during pending read. | 49 ABORTED, // Read aborted due to Reset() during pending read. |
47 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. | 50 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. |
48 DECODE_ERROR, // Decoder returned decode error. | 51 DECODE_ERROR, // Decoder returned decode error. |
49 }; | 52 }; |
50 | 53 |
51 // Indicates completion of a DecoderStream initialization. | 54 // Indicates completion of a DecoderStream initialization. |
52 typedef base::Callback<void(bool success)> InitCB; | 55 typedef base::Callback<void(bool success)> InitCB; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void ReinitializeDecoder(); | 188 void ReinitializeDecoder(); |
186 | 189 |
187 // Callback for Decoder reinitialization. | 190 // Callback for Decoder reinitialization. |
188 void OnDecoderReinitialized(bool success); | 191 void OnDecoderReinitialized(bool success); |
189 | 192 |
190 void CompleteDecoderReinitialization(bool success); | 193 void CompleteDecoderReinitialization(bool success); |
191 | 194 |
192 void ResetDecoder(); | 195 void ResetDecoder(); |
193 void OnDecoderReset(); | 196 void OnDecoderReset(); |
194 | 197 |
| 198 DecoderStreamTraits<StreamType> traits_; |
| 199 |
195 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 200 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
196 | 201 |
197 scoped_refptr<MediaLog> media_log_; | 202 scoped_refptr<MediaLog> media_log_; |
198 | 203 |
199 State state_; | 204 State state_; |
200 | 205 |
201 StatisticsCB statistics_cb_; | 206 StatisticsCB statistics_cb_; |
202 InitCB init_cb_; | 207 InitCB init_cb_; |
203 base::Closure waiting_for_decryption_key_cb_; | 208 base::Closure waiting_for_decryption_key_cb_; |
204 | 209 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 275 |
271 template <> | 276 template <> |
272 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 277 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
273 | 278 |
274 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 279 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
275 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 280 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
276 | 281 |
277 } // namespace media | 282 } // namespace media |
278 | 283 |
279 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 284 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
OLD | NEW |