Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: media/cdm/ppapi/ffmpeg_cdm_audio_decoder.h

Issue 26956002: Plumb support for audio sample formats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cast. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/cdm/ppapi/clear_key_cdm.cc ('k') | media/cdm/ppapi/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_FFMPEG_CDM_AUDIO_DECODER_H_ 5 #ifndef MEDIA_CDM_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
6 #define MEDIA_CDM_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"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Decodes |compressed_buffer|. Returns |cdm::kSuccess| after storing 42 // Decodes |compressed_buffer|. Returns |cdm::kSuccess| after storing
43 // output in |decoded_frames| when output is available. Returns 43 // output in |decoded_frames| when output is available. Returns
44 // |cdm::kNeedMoreData| when |compressed_frame| does not produce output. 44 // |cdm::kNeedMoreData| when |compressed_frame| does not produce output.
45 // Returns |cdm::kDecodeError| when decoding fails. 45 // Returns |cdm::kDecodeError| when decoding fails.
46 // 46 //
47 // A null |compressed_buffer| will attempt to flush the decoder of any 47 // A null |compressed_buffer| will attempt to flush the decoder of any
48 // remaining frames. |compressed_buffer_size| and |timestamp| are ignored. 48 // remaining frames. |compressed_buffer_size| and |timestamp| are ignored.
49 cdm::Status DecodeBuffer(const uint8_t* compressed_buffer, 49 cdm::Status DecodeBuffer(const uint8_t* compressed_buffer,
50 int32_t compressed_buffer_size, 50 int32_t compressed_buffer_size,
51 int64_t timestamp, 51 int64_t timestamp,
52 cdm::AudioFrames_1* decoded_frames); 52 cdm::AudioFrames* decoded_frames);
53 53
54 private: 54 private:
55 void ResetTimestampState(); 55 void ResetTimestampState();
56 void ReleaseFFmpegResources(); 56 void ReleaseFFmpegResources();
57 57
58 base::TimeDelta GetNextOutputTimestamp() const; 58 base::TimeDelta GetNextOutputTimestamp() const;
59 59
60 void SerializeInt64(int64_t value); 60 void SerializeInt64(int64_t value);
61 61
62 bool is_initialized_; 62 bool is_initialized_;
63 63
64 cdm::Host* const host_; 64 cdm::Host* const host_;
65 65
66 // FFmpeg structures owned by this object. 66 // FFmpeg structures owned by this object.
67 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 67 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
68 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 68 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
69 69
70 // Audio format. 70 // Audio format.
71 int bits_per_channel_;
72 int samples_per_second_; 71 int samples_per_second_;
73 int channels_; 72 int channels_;
74 73
75 // AVSampleFormat initially requested; not Chrome's SampleFormat. 74 // AVSampleFormat initially requested; not Chrome's SampleFormat.
76 int av_sample_format_; 75 int av_sample_format_;
77 76
78 // Used for computing output timestamps. 77 // Used for computing output timestamps.
79 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; 78 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
80 int bytes_per_frame_; 79 int bytes_per_frame_;
81 base::TimeDelta last_input_timestamp_; 80 base::TimeDelta last_input_timestamp_;
82 81
83 // We may need to convert the audio data coming out of FFmpeg from planar
84 // float to integer.
85 scoped_ptr<AudioBus> converter_bus_;
86
87 // Number of output sample bytes to drop before generating output buffers. 82 // Number of output sample bytes to drop before generating output buffers.
88 // This is required for handling negative timestamps when decoding Vorbis 83 // This is required for handling negative timestamps when decoding Vorbis
89 // audio, for example. 84 // audio, for example.
90 int output_bytes_to_drop_; 85 int output_bytes_to_drop_;
91 86
92 typedef std::vector<uint8_t> SerializedAudioFrames; 87 typedef std::vector<uint8_t> SerializedAudioFrames;
93 SerializedAudioFrames serialized_audio_frames_; 88 SerializedAudioFrames serialized_audio_frames_;
94 89
95 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); 90 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder);
96 }; 91 };
97 92
98 } // namespace media 93 } // namespace media
99 94
100 #endif // MEDIA_CDM_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ 95 #endif // MEDIA_CDM_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/cdm/ppapi/clear_key_cdm.cc ('k') | media/cdm/ppapi/ffmpeg_cdm_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698