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 WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ | 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ | 6 #define WEBKIT_MEDIA_CRYPTO_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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 namespace webkit_media { | 24 namespace webkit_media { |
25 | 25 |
26 // TODO(xhwang): This class is partially cloned from media::FFmpegAudioDecoder. | 26 // TODO(xhwang): This class is partially cloned from media::FFmpegAudioDecoder. |
27 // When media::FFmpegAudioDecoder is updated, it's a pain to keep this class | 27 // When media::FFmpegAudioDecoder is updated, it's a pain to keep this class |
28 // in sync with media::FFmpegAudioDecoder. We need a long term sustainable | 28 // in sync with media::FFmpegAudioDecoder. We need a long term sustainable |
29 // solution for this. See http://crbug.com/169203 | 29 // solution for this. See http://crbug.com/169203 |
30 class FFmpegCdmAudioDecoder { | 30 class FFmpegCdmAudioDecoder { |
31 public: | 31 public: |
32 explicit FFmpegCdmAudioDecoder(cdm::Allocator* allocator); | 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); |
40 | 40 |
41 // Decodes |compressed_buffer|. Returns |cdm::kSuccess| after storing | 41 // Decodes |compressed_buffer|. Returns |cdm::kSuccess| after storing |
42 // output in |decoded_frames| when output is available. Returns | 42 // output in |decoded_frames| when output is available. Returns |
(...skipping 10 matching lines...) Expand all Loading... |
53 private: | 53 private: |
54 void ResetTimestampState(); | 54 void ResetTimestampState(); |
55 void ReleaseFFmpegResources(); | 55 void ReleaseFFmpegResources(); |
56 | 56 |
57 base::TimeDelta GetNextOutputTimestamp() const; | 57 base::TimeDelta GetNextOutputTimestamp() const; |
58 | 58 |
59 void SerializeInt64(int64_t value); | 59 void SerializeInt64(int64_t value); |
60 | 60 |
61 bool is_initialized_; | 61 bool is_initialized_; |
62 | 62 |
63 cdm::Allocator* const allocator_; | 63 cdm::Host* const host_; |
64 | 64 |
65 // FFmpeg structures owned by this object. | 65 // FFmpeg structures owned by this object. |
66 AVCodecContext* codec_context_; | 66 AVCodecContext* codec_context_; |
67 AVFrame* av_frame_; | 67 AVFrame* av_frame_; |
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 | 72 |
73 // Used for computing output timestamps. | 73 // Used for computing output timestamps. |
(...skipping 12 matching lines...) Expand all Loading... |
86 | 86 |
87 typedef std::vector<uint8_t> SerializedAudioFrames; | 87 typedef std::vector<uint8_t> SerializedAudioFrames; |
88 SerializedAudioFrames serialized_audio_frames_; | 88 SerializedAudioFrames serialized_audio_frames_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); | 90 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace webkit_media | 93 } // namespace webkit_media |
94 | 94 |
95 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ | 95 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |
OLD | NEW |