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

Side by Side Diff: media/base/audio_decoder_config.h

Issue 11280301: Roll FFMpeg for M26. Fix ffmpeg float audio decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix AFR. Created 8 years 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 | « no previous file | media/base/audio_decoder_config.cc » ('j') | media/base/audio_decoder_config.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_BASE_AUDIO_DECODER_CONFIG_H_ 5 #ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ 6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/channel_layout.h" 10 #include "media/base/channel_layout.h"
(...skipping 20 matching lines...) Expand all
31 kCodecPCM_S16BE, 31 kCodecPCM_S16BE,
32 kCodecPCM_S24BE, 32 kCodecPCM_S24BE,
33 // DO NOT ADD RANDOM AUDIO CODECS! 33 // DO NOT ADD RANDOM AUDIO CODECS!
34 // 34 //
35 // The only acceptable time to add a new codec is if there is production code 35 // The only acceptable time to add a new codec is if there is production code
36 // that uses said codec in the same CL. 36 // that uses said codec in the same CL.
37 37
38 kAudioCodecMax = kCodecPCM_S24BE // Must equal the last "real" codec above. 38 kAudioCodecMax = kCodecPCM_S24BE // Must equal the last "real" codec above.
39 }; 39 };
40 40
41 enum SampleFormat {
42 kUnknownSampleFormat = 0,
43 kSampleFormatU8, // Unsigned 8-bit w/ bias of 128.
44 kSampleFormatS16, // Signed 16-bit.
45 kSampleFormatS32, // Signed 32-bit.
46 kSampleFormatFLT, // Float.
scherkus (not reviewing) 2012/12/06 17:25:32 perhaps instead of "FLT" we go with "F32" to denot
DaleCurtis 2012/12/11 03:03:44 Went with F32 an PlanarF32.
47 kSampleFormatFLTP, // Float planar.
48 };
49
41 // TODO(dalecurtis): FFmpeg API uses |bytes_per_channel| instead of 50 // TODO(dalecurtis): FFmpeg API uses |bytes_per_channel| instead of
42 // |bits_per_channel|, we should switch over since bits are generally confusing 51 // |bits_per_channel|, we should switch over since bits are generally confusing
43 // to work with. 52 // to work with.
44 class MEDIA_EXPORT AudioDecoderConfig { 53 class MEDIA_EXPORT AudioDecoderConfig {
45 public: 54 public:
46 // Constructs an uninitialized object. Clients should call Initialize() with 55 // Constructs an uninitialized object. Clients should call Initialize() with
47 // appropriate values before using. 56 // appropriate values before using.
48 AudioDecoderConfig(); 57 AudioDecoderConfig();
49 58
50 // Constructs an initialized object. It is acceptable to pass in NULL for 59 // Constructs an initialized object. It is acceptable to pass in NULL for
51 // |extra_data|, otherwise the memory is copied. 60 // |extra_data|, otherwise the memory is copied.
52 AudioDecoderConfig(AudioCodec codec, int bits_per_channel, 61 AudioDecoderConfig(AudioCodec codec, int bits_per_channel,
scherkus (not reviewing) 2012/12/06 17:25:32 is bits_per_channel still worth carrying around if
DaleCurtis 2012/12/06 22:15:41 Good point, I think it's better to remove bits per
DaleCurtis 2012/12/11 03:03:44 Done.
53 ChannelLayout channel_layout, int samples_per_second, 62 ChannelLayout channel_layout, int samples_per_second,
54 const uint8* extra_data, size_t extra_data_size, 63 const uint8* extra_data, size_t extra_data_size,
55 bool is_encrypted); 64 SampleFormat sample_format, bool is_encrypted);
56 65
57 ~AudioDecoderConfig(); 66 ~AudioDecoderConfig();
58 67
59 // Resets the internal state of this object. 68 // Resets the internal state of this object.
60 void Initialize(AudioCodec codec, int bits_per_channel, 69 void Initialize(AudioCodec codec, int bits_per_channel,
61 ChannelLayout channel_layout, int samples_per_second, 70 ChannelLayout channel_layout, int samples_per_second,
62 const uint8* extra_data, size_t extra_data_size, 71 const uint8* extra_data, size_t extra_data_size,
63 bool is_encrypted, 72 SampleFormat sample_format, bool is_encrypted,
64 bool record_stats); 73 bool record_stats);
65 74
66 // Deep copies |audio_config|. 75 // Deep copies |audio_config|.
67 void CopyFrom(const AudioDecoderConfig& audio_config); 76 void CopyFrom(const AudioDecoderConfig& audio_config);
68 77
69 // Returns true if this object has appropriate configuration values, false 78 // Returns true if this object has appropriate configuration values, false
70 // otherwise. 79 // otherwise.
71 bool IsValidConfig() const; 80 bool IsValidConfig() const;
72 81
73 // Returns true if all fields in |config| match this config. 82 // Returns true if all fields in |config| match this config.
74 // Note: The contents of |extra_data_| are compared not the raw pointers. 83 // Note: The contents of |extra_data_| are compared not the raw pointers.
75 bool Matches(const AudioDecoderConfig& config) const; 84 bool Matches(const AudioDecoderConfig& config) const;
76 85
77 AudioCodec codec() const; 86 AudioCodec codec() const { return codec_; }
78 int bits_per_channel() const; 87 int bits_per_channel() const { return bits_per_channel_; }
79 ChannelLayout channel_layout() const; 88 ChannelLayout channel_layout() const { return channel_layout_; }
80 int samples_per_second() const; 89 int samples_per_second() const { return samples_per_second_; }
90 SampleFormat sample_format() const { return sample_format_; }
81 91
82 // Optional byte data required to initialize audio decoders such as Vorbis 92 // Optional byte data required to initialize audio decoders such as Vorbis
83 // codebooks. 93 // codebooks.
84 uint8* extra_data() const; 94 uint8* extra_data() const { return extra_data_.get(); }
85 size_t extra_data_size() const; 95 size_t extra_data_size() const { return extra_data_size_; }
86 96
87 // Whether the audio stream is potentially encrypted. 97 // Whether the audio stream is potentially encrypted.
88 // Note that in a potentially encrypted audio stream, individual buffers 98 // Note that in a potentially encrypted audio stream, individual buffers
89 // can be encrypted or not encrypted. 99 // can be encrypted or not encrypted.
90 bool is_encrypted() const; 100 bool is_encrypted() const { return is_encrypted_; }
91 101
92 private: 102 private:
93 AudioCodec codec_; 103 AudioCodec codec_;
94 int bits_per_channel_; 104 int bits_per_channel_;
95 ChannelLayout channel_layout_; 105 ChannelLayout channel_layout_;
96 int samples_per_second_; 106 int samples_per_second_;
97 107
98 scoped_array<uint8> extra_data_; 108 scoped_array<uint8> extra_data_;
99 size_t extra_data_size_; 109 size_t extra_data_size_;
100 110
101 bool is_encrypted_; 111 bool is_encrypted_;
112 SampleFormat sample_format_;
102 113
103 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig); 114 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig);
104 }; 115 };
105 116
106 } // namespace media 117 } // namespace media
107 118
108 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ 119 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/audio_decoder_config.cc » ('j') | media/base/audio_decoder_config.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698