OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 WEBKIT_RENDERER_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_CDM_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |
6 #define WEBKIT_RENDERER_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ | 6 #define MEDIA_CDM_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "webkit/renderer/media/crypto/ppapi/cdm/content_decryption_module.h" | 14 #include "media/cdm/ppapi/api/content_decryption_module.h" |
15 | 15 |
16 struct AVCodecContext; | 16 struct AVCodecContext; |
17 struct AVFrame; | 17 struct AVFrame; |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 class AudioBus; | 20 class AudioBus; |
21 class AudioTimestampHelper; | 21 class AudioTimestampHelper; |
22 } | 22 } |
23 | 23 |
24 namespace webkit_media { | 24 namespace media { |
25 | 25 |
26 // TODO(xhwang): This class is partially cloned from media::FFmpegAudioDecoder. | 26 // TODO(xhwang): This class is partially cloned from FFmpegAudioDecoder. When |
27 // When media::FFmpegAudioDecoder is updated, it's a pain to keep this class | 27 // FFmpegAudioDecoder is updated, it's a pain to keep this class in sync with |
28 // in sync with media::FFmpegAudioDecoder. We need a long term sustainable | 28 // FFmpegAudioDecoder. We need a long term sustainable solution for this. See |
29 // solution for this. See http://crbug.com/169203 | 29 // http://crbug.com/169203 |
30 class FFmpegCdmAudioDecoder { | 30 class FFmpegCdmAudioDecoder { |
31 public: | 31 public: |
32 explicit FFmpegCdmAudioDecoder(cdm::Host* host); | 32 explicit FFmpegCdmAudioDecoder(cdm::Host* host); |
33 ~FFmpegCdmAudioDecoder(); | 33 ~FFmpegCdmAudioDecoder(); |
34 bool Initialize(const cdm::AudioDecoderConfig& config); | 34 bool Initialize(const cdm::AudioDecoderConfig& config); |
35 void Deinitialize(); | 35 void Deinitialize(); |
36 void Reset(); | 36 void Reset(); |
37 | 37 |
38 // Returns true when |config| is a valid audio decoder configuration. | 38 // Returns true when |config| is a valid audio decoder configuration. |
39 static bool IsValidConfig(const cdm::AudioDecoderConfig& config); | 39 static bool IsValidConfig(const cdm::AudioDecoderConfig& config); |
(...skipping 28 matching lines...) Expand all Loading... |
68 | 68 |
69 // Audio format. | 69 // Audio format. |
70 int bits_per_channel_; | 70 int bits_per_channel_; |
71 int samples_per_second_; | 71 int samples_per_second_; |
72 int channels_; | 72 int channels_; |
73 | 73 |
74 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 74 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
75 int av_sample_format_; | 75 int av_sample_format_; |
76 | 76 |
77 // Used for computing output timestamps. | 77 // Used for computing output timestamps. |
78 scoped_ptr<media::AudioTimestampHelper> output_timestamp_helper_; | 78 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; |
79 int bytes_per_frame_; | 79 int bytes_per_frame_; |
80 base::TimeDelta last_input_timestamp_; | 80 base::TimeDelta last_input_timestamp_; |
81 | 81 |
82 // We may need to convert the audio data coming out of FFmpeg from planar | 82 // We may need to convert the audio data coming out of FFmpeg from planar |
83 // float to integer. | 83 // float to integer. |
84 scoped_ptr<media::AudioBus> converter_bus_; | 84 scoped_ptr<AudioBus> converter_bus_; |
85 | 85 |
86 // Number of output sample bytes to drop before generating output buffers. | 86 // Number of output sample bytes to drop before generating output buffers. |
87 // This is required for handling negative timestamps when decoding Vorbis | 87 // This is required for handling negative timestamps when decoding Vorbis |
88 // audio, for example. | 88 // audio, for example. |
89 int output_bytes_to_drop_; | 89 int output_bytes_to_drop_; |
90 | 90 |
91 typedef std::vector<uint8_t> SerializedAudioFrames; | 91 typedef std::vector<uint8_t> SerializedAudioFrames; |
92 SerializedAudioFrames serialized_audio_frames_; | 92 SerializedAudioFrames serialized_audio_frames_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); | 94 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace webkit_media | 97 } // namespace media |
98 | 98 |
99 #endif // WEBKIT_RENDERER_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ | 99 #endif // MEDIA_CDM_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |
OLD | NEW |