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 MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_AUDIO_DECODER_H_ |
6 #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_AUDIO_DECODER_H_ | 6 #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_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 "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h" | 14 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h" |
| 15 #include "media/ffmpeg/ffmpeg_deleters.h" |
15 | 16 |
16 struct AVCodecContext; | 17 struct AVCodecContext; |
17 struct AVFrame; | 18 struct AVFrame; |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 class AudioBus; | 21 class AudioBus; |
21 class AudioTimestampHelper; | 22 class AudioTimestampHelper; |
22 class ScopedPtrAVFreeContext; | |
23 class ScopedPtrAVFreeFrame; | |
24 } | 23 } |
25 | 24 |
26 namespace media { | 25 namespace media { |
27 // TODO(xhwang): This class is partially cloned from FFmpegAudioDecoder. When | 26 // TODO(xhwang): This class is partially cloned from FFmpegAudioDecoder. When |
28 // FFmpegAudioDecoder is updated, it's a pain to keep this class in sync with | 27 // FFmpegAudioDecoder is updated, it's a pain to keep this class in sync with |
29 // FFmpegAudioDecoder. We need a long term sustainable solution for this. See | 28 // FFmpegAudioDecoder. We need a long term sustainable solution for this. See |
30 // http://crbug.com/169203 | 29 // http://crbug.com/169203 |
31 class FFmpegCdmAudioDecoder { | 30 class FFmpegCdmAudioDecoder { |
32 public: | 31 public: |
33 explicit FFmpegCdmAudioDecoder(ClearKeyCdmHost* host); | 32 explicit FFmpegCdmAudioDecoder(ClearKeyCdmHost* host); |
(...skipping 23 matching lines...) Expand all Loading... |
57 | 56 |
58 base::TimeDelta GetNextOutputTimestamp() const; | 57 base::TimeDelta GetNextOutputTimestamp() const; |
59 | 58 |
60 void SerializeInt64(int64_t value); | 59 void SerializeInt64(int64_t value); |
61 | 60 |
62 bool is_initialized_; | 61 bool is_initialized_; |
63 | 62 |
64 ClearKeyCdmHost* const host_; | 63 ClearKeyCdmHost* const host_; |
65 | 64 |
66 // FFmpeg structures owned by this object. | 65 // FFmpeg structures owned by this object. |
67 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 66 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
68 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 67 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
69 | 68 |
70 // Audio format. | 69 // Audio format. |
71 int samples_per_second_; | 70 int samples_per_second_; |
72 int channels_; | 71 int channels_; |
73 | 72 |
74 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 73 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
75 int av_sample_format_; | 74 int av_sample_format_; |
76 | 75 |
77 // Used for computing output timestamps. | 76 // Used for computing output timestamps. |
78 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; | 77 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; |
79 int bytes_per_frame_; | 78 int bytes_per_frame_; |
80 base::TimeDelta last_input_timestamp_; | 79 base::TimeDelta last_input_timestamp_; |
81 | 80 |
82 // Number of output sample bytes to drop before generating output buffers. | 81 // Number of output sample bytes to drop before generating output buffers. |
83 // This is required for handling negative timestamps when decoding Vorbis | 82 // This is required for handling negative timestamps when decoding Vorbis |
84 // audio, for example. | 83 // audio, for example. |
85 int output_bytes_to_drop_; | 84 int output_bytes_to_drop_; |
86 | 85 |
87 typedef std::vector<uint8_t> SerializedAudioFrames; | 86 typedef std::vector<uint8_t> SerializedAudioFrames; |
88 SerializedAudioFrames serialized_audio_frames_; | 87 SerializedAudioFrames serialized_audio_frames_; |
89 | 88 |
90 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); | 89 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); |
91 }; | 90 }; |
92 | 91 |
93 } // namespace media | 92 } // namespace media |
94 | 93 |
95 #endif // MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_AUDIO_DECODER_H_ | 94 #endif // MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_FFMPEG_CDM_AUDIO_DECODER_H_ |
OLD | NEW |