| 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" |
| 11 #include "media/base/decryptor.h" | 11 #include "media/base/decryptor.h" |
| 12 #include "media/base/demuxer_stream.h" | 12 #include "media/base/demuxer_stream.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class MessageLoopProxy; | 15 class MessageLoopProxy; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 | 19 |
| 20 class DecoderBuffer; | 20 class DecoderBuffer; |
| 21 class Decryptor; | 21 class Decryptor; |
| 22 | 22 |
| 23 // Decryptor-based AudioDecoder implementation that can decrypt and decode | 23 // Decryptor-based AudioDecoder implementation that can decrypt and decode |
| 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 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { | 27 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { |
| 28 public: | 28 public: |
| 29 // We do not currently have a way to let the Decryptor choose the output |
| 30 // audio sample format and notify us of its choice. Therefore, we require all |
| 31 // Decryptor implementations to decode audio into a fixed integer sample |
| 32 // format designated by kSupportedBitsPerChannel. |
| 33 // TODO(xhwang): Remove this restriction after http://crbug.com/169105 fixed. |
| 34 static const int kSupportedBitsPerChannel; |
| 35 |
| 29 DecryptingAudioDecoder( | 36 DecryptingAudioDecoder( |
| 30 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 37 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 31 const SetDecryptorReadyCB& set_decryptor_ready_cb); | 38 const SetDecryptorReadyCB& set_decryptor_ready_cb); |
| 32 | 39 |
| 33 // AudioDecoder implementation. | 40 // AudioDecoder implementation. |
| 34 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 41 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 35 const PipelineStatusCB& status_cb, | 42 const PipelineStatusCB& status_cb, |
| 36 const StatisticsCB& statistics_cb) OVERRIDE; | 43 const StatisticsCB& statistics_cb) OVERRIDE; |
| 37 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 44 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 38 virtual void Reset(const base::Closure& closure) OVERRIDE; | 45 virtual void Reset(const base::Closure& closure) OVERRIDE; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 158 |
| 152 base::TimeDelta output_timestamp_base_; | 159 base::TimeDelta output_timestamp_base_; |
| 153 int total_samples_decoded_; | 160 int total_samples_decoded_; |
| 154 | 161 |
| 155 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); | 162 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); |
| 156 }; | 163 }; |
| 157 | 164 |
| 158 } // namespace media | 165 } // namespace media |
| 159 | 166 |
| 160 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ | 167 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ |
| OLD | NEW |