1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
12 const char* TrackTypeToStr(TrackInfo::TrackType aTrack
) {
14 case TrackInfo::kUndefinedTrack
:
16 case TrackInfo::kAudioTrack
:
18 case TrackInfo::kVideoTrack
:
20 case TrackInfo::kTextTrack
:
27 bool TrackInfo::IsEqualTo(const TrackInfo
& rhs
) const {
29 mId
== rhs
.mId
&& mKind
== rhs
.mKind
&& mLabel
== rhs
.mLabel
&&
30 mLanguage
== rhs
.mLanguage
&& mEnabled
== rhs
.mEnabled
&&
31 mTrackId
== rhs
.mTrackId
&& mMimeType
== rhs
.mMimeType
&&
32 mDuration
== rhs
.mDuration
&& mMediaTime
== rhs
.mMediaTime
&&
33 mCrypto
.mCryptoScheme
== rhs
.mCrypto
.mCryptoScheme
&&
34 mCrypto
.mIVSize
== rhs
.mCrypto
.mIVSize
&&
35 mCrypto
.mKeyId
== rhs
.mCrypto
.mKeyId
&&
36 mCrypto
.mCryptByteBlock
== rhs
.mCrypto
.mCryptByteBlock
&&
37 mCrypto
.mSkipByteBlock
== rhs
.mCrypto
.mSkipByteBlock
&&
38 mCrypto
.mConstantIV
== rhs
.mCrypto
.mConstantIV
&& mTags
== rhs
.mTags
&&
39 mIsRenderedExternally
== rhs
.mIsRenderedExternally
&& mType
== rhs
.mType
);
42 nsCString
TrackInfo::ToString() const {
46 "TrackInfo: id:%s kind:%s label:%s language:%s enabled:%s trackid: %d "
47 "mimetype:%s duration:%s media time:%s crypto:%s rendered externaly: %s "
49 NS_ConvertUTF16toUTF8(mId
).get(), NS_ConvertUTF16toUTF8(mKind
).get(),
50 NS_ConvertUTF16toUTF8(mLabel
).get(),
51 NS_ConvertUTF16toUTF8(mLanguage
).get(), mEnabled
? "true" : "false",
52 mTrackId
, mMimeType
.get(), mDuration
.ToString().get(),
53 mMediaTime
.ToString().get(), CryptoSchemeToString(mCrypto
.mCryptoScheme
),
54 mIsRenderedExternally
? "true" : "false", TrackTypeToStr(mType
));
56 if (!mTags
.IsEmpty()) {
57 rv
.AppendPrintf("\n");
58 for (const auto& tag
: mTags
) {
59 rv
.AppendPrintf("%s:%s", tag
.mKey
.get(), tag
.mValue
.get());
66 bool VideoInfo::operator==(const VideoInfo
& rhs
) const {
67 return (TrackInfo::IsEqualTo(rhs
) && mDisplay
== rhs
.mDisplay
&&
68 mStereoMode
== rhs
.mStereoMode
&& mImage
== rhs
.mImage
&&
69 *mCodecSpecificConfig
== *rhs
.mCodecSpecificConfig
&&
70 *mExtraData
== *rhs
.mExtraData
&& mRotation
== rhs
.mRotation
&&
71 mColorDepth
== rhs
.mColorDepth
&& mImageRect
== rhs
.mImageRect
&&
72 mAlphaPresent
== rhs
.mAlphaPresent
);
75 bool AudioInfo::operator==(const AudioInfo
& rhs
) const {
76 return (TrackInfo::IsEqualTo(rhs
) && mRate
== rhs
.mRate
&&
77 mChannels
== rhs
.mChannels
&& mChannelMap
== rhs
.mChannelMap
&&
78 mBitDepth
== rhs
.mBitDepth
&& mProfile
== rhs
.mProfile
&&
79 mExtendedProfile
== rhs
.mExtendedProfile
&&
80 mCodecSpecificConfig
== rhs
.mCodecSpecificConfig
);
83 nsCString
AudioInfo::ToString() const {
87 "AudioInfo: %" PRIu32
"Hz, %" PRIu32
"ch (%s) %" PRIu32
88 "-bits profile: %" PRIu8
" extended profile: %" PRIu8
", %s extradata",
90 AudioConfig::ChannelLayout::ChannelMapToString(mChannelMap
).get(),
91 mBitDepth
, mProfile
, mExtendedProfile
,
92 mCodecSpecificConfig
.is
<NoCodecSpecificData
>() ? "no" : "with");
97 } // namespace mozilla