Index: chromecast/media/cma/public/audio_config.h |
diff --git a/chromecast/media/cma/public/audio_config.h b/chromecast/media/cma/public/audio_config.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..19d95e7b8f55d67eefa77968e017e486899c824d |
--- /dev/null |
+++ b/chromecast/media/cma/public/audio_config.h |
@@ -0,0 +1,182 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
gunsch
2015/04/13 23:46:20
update
erickung1
2015/04/15 22:13:18
Done. merge both VideoConfig/AudioConfig into sing
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROMECAST_MEDIA_CMA_PUBLIC_AUDIO_CONFIG_H_ |
gunsch
2015/04/13 23:46:20
move to chromecast/public/media/audio_config.h
erickung1
2015/04/15 22:13:18
Done.
|
+#define CHROMECAST_MEDIA_CMA_PUBLIC_AUDIO_CONFIG_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/time/time.h" |
+#include "media/base/channel_layout.h" |
+#include "media/base/media_export.h" |
+ |
+namespace chromecast { |
+namespace media { |
+ |
+class AudioConfig { |
lcwu1
2015/04/13 23:55:42
A high-level comment: I would prefer the cast audi
erickung1
2015/04/15 22:13:18
Done the first part, leave CMA interface refactori
|
+ public: |
+ // It maps to ::media::AudioCodec in src/media/base/audio_decoder_config.h |
+ enum Codec { |
+ kUnknownAudioCodec = 0, |
gunsch
2015/04/13 23:46:20
I'd rather stick with only the things that we have
erickung1
2015/04/15 22:13:18
Done.
|
+ kCodecAAC = 1, |
+ kCodecMP3 = 2, |
+ kCodecPCM = 3, |
+ kCodecVorbis = 4, |
+ kCodecFLAC = 5, |
+ kCodecAMR_NB = 6, |
+ kCodecAMR_WB = 7, |
+ kCodecPCM_MULAW = 8, |
+ kCodecGSM_MS = 9, |
+ kCodecPCM_S16BE = 10, |
+ kCodecPCM_S24BE = 11, |
+ kCodecOpus = 12, |
+ // kCodecEAC3 = 13, |
+ kCodecPCM_ALAW = 14, |
+ kCodecALAC = 15, |
+ kAudioCodecMax = kCodecALAC, |
+ }; |
+ |
+ // It maps to ::media::ChannelLayout in src/media/base/channel_layout.h |
+ enum ChannelLayout { |
+ CHANNEL_LAYOUT_NONE = 0, |
+ CHANNEL_LAYOUT_UNSUPPORTED = 1, |
+ // Front C |
+ CHANNEL_LAYOUT_MONO = 2, |
+ // Front L, Front R |
+ CHANNEL_LAYOUT_STEREO = 3, |
+ // Front L, Front R, Back C |
+ CHANNEL_LAYOUT_2_1 = 4, |
+ // Front L, Front R, Front C |
+ CHANNEL_LAYOUT_SURROUND = 5, |
+ // Front L, Front R, Front C, Back C |
+ CHANNEL_LAYOUT_4_0 = 6, |
+ // Front L, Front R, Side L, Side R |
+ CHANNEL_LAYOUT_2_2 = 7, |
+ // Front L, Front R, Back L, Back R |
+ CHANNEL_LAYOUT_QUAD = 8, |
+ // Front L, Front R, Front C, Side L, Side R |
+ CHANNEL_LAYOUT_5_0 = 9, |
+ // Front L, Front R, Front C, Side L, Side R, LFE |
+ CHANNEL_LAYOUT_5_1 = 10, |
+ // Front L, Front R, Front C, Back L, Back R |
+ CHANNEL_LAYOUT_5_0_BACK = 11, |
+ // Front L, Front R, Front C, Back L, Back R, LFE |
+ CHANNEL_LAYOUT_5_1_BACK = 12, |
+ // Front L, Front R, Front C, Side L, Side R, Back L, Back R |
+ CHANNEL_LAYOUT_7_0 = 13, |
+ // Front L, Front R, Front C, Side L, Side R, LFE, Back L, Back R |
+ CHANNEL_LAYOUT_7_1 = 14, |
+ // Front L, Front R, Front C, Side L, Side R, LFE, Front LofC, Front RofC |
+ CHANNEL_LAYOUT_7_1_WIDE = 15, |
+ // Stereo L, Stereo R |
+ CHANNEL_LAYOUT_STEREO_DOWNMIX = 16, |
+ // Stereo L, Stereo R, LFE |
+ CHANNEL_LAYOUT_2POINT1 = 17, |
+ // Stereo L, Stereo R, Front C, LFE |
+ CHANNEL_LAYOUT_3_1 = 18, |
+ // Stereo L, Stereo R, Front C, Rear C, LFE |
+ CHANNEL_LAYOUT_4_1 = 19, |
+ // Stereo L, Stereo R, Front C, Side L, Side R, Back C |
+ CHANNEL_LAYOUT_6_0 = 20, |
+ // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC |
+ CHANNEL_LAYOUT_6_0_FRONT = 21, |
+ // Stereo L, Stereo R, Side L, Side R, Front C, Rear C. |
+ CHANNEL_LAYOUT_HEXAGONAL = 22, |
+ // Stereo L, Stereo R, Side L, Side R, Front C, Rear Center, LFE |
+ CHANNEL_LAYOUT_6_1 = 23, |
+ // Stereo L, Stereo R, Back L, Back R, Front C, Rear Center, LFE |
+ CHANNEL_LAYOUT_6_1_BACK = 24, |
+ // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE |
+ CHANNEL_LAYOUT_6_1_FRONT = 25, |
+ // Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC |
+ CHANNEL_LAYOUT_7_0_FRONT = 26, |
+ // Front L, Front R, Front C, Back L, Back R, LFE, Front LofC, Front RofC |
+ CHANNEL_LAYOUT_7_1_WIDE_BACK = 27, |
+ // Front L, Front R, Front C, Side L, Side R, Rear C, Back L, Back R. |
+ CHANNEL_LAYOUT_OCTAGONAL = 28, |
+ // Channels are not explicitly mapped to speakers. |
+ CHANNEL_LAYOUT_DISCRETE = 29, |
+ // Front L, Front R, Front C. Front C contains the keyboard mic audio. This |
+ // layout is only intended for input for WebRTC. The Front C channel |
+ // is stripped away in the WebRTC audio input pipeline and never seen |
+ // outside of that. |
+ CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30, |
+ // Front L, Front R, Side L, Side R, LFE |
+ CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31, |
+ // Max value, must always equal the largest entry ever logged. |
+ CHANNEL_LAYOUT_MAX = CHANNEL_LAYOUT_4_1_QUAD_SIDE |
+ }; |
+ |
+ public: |
+ AudioConfig(); |
+ AudioConfig(Codec codec, |
+ ChannelLayout channel_layout, |
+ int channel_number, |
+ int bytes_per_channel, |
+ int samples_per_second, |
+ const uint8* extra_data, |
+ size_t extra_data_size, |
+ bool is_encrypted); |
+ ~AudioConfig(); |
+ |
+ void Initialize(Codec codec, |
gunsch
2015/04/13 23:46:20
I don't like all the copies of methods from media/
erickung1
2015/04/15 22:13:18
Done.
|
+ ChannelLayout channel_layout, |
+ int channel_number, |
+ int bytes_per_channel, |
+ int samples_per_second, |
+ const uint8* extra_data, |
+ size_t extra_data_size, |
+ bool is_encrypted); |
+ |
+ // Returns true if this object has appropriate configuration values, false |
+ // otherwise. |
+ bool IsValidConfig() const; |
+ |
+ // Returns true if all fields in |config| match this config. |
+ // Note: The contents of |extra_data_| are compared not the raw pointers. |
+ bool Matches(const AudioConfig& config) const; |
+ |
+ // Returns a human-readable string describing |*this|. For debugging & test |
+ // output only. |
+ std::string AsHumanReadableString() const; |
+ std::string GetHumanReadableCodecName() const; |
+ |
+ Codec codec() const { return codec_; } |
+ ChannelLayout channel_layout() const { return channel_layout_; } |
+ int channel_number() const { return channel_number_; } |
+ int bytes_per_channel() const { return bytes_per_channel_; } |
+ int samples_per_second() const { return samples_per_second_; } |
+ |
+ // Optional byte data required to initialize audio decoders such as Vorbis |
+ // codebooks. |
+ const uint8* extra_data() const { |
+ return extra_data_.empty() ? NULL : &extra_data_[0]; |
+ } |
+ size_t extra_data_size() const { return extra_data_.size(); } |
+ |
+ // Whether the audio stream is potentially encrypted. |
+ // Note that in a potentially encrypted audio stream, individual buffers |
+ // can be encrypted or not encrypted. |
+ bool is_encrypted() const { return is_encrypted_; } |
+ |
+ private: |
+ Codec codec_; |
+ int bytes_per_channel_; |
+ ChannelLayout channel_layout_; |
+ int channel_number_; |
+ int samples_per_second_; |
+ std::vector<uint8> extra_data_; |
+ bool is_encrypted_; |
+ |
+ // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler |
+ // generated copy constructor and assignment operator. Since the extra data is |
+ // typically small, the performance impact is minimal. |
+}; |
+ |
+} // namespace media |
+} // namespace chromecast |
+ |
+#endif // CHROMECAST_MEDIA_CMA_PUBLIC_AUDIO_CONFIG_H_ |