| OLD | NEW |
| 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 Loading... |
| 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 RequestDecryptorNotificationCB& request_decryptor_notification_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; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ |
| OLD | NEW |