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: DecryptingDemuxerStream::Reset() should be called before | |
|
ddorwin
2012/12/13 23:09:43
Does the caller own the DDS?
"The caller should ca
xhwang
2012/12/14 03:16:21
Done.
| |
| 41 // AudioDecoder::Reset() to release any pending decryption or read. | |
| 42 typedef base::Callback< | |
| 43 void(const scoped_refptr<AudioDecoder>&, | |
| 44 const scoped_refptr<DecryptingDemuxerStream>&)> SelectDecoderCB; | |
| 45 | |
| 46 // If |set_decryptor_ready_cb| is null, no decryptor will be available | |
| 47 // to perform decryption. This could happen if --enable-encrypted-media | |
|
scherkus (not reviewing)
2012/12/13 23:39:07
nit: don't talk about the switch, just say it's an
xhwang
2012/12/14 03:16:21
Done.
| |
| 48 // is not set. | |
| 49 AudioDecoderSelector( | |
| 50 const scoped_refptr<base::MessageLoopProxy>& message_loop, | |
| 51 const AudioDecoderList& clear_decoders, | |
|
scherkus (not reviewing)
2012/12/13 23:39:07
no clue what "clear_decoders" means
why not simpl
xhwang
2012/12/14 03:16:21
Done.
| |
| 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 InitializeNextClearDecoder(); | |
|
scherkus (not reviewing)
2012/12/13 23:39:07
I'm really not finding the usage of "Clear" to be
xhwang
2012/12/14 03:16:21
Done.
| |
| 63 void ClearDecoderInitDone(PipelineStatus status); | |
| 64 | |
| 65 scoped_refptr<base::MessageLoopProxy> message_loop_; | |
| 66 AudioDecoderList clear_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_ptr_factory_; | |
| 77 base::WeakPtr<AudioDecoderSelector> weak_this_; | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(AudioDecoderSelector); | |
|
scherkus (not reviewing)
2012/12/13 23:39:07
s/C_A_A/IMPLICIT_CONSTRUCTORS/ (since you don't de
xhwang
2012/12/14 03:16:21
Done.
| |
| 80 }; | |
| 81 | |
| 82 } // namespace media | |
| 83 | |
| 84 #endif // MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ | |
| OLD | NEW |