Bug 1395021 - Move TrackID definition from StreamTracks.h into TrackID.h. r?jwwang draft
authorChris Pearce <cpearce@mozilla.com>
Wed, 30 Aug 2017 15:24:54 +1200
changeset 655526 db0b7aba160f05974d6c7fecf0402bcba958aa4d
parent 655525 9c4671980235a644c7f092bc9f64cfd7df003949
child 655527 ac1fba9e31b91ac2aaf616e060bf31d261ad7dbc
push id76899
push userbmo:cpearce@mozilla.com
push dateWed, 30 Aug 2017 03:46:14 +0000
reviewersjwwang
bugs1395021
milestone57.0a1
Bug 1395021 - Move TrackID definition from StreamTracks.h into TrackID.h. r?jwwang This means that MediaInfo.h doesn't need to include StreamTracks.h, which pulls in MediaSegment.h and the MSG and a bunch of DOM bindings stuff. MozReview-Commit-ID: 6JSO1dxJq8k
dom/media/MediaInfo.h
dom/media/StreamTracks.h
dom/media/TrackID.h
dom/media/moz.build
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -8,17 +8,17 @@
 
 #include "mozilla/UniquePtr.h"
 #include "mozilla/RefPtr.h"
 #include "nsDataHashtable.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "ImageTypes.h"
 #include "MediaData.h"
-#include "StreamTracks.h" // for TrackID
+#include "TrackID.h" // for TrackID
 #include "TimeUnits.h"
 #include "mozilla/gfx/Point.h" // for gfx::IntSize
 #include "mozilla/gfx/Rect.h"  // for gfx::IntRect
 
 namespace mozilla {
 
 class AudioInfo;
 class VideoInfo;
--- a/dom/media/StreamTracks.h
+++ b/dom/media/StreamTracks.h
@@ -3,33 +3,20 @@
  * 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/. */
 
 #ifndef MOZILLA_STREAMTRACKS_H_
 #define MOZILLA_STREAMTRACKS_H_
 
 #include "MediaSegment.h"
 #include "nsAutoPtr.h"
+#include "TrackID.h"
 
 namespace mozilla {
 
-/**
- * Unique ID for track within a StreamTracks. Tracks from different
- * StreamTrackss may have the same ID; this matters when appending StreamTrackss,
- * since tracks with the same ID are matched. Only IDs greater than 0 are allowed.
- */
-typedef int32_t TrackID;
-const TrackID TRACK_NONE = 0;
-const TrackID TRACK_INVALID = -1;
-const TrackID TRACK_ANY = -2;
-
-inline bool IsTrackIDExplicit(const TrackID& aId) {
-  return aId > TRACK_NONE;
-}
-
 inline TrackTicks RateConvertTicksRoundDown(TrackRate aOutRate,
                                             TrackRate aInRate,
                                             TrackTicks aTicks)
 {
   NS_ASSERTION(0 < aOutRate && aOutRate <= TRACK_RATE_MAX, "Bad out rate");
   NS_ASSERTION(0 < aInRate && aInRate <= TRACK_RATE_MAX, "Bad in rate");
   NS_ASSERTION(0 <= aTicks && aTicks <= TRACK_TICKS_MAX, "Bad ticks");
   return (aTicks * aOutRate) / aInRate;
new file mode 100644
--- /dev/null
+++ b/dom/media/TrackID.h
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+ #ifndef MOZILLA_TRACK_ID_H_
+ #define MOZILLA_TRACK_ID_H_
+
+ namespace mozilla {
+
+ /**
+  * Unique ID for track within a StreamTracks. Tracks from different
+  * StreamTrackss may have the same ID; this matters when appending StreamTrackss,
+  * since tracks with the same ID are matched. Only IDs greater than 0 are allowed.
+  */
+ typedef int32_t TrackID;
+ const TrackID TRACK_NONE = 0;
+ const TrackID TRACK_INVALID = -1;
+ const TrackID TRACK_ANY = -2;
+
+ inline bool IsTrackIDExplicit(const TrackID& aId) {
+   return aId > TRACK_NONE;
+ }
+
+} // namespace mozilla
+
+#endif // MOZILLA_TRACK_ID_H_
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -142,16 +142,17 @@ EXPORTS += [
     'QueueObject.h',
     'SeekJob.h',
     'SeekTarget.h',
     'SelfRef.h',
     'SharedBuffer.h',
     'StreamTracks.h',
     'ThreadPoolCOMListener.h',
     'TimeUnits.h',
+    'TrackID.h',
     'TrackUnionStream.h',
     'VideoFrameContainer.h',
     'VideoLimits.h',
     'VideoSegment.h',
     'VideoUtils.h',
     'VorbisUtils.h',
     'XiphExtradata.h',
 ]