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 "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class Decryptor; | 25 class Decryptor; |
26 | 26 |
27 // Decryptor-based AudioDecoder implementation that can decrypt and decode | 27 // Decryptor-based AudioDecoder implementation that can decrypt and decode |
28 // encrypted audio buffers and return decrypted and decompressed audio frames. | 28 // encrypted audio buffers and return decrypted and decompressed audio frames. |
29 // All public APIs and callbacks are trampolined to the |task_runner_| so | 29 // All public APIs and callbacks are trampolined to the |task_runner_| so |
30 // that no locks are required for thread safety. | 30 // that no locks are required for thread safety. |
31 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { | 31 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { |
32 public: | 32 public: |
33 DecryptingAudioDecoder( | 33 DecryptingAudioDecoder( |
34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
35 const SetDecryptorReadyCB& set_decryptor_ready_cb); | 35 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
| 36 const base::Closure& waiting_for_decryption_key_cb); |
36 ~DecryptingAudioDecoder() override; | 37 ~DecryptingAudioDecoder() override; |
37 | 38 |
38 // AudioDecoder implementation. | 39 // AudioDecoder implementation. |
39 std::string GetDisplayName() const override; | 40 std::string GetDisplayName() const override; |
40 void Initialize(const AudioDecoderConfig& config, | 41 void Initialize(const AudioDecoderConfig& config, |
41 const PipelineStatusCB& status_cb, | 42 const PipelineStatusCB& status_cb, |
42 const OutputCB& output_cb) override; | 43 const OutputCB& output_cb) override; |
43 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 44 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
44 const DecodeCB& decode_cb) override; | 45 const DecodeCB& decode_cb) override; |
45 void Reset(const base::Closure& closure) override; | 46 void Reset(const base::Closure& closure) override; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void ProcessDecodedFrames(const Decryptor::AudioFrames& frames); | 90 void ProcessDecodedFrames(const Decryptor::AudioFrames& frames); |
90 | 91 |
91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 92 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
92 | 93 |
93 State state_; | 94 State state_; |
94 | 95 |
95 PipelineStatusCB init_cb_; | 96 PipelineStatusCB init_cb_; |
96 OutputCB output_cb_; | 97 OutputCB output_cb_; |
97 DecodeCB decode_cb_; | 98 DecodeCB decode_cb_; |
98 base::Closure reset_cb_; | 99 base::Closure reset_cb_; |
| 100 base::Closure waiting_for_decryption_key_cb_; |
99 | 101 |
100 // The current decoder configuration. | 102 // The current decoder configuration. |
101 AudioDecoderConfig config_; | 103 AudioDecoderConfig config_; |
102 | 104 |
103 // Callback to request/cancel decryptor creation notification. | 105 // Callback to request/cancel decryptor creation notification. |
104 SetDecryptorReadyCB set_decryptor_ready_cb_; | 106 SetDecryptorReadyCB set_decryptor_ready_cb_; |
105 | 107 |
106 Decryptor* decryptor_; | 108 Decryptor* decryptor_; |
107 | 109 |
108 // The buffer that needs decrypting/decoding. | 110 // The buffer that needs decrypting/decoding. |
(...skipping 10 matching lines...) Expand all Loading... |
119 | 121 |
120 base::WeakPtr<DecryptingAudioDecoder> weak_this_; | 122 base::WeakPtr<DecryptingAudioDecoder> weak_this_; |
121 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; | 123 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; |
122 | 124 |
123 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); | 125 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); |
124 }; | 126 }; |
125 | 127 |
126 } // namespace media | 128 } // namespace media |
127 | 129 |
128 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ | 130 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ |
OLD | NEW |