Index: media/filters/audio_decoder_selector.h |
diff --git a/media/filters/audio_decoder_selector.h b/media/filters/audio_decoder_selector.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8e2a954ad7bae41cc5c676515775ab40d3180be9 |
--- /dev/null |
+++ b/media/filters/audio_decoder_selector.h |
@@ -0,0 +1,84 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ |
+#define MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ |
+ |
+#include <list> |
+ |
+#include "base/callback.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "media/base/audio_decoder.h" |
+#include "media/base/decryptor.h" |
+#include "media/base/demuxer_stream.h" |
+ |
+namespace base { |
+class MessageLoopProxy; |
+} |
+ |
+namespace media { |
+ |
+class DecoderBuffer; |
+class DecryptingDemuxerStream; |
+class Decryptor; |
+ |
+// AudioDecoderSelector (creates if necessary and) initializes the proper |
+// AudioDecoder for a given DemuxerStream. If the given DemuxerStream is |
+// encrypted, a DecryptingDemuxerStream may also be created. |
+class MEDIA_EXPORT AudioDecoderSelector { |
+ public: |
+ typedef std::list<scoped_refptr<AudioDecoder> > AudioDecoderList; |
+ |
+ // Indicates completion of AudioDecoder selection. |
+ // - First parameter: The initialized AudioDecoder. If it's set to NULL, then |
+ // AudioDecoder initialization failed. |
+ // - Second parameter: The initialized DecryptingDemuxerStream. If it's not |
+ // NULL, then a DecryptingDemuxerStream is created and initialized to do |
+ // decryption for the initialized AudioDecoder. |
+ // 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.
|
+ // AudioDecoder::Reset() to release any pending decryption or read. |
+ typedef base::Callback< |
+ void(const scoped_refptr<AudioDecoder>&, |
+ const scoped_refptr<DecryptingDemuxerStream>&)> SelectDecoderCB; |
+ |
+ // If |set_decryptor_ready_cb| is null, no decryptor will be available |
+ // 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.
|
+ // is not set. |
+ AudioDecoderSelector( |
+ const scoped_refptr<base::MessageLoopProxy>& message_loop, |
+ 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.
|
+ const SetDecryptorReadyCB& set_decryptor_ready_cb); |
+ ~AudioDecoderSelector(); |
+ |
+ void SelectAudioDecoder(const scoped_refptr<DemuxerStream>& stream, |
+ const StatisticsCB& statistics_cb, |
+ const SelectDecoderCB& select_decoder_cb); |
+ |
+ private: |
+ void DecryptingAudioDecoderInitDone(PipelineStatus status); |
+ void DecryptingDemuxerStreamInitDone(PipelineStatus status); |
+ 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.
|
+ void ClearDecoderInitDone(PipelineStatus status); |
+ |
+ scoped_refptr<base::MessageLoopProxy> message_loop_; |
+ AudioDecoderList clear_decoders_; |
+ SetDecryptorReadyCB set_decryptor_ready_cb_; |
+ |
+ scoped_refptr<DemuxerStream> input_stream_; |
+ StatisticsCB statistics_cb_; |
+ SelectDecoderCB select_decoder_cb_; |
+ |
+ scoped_refptr<AudioDecoder> audio_decoder_; |
+ scoped_refptr<DecryptingDemuxerStream> decrypted_stream_; |
+ |
+ base::WeakPtrFactory<AudioDecoderSelector> weak_ptr_factory_; |
+ base::WeakPtr<AudioDecoderSelector> weak_this_; |
+ |
+ 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.
|
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_ |