Bug 1343152 - Move TrackTypeToStr(TrackInfo::TrackType) to MediaInfo.h/cpp - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 27 Feb 2017 17:15:36 +1100
changeset 490356 b50bef02ee7e2b45ca8b3ec96568ed236d9fce96
parent 490295 e1135c6fdc9bcd80d38f7285b269e030716dcb72
child 490360 0ea5d9e473a7ddfacc1d2ff4bc3f4de554740d31
push id47068
push usergsquelart@mozilla.com
push dateTue, 28 Feb 2017 05:08:49 +0000
reviewersjya
bugs1343152
milestone54.0a1
Bug 1343152 - Move TrackTypeToStr(TrackInfo::TrackType) to MediaInfo.h/cpp - r?jya MozReview-Commit-ID: 57U5ySHsIn1
dom/media/MediaFormatReader.cpp
dom/media/MediaInfo.cpp
dom/media/MediaInfo.h
--- 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,