Bug 1343152 - Move TrackTypeToStr(TrackInfo::TrackType) to MediaInfo.h/cpp - r?jya
MozReview-Commit-ID: 57U5ySHsIn1
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -979,34 +979,16 @@ MediaFormatReader::DemuxerProxy::NotifyD
}
if (data->mVideoDemuxer) {
data->mVideoDemuxer->UpdateBuffered();
}
return NotifyDataArrivedPromise::CreateAndResolve(true, __func__);
});
}
-static const char*
-TrackTypeToStr(TrackInfo::TrackType aTrack)
-{
- MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack
- || aTrack == TrackInfo::kVideoTrack
- || aTrack == TrackInfo::kTextTrack);
- switch (aTrack) {
- case TrackInfo::kAudioTrack:
- return "Audio";
- case TrackInfo::kVideoTrack:
- return "Video";
- case TrackInfo::kTextTrack:
- return "Text";
- default:
- return "Unknown";
- }
-}
-
MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
MediaDataDemuxer* aDemuxer,
VideoFrameContainer* aVideoFrameContainer)
: MediaDecoderReader(aDecoder)
, mAudio(this, MediaData::AUDIO_DATA,
Preferences::GetUint("media.audio-max-decode-error", 3))
, mVideo(this, MediaData::VIDEO_DATA,
Preferences::GetUint("media.video-max-decode-error", 2))
--- a/dom/media/MediaInfo.cpp
+++ b/dom/media/MediaInfo.cpp
@@ -3,16 +3,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaInfo.h"
namespace mozilla {
+const char*
+TrackTypeToStr(TrackInfo::TrackType aTrack)
+{
+ MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack
+ || aTrack == TrackInfo::kVideoTrack
+ || aTrack == TrackInfo::kTextTrack);
+ switch (aTrack) {
+ case TrackInfo::kAudioTrack:
+ return "Audio";
+ case TrackInfo::kVideoTrack:
+ return "Video";
+ case TrackInfo::kTextTrack:
+ return "Text";
+ default:
+ return "Unknown";
+ }
+}
+
typedef AudioConfig::ChannelLayout ChannelLayout;
/**
* AudioConfig::ChannelLayout
*/
/*
SMPTE channel layout (also known as wave order)
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -173,16 +173,19 @@ protected:
mTags = aOther.mTags;
MOZ_COUNT_CTOR(TrackInfo);
}
private:
TrackType mType;
};
+// String version of track type. Don't use with kUndefinedTrack.
+const char* TrackTypeToStr(TrackInfo::TrackType aTrack);
+
// Stores info relevant to presenting media frames.
class VideoInfo : public TrackInfo
{
public:
enum Rotation
{
kDegree_0 = 0,
kDegree_90 = 90,