Bug 1431221 - P6. Add channel map information to AudioInfo. r=padenot
MozReview-Commit-ID: 2zOvciLFtAr
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -390,19 +390,21 @@ class AudioData : public MediaData
public:
AudioData(int64_t aOffset,
const media::TimeUnit& aTime,
const media::TimeUnit& aDuration,
uint32_t aFrames,
AlignedAudioBuffer&& aData,
uint32_t aChannels,
- uint32_t aRate)
+ uint32_t aRate,
+ uint32_t aChannelMap = AudioConfig::ChannelLayout::UNKNOWN_MAP)
: MediaData(sType, aOffset, aTime, aDuration, aFrames)
, mChannels(aChannels)
+ , mChannelMap(aChannelMap)
, mRate(aRate)
, mAudioData(Move(aData))
{
}
static const Type sType = AUDIO_DATA;
static const char* sTypeName;
@@ -420,16 +422,21 @@ public:
// If mAudioBuffer is null, creates it from mAudioData.
void EnsureAudioBuffer();
// To check whether mAudioData has audible signal, it's used to distinguish
// the audiable data and silent data.
bool IsAudible() const;
const uint32_t mChannels;
+ // The AudioConfig::ChannelLayout map. Channels are ordered as per SMPTE
+ // definition. A value of UNKNOWN_MAP indicates unknown layout.
+ // ChannelMap is an unsigned bitmap compatible with Windows' WAVE and FFmpeg
+ // channel map.
+ const AudioConfig::ChannelLayout::ChannelMap mChannelMap;
const uint32_t mRate;
// At least one of mAudioBuffer/mAudioData must be non-null.
// mChannels channels, each with mFrames frames
RefPtr<SharedBuffer> mAudioBuffer;
// mFrames frames, each with mChannels values
AlignedAudioBuffer mAudioData;
protected:
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -350,28 +350,30 @@ private:
class AudioInfo : public TrackInfo
{
public:
AudioInfo()
: TrackInfo(kAudioTrack, NS_LITERAL_STRING("1"), NS_LITERAL_STRING("main"),
EmptyString(), EmptyString(), true, 1)
, mRate(0)
, mChannels(0)
+ , mChannelMap(AudioConfig::ChannelLayout::UNKNOWN_MAP)
, mBitDepth(0)
, mProfile(0)
, mExtendedProfile(0)
, mCodecSpecificConfig(new MediaByteBuffer)
, mExtraData(new MediaByteBuffer)
{
}
AudioInfo(const AudioInfo& aOther)
: TrackInfo(aOther)
, mRate(aOther.mRate)
, mChannels(aOther.mChannels)
+ , mChannelMap(aOther.mChannelMap)
, mBitDepth(aOther.mBitDepth)
, mProfile(aOther.mProfile)
, mExtendedProfile(aOther.mExtendedProfile)
, mCodecSpecificConfig(aOther.mCodecSpecificConfig)
, mExtraData(aOther.mExtraData)
{
}
@@ -398,16 +400,21 @@ public:
return MakeUnique<AudioInfo>(*this);
}
// Sample rate.
uint32_t mRate;
// Number of audio channels.
uint32_t mChannels;
+ // The AudioConfig::ChannelLayout map. Channels are ordered as per SMPTE
+ // definition. A value of UNKNOWN_MAP indicates unknown layout.
+ // ChannelMap is an unsigned bitmap compatible with Windows' WAVE and FFmpeg
+ // channel map.
+ AudioConfig::ChannelLayout::ChannelMap mChannelMap;
// Bits per sample.
uint32_t mBitDepth;
// Codec profile.
int8_t mProfile;
// Extended codec profile.