| 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 <list> |
| 9 |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 11 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 14 #include "media/base/audio_decoder.h" | 16 #include "media/base/audio_decoder.h" |
| 15 #include "media/base/decryptor.h" | 17 #include "media/base/cdm_context.h" |
| 16 #include "media/base/demuxer_stream.h" | 18 #include "media/base/demuxer_stream.h" |
| 17 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
| 18 #include "media/base/media_log.h" | 20 #include "media/base/media_log.h" |
| 19 #include "media/base/pipeline_status.h" | 21 #include "media/base/pipeline_status.h" |
| 20 #include "media/base/timestamp_constants.h" | 22 #include "media/base/timestamp_constants.h" |
| 21 #include "media/filters/decoder_selector.h" | 23 #include "media/filters/decoder_selector.h" |
| 22 #include "media/filters/decoder_stream_traits.h" | 24 #include "media/filters/decoder_stream_traits.h" |
| 23 | 25 |
| 24 namespace base { | 26 namespace base { |
| 25 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const scoped_refptr<MediaLog>& media_log); | 60 const scoped_refptr<MediaLog>& media_log); |
| 59 virtual ~DecoderStream(); | 61 virtual ~DecoderStream(); |
| 60 | 62 |
| 61 // Returns the string representation of the StreamType for logging purpose. | 63 // Returns the string representation of the StreamType for logging purpose. |
| 62 std::string GetStreamTypeString(); | 64 std::string GetStreamTypeString(); |
| 63 | 65 |
| 64 // Initializes the DecoderStream and returns the initialization result | 66 // Initializes the DecoderStream and returns the initialization result |
| 65 // through |init_cb|. Note that |init_cb| is always called asynchronously. | 67 // through |init_cb|. Note that |init_cb| is always called asynchronously. |
| 66 void Initialize(DemuxerStream* stream, | 68 void Initialize(DemuxerStream* stream, |
| 67 const InitCB& init_cb, | 69 const InitCB& init_cb, |
| 68 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 70 const SetCdmReadyCB& set_cdm_ready_cb, |
| 69 const StatisticsCB& statistics_cb, | 71 const StatisticsCB& statistics_cb, |
| 70 const base::Closure& waiting_for_decryption_key_cb); | 72 const base::Closure& waiting_for_decryption_key_cb); |
| 71 | 73 |
| 72 // Reads a decoded Output and returns it via the |read_cb|. Note that | 74 // Reads a decoded Output and returns it via the |read_cb|. Note that |
| 73 // |read_cb| is always called asynchronously. This method should only be | 75 // |read_cb| is always called asynchronously. This method should only be |
| 74 // called after initialization has succeeded and must not be called during | 76 // called after initialization has succeeded and must not be called during |
| 75 // pending Reset(). | 77 // pending Reset(). |
| 76 void Read(const ReadCB& read_cb); | 78 void Read(const ReadCB& read_cb); |
| 77 | 79 |
| 78 // Resets the decoder, flushes all decoded outputs and/or internal buffers, | 80 // Resets the decoder, flushes all decoded outputs and/or internal buffers, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 STATE_UNINITIALIZED, | 124 STATE_UNINITIALIZED, |
| 123 STATE_INITIALIZING, | 125 STATE_INITIALIZING, |
| 124 STATE_NORMAL, // Includes idle, pending decoder decode/reset. | 126 STATE_NORMAL, // Includes idle, pending decoder decode/reset. |
| 125 STATE_FLUSHING_DECODER, | 127 STATE_FLUSHING_DECODER, |
| 126 STATE_PENDING_DEMUXER_READ, | 128 STATE_PENDING_DEMUXER_READ, |
| 127 STATE_REINITIALIZING_DECODER, | 129 STATE_REINITIALIZING_DECODER, |
| 128 STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads. | 130 STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads. |
| 129 STATE_ERROR | 131 STATE_ERROR |
| 130 }; | 132 }; |
| 131 | 133 |
| 132 void SelectDecoder(const SetDecryptorReadyCB& set_decryptor_ready_cb); | 134 void SelectDecoder(const SetCdmReadyCB& set_cdm_ready_cb); |
| 133 | 135 |
| 134 // Called when |decoder_selector| selected the |selected_decoder|. | 136 // Called when |decoder_selector| selected the |selected_decoder|. |
| 135 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream | 137 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream |
| 136 // is created to help decrypt the encrypted stream. | 138 // is created to help decrypt the encrypted stream. |
| 137 void OnDecoderSelected( | 139 void OnDecoderSelected( |
| 138 scoped_ptr<Decoder> selected_decoder, | 140 scoped_ptr<Decoder> selected_decoder, |
| 139 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream); | 141 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream); |
| 140 | 142 |
| 141 // Satisfy pending |read_cb_| with |status| and |output|. | 143 // Satisfy pending |read_cb_| with |status| and |output|. |
| 142 void SatisfyRead(Status status, | 144 void SatisfyRead(Status status, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 228 |
| 227 template <> | 229 template <> |
| 228 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 230 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
| 229 | 231 |
| 230 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 232 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
| 231 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 233 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
| 232 | 234 |
| 233 } // namespace media | 235 } // namespace media |
| 234 | 236 |
| 235 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 237 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
| OLD | NEW |