Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1347)

Side by Side Diff: media/filters/audio_decoder_selector.h

Issue 11492003: Encrypted Media: Support Audio Decrypt-Only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments mostly resolved (I believe); need to add/update tests if this looks good Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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.
ddorwin 2012/12/13 05:08:25 What should a caller do with the DDS?
xhwang 2012/12/13 11:24:36 Done.
40 typedef base::Callback<
41 void(const scoped_refptr<AudioDecoder>&,
42 const scoped_refptr<DecryptingDemuxerStream>&)> SelectDecoderCB;
43
44 // If |set_decryptor_ready_cb| is null, no decryptor will be available
45 // to perform decryption. This could happen if --enable-encrypted-media
46 // is not set.
47 AudioDecoderSelector(
48 const scoped_refptr<base::MessageLoopProxy>& message_loop,
49 const AudioDecoderList& clear_decoders,
50 const SetDecryptorReadyCB& set_decryptor_ready_cb);
51 ~AudioDecoderSelector();
52
53 void SelectAudioDecoder(const scoped_refptr<DemuxerStream>& stream,
54 const StatisticsCB& statistics_cb,
55 const SelectDecoderCB& select_decoder_cb);
56
57 private:
58 void DecryptingAudioDecoderInitDone(PipelineStatus status);
59 void DecryptingDemuxerStreamInitDone(PipelineStatus status);
60 void InitializeNextClearDecoder();
61 void ClearDecoderInitDone(PipelineStatus status);
62
63 scoped_refptr<base::MessageLoopProxy> message_loop_;
64 AudioDecoderList clear_decoders_;
65 SetDecryptorReadyCB set_decryptor_ready_cb_;
66
67 scoped_refptr<DemuxerStream> input_stream_;
68 StatisticsCB statistics_cb_;
69 SelectDecoderCB select_decoder_cb_;
70
71 scoped_refptr<AudioDecoder> audio_decoder_;
72 scoped_refptr<DecryptingDemuxerStream> decrypted_stream_;
73
74 base::WeakPtrFactory<AudioDecoderSelector> weak_ptr_factory_;
75 base::WeakPtr<AudioDecoderSelector> weak_this_;
76
77 DISALLOW_COPY_AND_ASSIGN(AudioDecoderSelector);
78 };
79
80 } // namespace media
81
82 #endif // MEDIA_FILTERS_AUDIO_DECODER_SELECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698