Bug 1500596 - pt2 - Add operator== for AudioInfo and VideoInfo. r=jya

These are needed for upcoming addition to an IPDL union.

Depends on D18639

Differential Revision: https://phabricator.services.mozilla.com/D18640

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Froman 2019-02-14 19:08:19 +00:00
Родитель 3429848591
Коммит 51aa9729a2
2 изменённых файлов: 54 добавлений и 0 удалений

Просмотреть файл

@ -23,4 +23,50 @@ const char* TrackTypeToStr(TrackInfo::TrackType aTrack) {
}
}
bool TrackInfo::IsEqualTo(const TrackInfo& rhs) const {
return (mId == rhs.mId &&
mKind == rhs.mKind &&
mLabel == rhs.mLabel &&
mLanguage == rhs.mLanguage &&
mEnabled == rhs.mEnabled &&
mTrackId == rhs.mTrackId &&
mMimeType == rhs.mMimeType &&
mDuration == rhs.mDuration &&
mMediaTime == rhs.mMediaTime &&
mCrypto.mCryptoScheme == rhs.mCrypto.mCryptoScheme &&
mCrypto.mIVSize == rhs.mCrypto.mIVSize &&
mCrypto.mKeyId == rhs.mCrypto.mKeyId &&
mCrypto.mCryptByteBlock == rhs.mCrypto.mCryptByteBlock &&
mCrypto.mSkipByteBlock == rhs.mCrypto.mSkipByteBlock &&
mCrypto.mConstantIV == rhs.mCrypto.mConstantIV &&
mTags == rhs.mTags &&
mIsRenderedExternally == rhs.mIsRenderedExternally &&
mType == rhs.mType);
}
bool VideoInfo::operator==(const VideoInfo& rhs) const {
return (TrackInfo::IsEqualTo(rhs) &&
mDisplay == rhs.mDisplay &&
mStereoMode == rhs.mStereoMode &&
mImage == rhs.mImage &&
*mCodecSpecificConfig == *rhs.mCodecSpecificConfig &&
*mExtraData == *rhs.mExtraData &&
mRotation == rhs.mRotation &&
mColorDepth == rhs.mColorDepth &&
mImageRect == rhs.mImageRect &&
mAlphaPresent == rhs.mAlphaPresent);
}
bool AudioInfo::operator==(const AudioInfo& rhs) const {
return (TrackInfo::IsEqualTo(rhs) &&
mRate == rhs.mRate &&
mChannels == rhs.mChannels &&
mChannelMap == rhs.mChannelMap &&
mBitDepth == rhs.mBitDepth &&
mProfile == rhs.mProfile &&
mExtendedProfile == rhs.mExtendedProfile &&
*mCodecSpecificConfig == *rhs.mCodecSpecificConfig &&
*mExtraData == *rhs.mExtraData);
}
} // namespace mozilla

Просмотреть файл

@ -32,6 +32,9 @@ class MetadataTag {
: mKey(aKey), mValue(aValue) {}
nsCString mKey;
nsCString mValue;
bool operator==(const MetadataTag& rhs) const {
return mKey == rhs.mKey && mValue == rhs.mValue;
}
};
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
@ -119,6 +122,7 @@ class TrackInfo {
mTags = aOther.mTags;
MOZ_COUNT_CTOR(TrackInfo);
}
bool IsEqualTo(const TrackInfo& rhs) const;
private:
TrackType mType;
@ -165,6 +169,8 @@ class VideoInfo : public TrackInfo {
mImageRect(aOther.mImageRect),
mAlphaPresent(aOther.mAlphaPresent) {}
bool operator==(const VideoInfo& rhs) const;
bool IsValid() const override {
return mDisplay.width > 0 && mDisplay.height > 0;
}
@ -286,6 +292,8 @@ class AudioInfo : public TrackInfo {
mCodecSpecificConfig(aOther.mCodecSpecificConfig),
mExtraData(aOther.mExtraData) {}
bool operator==(const AudioInfo& rhs) const;
static const uint32_t MAX_RATE = 640000;
bool IsValid() const override {