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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class MediaLog; | 29 class MediaLog; |
30 | 30 |
31 // Decryptor-based AudioDecoder implementation that can decrypt and decode | 31 // Decryptor-based AudioDecoder implementation that can decrypt and decode |
32 // encrypted audio buffers and return decrypted and decompressed audio frames. | 32 // encrypted audio buffers and return decrypted and decompressed audio frames. |
33 // All public APIs and callbacks are trampolined to the |task_runner_| so | 33 // All public APIs and callbacks are trampolined to the |task_runner_| so |
34 // that no locks are required for thread safety. | 34 // that no locks are required for thread safety. |
35 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { | 35 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { |
36 public: | 36 public: |
37 DecryptingAudioDecoder( | 37 DecryptingAudioDecoder( |
38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
39 const scoped_refptr<MediaLog>& media_log, | 39 MediaLog* media_log, |
40 const base::Closure& waiting_for_decryption_key_cb); | 40 const base::Closure& waiting_for_decryption_key_cb); |
41 ~DecryptingAudioDecoder() override; | 41 ~DecryptingAudioDecoder() override; |
42 | 42 |
43 // AudioDecoder implementation. | 43 // AudioDecoder implementation. |
44 std::string GetDisplayName() const override; | 44 std::string GetDisplayName() const override; |
45 void Initialize(const AudioDecoderConfig& config, | 45 void Initialize(const AudioDecoderConfig& config, |
46 CdmContext* cdm_context, | 46 CdmContext* cdm_context, |
47 const InitCB& init_cb, | 47 const InitCB& init_cb, |
48 const OutputCB& output_cb) override; | 48 const OutputCB& output_cb) override; |
49 void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 49 void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void OnKeyAdded(); | 83 void OnKeyAdded(); |
84 | 84 |
85 // Resets decoder and calls |reset_cb_|. | 85 // Resets decoder and calls |reset_cb_|. |
86 void DoReset(); | 86 void DoReset(); |
87 | 87 |
88 // Sets timestamps for |frames| and then passes them to |output_cb_|. | 88 // Sets timestamps for |frames| and then passes them to |output_cb_|. |
89 void ProcessDecodedFrames(const Decryptor::AudioFrames& frames); | 89 void ProcessDecodedFrames(const Decryptor::AudioFrames& frames); |
90 | 90 |
91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
92 | 92 |
93 scoped_refptr<MediaLog> media_log_; | 93 MediaLog* media_log_; |
94 | 94 |
95 State state_; | 95 State state_; |
96 | 96 |
97 InitCB init_cb_; | 97 InitCB init_cb_; |
98 OutputCB output_cb_; | 98 OutputCB output_cb_; |
99 DecodeCB decode_cb_; | 99 DecodeCB decode_cb_; |
100 base::Closure reset_cb_; | 100 base::Closure reset_cb_; |
101 base::Closure waiting_for_decryption_key_cb_; | 101 base::Closure waiting_for_decryption_key_cb_; |
102 | 102 |
103 // The current decoder configuration. | 103 // The current decoder configuration. |
(...skipping 15 matching lines...) Expand all Loading... |
119 | 119 |
120 base::WeakPtr<DecryptingAudioDecoder> weak_this_; | 120 base::WeakPtr<DecryptingAudioDecoder> weak_this_; |
121 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; | 121 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); | 123 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace media | 126 } // namespace media |
127 | 127 |
128 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ | 128 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ |
OLD | NEW |