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

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

Issue 2752323002: Support Opus Ambisonics playback (Closed)
Patch Set: +pipeline integration tests, +test media, minor fixes Created 3 years, 8 months 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 bool IsValidConfig() const; 56 bool IsValidConfig() const;
57 57
58 // Returns true if all fields in |config| match this config. 58 // Returns true if all fields in |config| match this config.
59 // Note: The contents of |extra_data_| are compared not the raw pointers. 59 // Note: The contents of |extra_data_| are compared not the raw pointers.
60 bool Matches(const AudioDecoderConfig& config) const; 60 bool Matches(const AudioDecoderConfig& config) const;
61 61
62 // Returns a human-readable string describing |*this|. For debugging & test 62 // Returns a human-readable string describing |*this|. For debugging & test
63 // output only. 63 // output only.
64 std::string AsHumanReadableString() const; 64 std::string AsHumanReadableString() const;
65 65
66 void SetChannelsForDiscrete(int channels) {
67 DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE ||
68 channels == ChannelLayoutToChannelCount(channel_layout_));
69 channels_ = channels;
70 bytes_per_frame_ = channels_ * bytes_per_channel_;
71 }
72
66 AudioCodec codec() const { return codec_; } 73 AudioCodec codec() const { return codec_; }
67 int bits_per_channel() const { return bytes_per_channel_ * 8; } 74 int bits_per_channel() const { return bytes_per_channel_ * 8; }
68 int bytes_per_channel() const { return bytes_per_channel_; } 75 int bytes_per_channel() const { return bytes_per_channel_; }
69 ChannelLayout channel_layout() const { return channel_layout_; } 76 ChannelLayout channel_layout() const { return channel_layout_; }
77 int channels() const { return channels_; }
70 int samples_per_second() const { return samples_per_second_; } 78 int samples_per_second() const { return samples_per_second_; }
71 SampleFormat sample_format() const { return sample_format_; } 79 SampleFormat sample_format() const { return sample_format_; }
72 int bytes_per_frame() const { return bytes_per_frame_; } 80 int bytes_per_frame() const { return bytes_per_frame_; }
73 base::TimeDelta seek_preroll() const { return seek_preroll_; } 81 base::TimeDelta seek_preroll() const { return seek_preroll_; }
74 int codec_delay() const { return codec_delay_; } 82 int codec_delay() const { return codec_delay_; }
75 83
76 // Optional byte data required to initialize audio decoders such as Vorbis 84 // Optional byte data required to initialize audio decoders such as Vorbis
77 // codebooks. 85 // codebooks.
78 const std::vector<uint8_t>& extra_data() const { return extra_data_; } 86 const std::vector<uint8_t>& extra_data() const { return extra_data_; }
79 87
(...skipping 11 matching lines...) Expand all
91 // useful for decryptors that decrypts an encrypted stream to a clear stream, 99 // useful for decryptors that decrypts an encrypted stream to a clear stream,
92 // or for decoder selectors that wants to select decrypting decoders instead 100 // or for decoder selectors that wants to select decrypting decoders instead
93 // of clear decoders. 101 // of clear decoders.
94 void SetIsEncrypted(bool is_encrypted); 102 void SetIsEncrypted(bool is_encrypted);
95 103
96 private: 104 private:
97 AudioCodec codec_; 105 AudioCodec codec_;
98 SampleFormat sample_format_; 106 SampleFormat sample_format_;
99 int bytes_per_channel_; 107 int bytes_per_channel_;
100 ChannelLayout channel_layout_; 108 ChannelLayout channel_layout_;
109 int channels_;
101 int samples_per_second_; 110 int samples_per_second_;
102 int bytes_per_frame_; 111 int bytes_per_frame_;
103 std::vector<uint8_t> extra_data_; 112 std::vector<uint8_t> extra_data_;
104 EncryptionScheme encryption_scheme_; 113 EncryptionScheme encryption_scheme_;
105 114
106 // |seek_preroll_| is the duration of the data that the decoder must decode 115 // |seek_preroll_| is the duration of the data that the decoder must decode
107 // before the decoded data is valid. 116 // before the decoded data is valid.
108 base::TimeDelta seek_preroll_; 117 base::TimeDelta seek_preroll_;
109 118
110 // |codec_delay_| is the number of frames the decoder should discard before 119 // |codec_delay_| is the number of frames the decoder should discard before
111 // returning decoded data. This value can include both decoder delay as well 120 // returning decoded data. This value can include both decoder delay as well
112 // as padding added during encoding. 121 // as padding added during encoding.
113 int codec_delay_; 122 int codec_delay_;
114 123
115 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler 124 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
116 // generated copy constructor and assignment operator. Since the extra data is 125 // generated copy constructor and assignment operator. Since the extra data is
117 // typically small, the performance impact is minimal. 126 // typically small, the performance impact is minimal.
118 }; 127 };
119 128
120 } // namespace media 129 } // namespace media
121 130
122 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ 131 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698