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

Side by Side Diff: media/filters/decrypting_audio_decoder.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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_DECRYPTING_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/audio_decoder.h" 10 #include "media/base/audio_decoder.h"
(...skipping 13 matching lines...) Expand all
24 // encrypted audio buffers and return decrypted and decompressed audio frames. 24 // encrypted audio buffers and return decrypted and decompressed audio frames.
25 // All public APIs and callbacks are trampolined to the |message_loop_| so 25 // All public APIs and callbacks are trampolined to the |message_loop_| so
26 // that no locks are required for thread safety. 26 // that no locks are required for thread safety.
27 // 27 //
28 // TODO(xhwang): For now, DecryptingAudioDecoder relies on the decryptor to do 28 // TODO(xhwang): For now, DecryptingAudioDecoder relies on the decryptor to do
29 // both decryption and audio decoding. Add the path to use the decryptor for 29 // both decryption and audio decoding. Add the path to use the decryptor for
30 // decryption only and use other AudioDecoder implementations within 30 // decryption only and use other AudioDecoder implementations within
31 // DecryptingAudioDecoder for audio decoding. 31 // DecryptingAudioDecoder for audio decoding.
32 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { 32 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder {
33 public: 33 public:
34 // Callback to notify decryptor creation.
35 typedef base::Callback<void(Decryptor*)> DecryptorNotificationCB;
36 // Callback to request/cancel decryptor creation notification.
37 // Calling this callback with a non-null callback registers decryptor creation
38 // notification. When the decryptor is created, notification will be sent
39 // through the provided callback.
40 // Calling this callback with a null callback cancels previously registered
41 // decryptor creation notification. Any previously provided callback will be
42 // fired immediately with NULL.
43 typedef base::Callback<void(const DecryptorNotificationCB&)>
44 RequestDecryptorNotificationCB;
45
46 DecryptingAudioDecoder( 34 DecryptingAudioDecoder(
47 const scoped_refptr<base::MessageLoopProxy>& message_loop, 35 const scoped_refptr<base::MessageLoopProxy>& message_loop,
48 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); 36 const SetDecryptorReadyCB& set_decryptor_ready_cb);
49 37
50 // AudioDecoder implementation. 38 // AudioDecoder implementation.
51 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 39 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
52 const PipelineStatusCB& status_cb, 40 const PipelineStatusCB& status_cb,
53 const StatisticsCB& statistics_cb) OVERRIDE; 41 const StatisticsCB& statistics_cb) OVERRIDE;
54 virtual void Read(const ReadCB& read_cb) OVERRIDE; 42 virtual void Read(const ReadCB& read_cb) OVERRIDE;
55 virtual void Reset(const base::Closure& closure) OVERRIDE; 43 virtual void Reset(const base::Closure& closure) OVERRIDE;
56 virtual int bits_per_channel() OVERRIDE; 44 virtual int bits_per_channel() OVERRIDE;
57 virtual ChannelLayout channel_layout() OVERRIDE; 45 virtual ChannelLayout channel_layout() OVERRIDE;
58 virtual int samples_per_second() OVERRIDE; 46 virtual int samples_per_second() OVERRIDE;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 116
129 PipelineStatusCB init_cb_; 117 PipelineStatusCB init_cb_;
130 StatisticsCB statistics_cb_; 118 StatisticsCB statistics_cb_;
131 ReadCB read_cb_; 119 ReadCB read_cb_;
132 base::Closure reset_cb_; 120 base::Closure reset_cb_;
133 121
134 // Pointer to the demuxer stream that will feed us compressed buffers. 122 // Pointer to the demuxer stream that will feed us compressed buffers.
135 scoped_refptr<DemuxerStream> demuxer_stream_; 123 scoped_refptr<DemuxerStream> demuxer_stream_;
136 124
137 // Callback to request/cancel decryptor creation notification. 125 // Callback to request/cancel decryptor creation notification.
138 RequestDecryptorNotificationCB request_decryptor_notification_cb_; 126 SetDecryptorReadyCB set_decryptor_ready_cb_;
139 127
140 Decryptor* decryptor_; 128 Decryptor* decryptor_;
141 129
142 // The buffer returned by the demuxer that needs decrypting/decoding. 130 // The buffer returned by the demuxer that needs decrypting/decoding.
143 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; 131 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_;
144 132
145 // Indicates the situation where new key is added during pending decode 133 // Indicates the situation where new key is added during pending decode
146 // (in other words, this variable can only be set in state kPendingDecode). 134 // (in other words, this variable can only be set in state kPendingDecode).
147 // If this variable is true and kNoKey is returned then we need to try 135 // If this variable is true and kNoKey is returned then we need to try
148 // decrypting/decoding again in case the newly added key is the correct 136 // decrypting/decoding again in case the newly added key is the correct
(...skipping 11 matching lines...) Expand all
160 148
161 base::TimeDelta output_timestamp_base_; 149 base::TimeDelta output_timestamp_base_;
162 int total_samples_decoded_; 150 int total_samples_decoded_;
163 151
164 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); 152 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder);
165 }; 153 };
166 154
167 } // namespace media 155 } // namespace media
168 156
169 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 157 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698