Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ | |
| 6 #define MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "media/base/audio_decoder.h" | |
| 14 #include "media/base/decryptor.h" | |
| 15 #include "media/base/demuxer_stream.h" | |
| 16 | |
| 17 namespace base { | |
| 18 class MessageLoopProxy; | |
| 19 } | |
| 20 | |
| 21 namespace media { | |
| 22 | |
| 23 class DecoderBuffer; | |
| 24 class DecryptingDemuxerStream; | |
| 25 class Decryptor; | |
| 26 | |
| 27 // AudioDecoderSelector (creates if necessary and) initializes the proper | |
| 28 // AudioDecoder for a given DemuxerStream. If the given DemuxerStream is | |
| 29 // encrypted, a DecryptingDemuxerStream may also be created. | |
| 30 class MEDIA_EXPORT AudioDecoderSelector { | |
| 31 public: | |
| 32 typedef std::list<scoped_refptr<AudioDecoder> > AudioDecoderList; | |
| 33 | |
| 34 // Indicates completion of AudioDecoder selection. | |
| 35 // - First parameter: The initialized AudioDecoder. If it's set to NULL, then | |
| 36 // AudioDecoder initialization failed. | |
| 37 // - Second parameter: The initialized DecryptingDemuxerStream. If it's not | |
| 38 // NULL, then a DecryptingDemuxerStream is created and initialized to do | |
| 39 // decryption for the initialized AudioDecoder. | |
| 40 // Note: The caller owns selected AudioDecoder and DecryptingDemuxerStream. | |
| 41 // The caller should call DecryptingDemuxerStream::Reset() before | |
| 42 // calling AudioDecoder::Reset() to release any pending decryption or read. | |
| 43 typedef base::Callback< | |
| 44 void(const scoped_refptr<AudioDecoder>&, | |
| 45 const scoped_refptr<DecryptingDemuxerStream>&)> SelectDecoderCB; | |
| 46 | |
| 47 // |set_decryptor_ready_cb| is optional. If |set_decryptor_ready_cb| is null, | |
| 48 // no decryptor will be available to perform decryption. | |
| 49 AudioDecoderSelector( | |
| 50 const scoped_refptr<base::MessageLoopProxy>& message_loop, | |
| 51 const AudioDecoderList& decoders, | |
| 52 const SetDecryptorReadyCB& set_decryptor_ready_cb); | |
| 53 ~AudioDecoderSelector(); | |
| 54 | |
| 55 void SelectAudioDecoder(const scoped_refptr<DemuxerStream>& stream, | |
| 56 const StatisticsCB& statistics_cb, | |
| 57 const SelectDecoderCB& select_decoder_cb); | |
| 58 | |
| 59 private: | |
| 60 void DecryptingAudioDecoderInitDone(PipelineStatus status); | |
| 61 void DecryptingDemuxerStreamInitDone(PipelineStatus status); | |
| 62 void InitializeNextDecoder(); | |
| 63 void DecoderInitDone(PipelineStatus status); | |
| 64 | |
| 65 scoped_refptr<base::MessageLoopProxy> message_loop_; | |
| 66 AudioDecoderList decoders_; | |
| 67 SetDecryptorReadyCB set_decryptor_ready_cb_; | |
| 68 | |
| 69 scoped_refptr<DemuxerStream> input_stream_; | |
| 70 StatisticsCB statistics_cb_; | |
| 71 SelectDecoderCB select_decoder_cb_; | |
| 72 | |
| 73 scoped_refptr<AudioDecoder> audio_decoder_; | |
| 74 scoped_refptr<DecryptingDemuxerStream> decrypted_stream_; | |
| 75 | |
| 76 base::WeakPtrFactory<AudioDecoderSelector> weak_this_; | |
|
ddorwin
2012/12/14 05:17:01
shouldn't this be named ...factory_? The type is n
xhwang
2012/12/14 05:50:07
I was following http://code.google.com/searchframe
| |
| 77 | |
| 78 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDecoderSelector); | |
| 79 }; | |
| 80 | |
| 81 } // namespace media | |
| 82 | |
| 83 #endif // MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ | |
| OLD | NEW |