Bug 1153049: Part3. Using AudioInfo/VideoInfo object. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 14 Apr 2015 15:16:32 +1000
changeset 238951 d6e188e8872e86f3fa4b514631e4e3e31442674e
parent 238950 3e617cb207c5261e89a35d364753726b69d721cd
child 238952 8cde37caacefdc38a4929ce5fa5a7d7428477229
push id58375
push userjyavenard@mozilla.com
push dateTue, 14 Apr 2015 05:41:04 +0000
treeherdermozilla-inbound@65492fe83362 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1153049
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1153049: Part3. Using AudioInfo/VideoInfo object. r=cpearce This remove all remaining references to stagefright/MP4 specific objects.
dom/media/fmp4/BlankDecoderModule.cpp
dom/media/fmp4/MP4Reader.cpp
dom/media/fmp4/PlatformDecoderModule.cpp
dom/media/fmp4/PlatformDecoderModule.h
dom/media/fmp4/SharedDecoderManager.cpp
dom/media/fmp4/SharedDecoderManager.h
dom/media/fmp4/android/AndroidDecoderModule.cpp
dom/media/fmp4/android/AndroidDecoderModule.h
dom/media/fmp4/apple/AppleATDecoder.cpp
dom/media/fmp4/apple/AppleATDecoder.h
dom/media/fmp4/apple/AppleDecoderModule.cpp
dom/media/fmp4/apple/AppleDecoderModule.h
dom/media/fmp4/apple/AppleVDADecoder.cpp
dom/media/fmp4/apple/AppleVDADecoder.h
dom/media/fmp4/apple/AppleVTDecoder.cpp
dom/media/fmp4/apple/AppleVTDecoder.h
dom/media/fmp4/eme/EMEAudioDecoder.h
dom/media/fmp4/eme/EMEDecoderModule.cpp
dom/media/fmp4/eme/EMEDecoderModule.h
dom/media/fmp4/eme/EMEVideoDecoder.h
dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h
dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h
dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h
dom/media/fmp4/gmp/GMPAudioDecoder.cpp
dom/media/fmp4/gmp/GMPAudioDecoder.h
dom/media/fmp4/gmp/GMPDecoderModule.cpp
dom/media/fmp4/gmp/GMPDecoderModule.h
dom/media/fmp4/gmp/GMPVideoDecoder.cpp
dom/media/fmp4/gmp/GMPVideoDecoder.h
dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp
dom/media/fmp4/gonk/GonkAudioDecoderManager.h
dom/media/fmp4/gonk/GonkDecoderModule.cpp
dom/media/fmp4/gonk/GonkDecoderModule.h
dom/media/fmp4/gonk/GonkVideoDecoderManager.cpp
dom/media/fmp4/gonk/GonkVideoDecoderManager.h
dom/media/fmp4/wmf/WMFAudioMFTManager.cpp
dom/media/fmp4/wmf/WMFAudioMFTManager.h
dom/media/fmp4/wmf/WMFDecoderModule.cpp
dom/media/fmp4/wmf/WMFDecoderModule.h
dom/media/fmp4/wmf/WMFVideoMFTManager.cpp
dom/media/fmp4/wmf/WMFVideoMFTManager.h
dom/media/fmp4/wrappers/H264Converter.cpp
dom/media/fmp4/wrappers/H264Converter.h
dom/media/webm/IntelWebMVideoDecoder.cpp
dom/media/webm/IntelWebMVideoDecoder.h
media/libstagefright/binding/DecoderData.cpp
media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
media/libstagefright/binding/include/mp4_demuxer/mp4_demuxer.h
media/libstagefright/binding/mp4_demuxer.cpp
--- a/dom/media/fmp4/BlankDecoderModule.cpp
+++ b/dom/media/fmp4/BlankDecoderModule.cpp
@@ -6,17 +6,17 @@
 
 #include "MediaDecoderReader.h"
 #include "PlatformDecoderModule.h"
 #include "nsRect.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/CheckedInt.h"
 #include "VideoUtils.h"
 #include "ImageContainer.h"
-#include "mp4_demuxer/mp4_demuxer.h"
+#include "MediaInfo.h"
 #include "MediaTaskQueue.h"
 
 namespace mozilla {
 
 // Decoder that uses a passed in object's Create function to create blank
 // MediaData objects.
 template<class BlankMediaDataCreator>
 class BlankMediaDataDecoder : public MediaDataDecoder {
@@ -203,53 +203,53 @@ private:
   uint32_t mSampleRate;
 };
 
 class BlankDecoderModule : public PlatformDecoderModule {
 public:
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override {
     BlankVideoDataCreator* creator = new BlankVideoDataCreator(
-      aConfig.display_width, aConfig.display_height, aImageContainer);
+      aConfig.mDisplay.width, aConfig.mDisplay.height, aImageContainer);
     nsRefPtr<MediaDataDecoder> decoder =
       new BlankMediaDataDecoder<BlankVideoDataCreator>(creator,
                                                        aVideoTaskQueue,
                                                        aCallback);
     return decoder.forget();
   }
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override {
     BlankAudioDataCreator* creator = new BlankAudioDataCreator(
-      aConfig.channel_count, aConfig.samples_per_second);
+      aConfig.mChannels, aConfig.mRate);
 
     nsRefPtr<MediaDataDecoder> decoder =
       new BlankMediaDataDecoder<BlankAudioDataCreator>(creator,
                                                        aAudioTaskQueue,
                                                        aCallback);
     return decoder.forget();
   }
 
   virtual bool
   SupportsMimeType(const nsACString& aMimeType) override
   {
     return true;
   }
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override
   {
     return kNeedNone;
   }
 
 };
 
 already_AddRefed<PlatformDecoderModule> CreateBlankDecoderModule()
 {
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -391,31 +391,27 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo
     // need to reinit the demuxer.
     mDemuxerInitialized = true;
   } else if (mPlatform && !IsWaitingMediaResources()) {
     *aInfo = mInfo;
     *aTags = nullptr;
   }
 
   if (HasAudio()) {
-    const AudioDecoderConfig& audio = mDemuxer->AudioConfig();
-    mInfo.mAudio.mRate = audio.samples_per_second;
-    mInfo.mAudio.mChannels = audio.channel_count;
+    mInfo.mAudio = mDemuxer->AudioConfig();
     mAudio.mCallback = new DecoderCallback(this, kAudio);
   }
 
   if (HasVideo()) {
-    const VideoDecoderConfig& video = mDemuxer->VideoConfig();
-    mInfo.mVideo.mDisplay =
-      nsIntSize(video.display_width, video.display_height);
+    mInfo.mVideo = mDemuxer->VideoConfig();
     mVideo.mCallback = new DecoderCallback(this, kVideo);
 
     // Collect telemetry from h264 AVCC SPS.
     if (!mFoundSPSForTelemetry) {
-      mFoundSPSForTelemetry = AccumulateSPSTelemetry(video.extra_data);
+      mFoundSPSForTelemetry = AccumulateSPSTelemetry(mInfo.mVideo.mExtraData);
     }
   }
 
   if (mCrypto.valid) {
     nsTArray<uint8_t> initData;
     ExtractCryptoInitData(initData);
     if (initData.Length() == 0) {
       return NS_ERROR_FAILURE;
@@ -511,30 +507,30 @@ MP4Reader::EnsureDecodersSetup()
     // mPlatform doesn't need to be recreated when resuming from dormant.
     if (!mPlatform) {
       mPlatform = PlatformDecoderModule::Create();
       NS_ENSURE_TRUE(mPlatform, false);
     }
   }
 
   if (HasAudio()) {
-    NS_ENSURE_TRUE(IsSupportedAudioMimeType(mDemuxer->AudioConfig().mime_type),
+    NS_ENSURE_TRUE(IsSupportedAudioMimeType(mDemuxer->AudioConfig().mMimeType),
                    false);
 
     mAudio.mDecoder =
       mPlatform->CreateDecoder(mDemuxer->AudioConfig(),
                                mAudio.mTaskQueue,
                                mAudio.mCallback);
     NS_ENSURE_TRUE(mAudio.mDecoder != nullptr, false);
     nsresult rv = mAudio.mDecoder->Init();
     NS_ENSURE_SUCCESS(rv, false);
   }
 
   if (HasVideo()) {
-    NS_ENSURE_TRUE(IsSupportedVideoMimeType(mDemuxer->VideoConfig().mime_type),
+    NS_ENSURE_TRUE(IsSupportedVideoMimeType(mDemuxer->VideoConfig().mMimeType),
                    false);
 
     if (mSharedDecoderManager && mPlatform->SupportsSharedDecoders(mDemuxer->VideoConfig())) {
       mVideo.mDecoder =
         mSharedDecoderManager->CreateVideoDecoder(mPlatform,
                                                   mDemuxer->VideoConfig(),
                                                   mLayersBackendType,
                                                   mDecoder->GetImageContainer(),
@@ -601,17 +597,17 @@ MP4Reader::GetNextKeyframeTime()
 }
 
 void
 MP4Reader::DisableHardwareAcceleration()
 {
   if (HasVideo() && mSharedDecoderManager) {
     mSharedDecoderManager->DisableHardwareAcceleration();
 
-    const VideoDecoderConfig& video = mDemuxer->VideoConfig();
+    const VideoInfo& video = mDemuxer->VideoConfig();
     if (!mSharedDecoderManager->Recreate(video)) {
       MonitorAutoLock mon(mVideo.mMonitor);
       mVideo.mError = true;
       if (mVideo.HasPromise()) {
         mVideo.RejectPromise(DECODE_ERROR, __func__);
       }
     } else {
       MonitorAutoLock lock(mVideo.mMonitor);
--- a/dom/media/fmp4/PlatformDecoderModule.cpp
+++ b/dom/media/fmp4/PlatformDecoderModule.cpp
@@ -26,17 +26,17 @@
 #include "mozilla/Preferences.h"
 #ifdef MOZ_EME
 #include "EMEDecoderModule.h"
 #include "mozilla/CDMProxy.h"
 #endif
 #include "SharedThreadPool.h"
 #include "MediaTaskQueue.h"
 
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "H264Converter.h"
 
 namespace mozilla {
 
 extern already_AddRefed<PlatformDecoderModule> CreateBlankDecoderModule();
 
 bool PlatformDecoderModule::sUseBlankDecoder = false;
 bool PlatformDecoderModule::sFFmpegDecoderEnabled = false;
@@ -173,44 +173,44 @@ PlatformDecoderModule::CreatePDM()
   if (sGMPDecoderEnabled) {
     nsRefPtr<PlatformDecoderModule> m(new GMPDecoderModule());
     return m.forget();
   }
   return nullptr;
 }
 
 already_AddRefed<MediaDataDecoder>
-PlatformDecoderModule::CreateDecoder(const mp4_demuxer::TrackConfig& aConfig,
+PlatformDecoderModule::CreateDecoder(const TrackInfo& aConfig,
                                      FlushableMediaTaskQueue* aTaskQueue,
                                      MediaDataDecoderCallback* aCallback,
                                      layers::LayersBackend aLayersBackend,
                                      layers::ImageContainer* aImageContainer)
 {
   nsRefPtr<MediaDataDecoder> m;
 
-  if (aConfig.IsAudioConfig()) {
-    m = CreateAudioDecoder(static_cast<const mp4_demuxer::AudioDecoderConfig&>(aConfig),
+  if (aConfig.IsAudio()) {
+    m = CreateAudioDecoder(static_cast<const AudioInfo&>(aConfig),
                            aTaskQueue,
                            aCallback);
     return m.forget();
   }
 
-  if (!aConfig.IsVideoConfig()) {
+  if (!aConfig.IsVideo()) {
     return nullptr;
   }
 
   if (H264Converter::IsH264(aConfig)) {
     m = new H264Converter(this,
-                          static_cast<const mp4_demuxer::VideoDecoderConfig&>(aConfig),
+                          static_cast<const VideoInfo&>(aConfig),
                           aLayersBackend,
                           aImageContainer,
                           aTaskQueue,
                           aCallback);
   } else {
-    m = CreateVideoDecoder(static_cast<const mp4_demuxer::VideoDecoderConfig&>(aConfig),
+    m = CreateVideoDecoder(static_cast<const VideoInfo&>(aConfig),
                            aLayersBackend,
                            aImageContainer,
                            aTaskQueue,
                            aCallback);
   }
   return m.forget();
 }
 
--- a/dom/media/fmp4/PlatformDecoderModule.h
+++ b/dom/media/fmp4/PlatformDecoderModule.h
@@ -8,25 +8,22 @@
 #define PlatformDecoderModule_h_
 
 #include "MediaDecoderReader.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "nsTArray.h"
 #include "mozilla/RefPtr.h"
 #include <queue>
 
-namespace mp4_demuxer {
-class TrackConfig;
-class VideoDecoderConfig;
-class AudioDecoderConfig;
-}
-
 class nsIThreadPool;
 
 namespace mozilla {
+class TrackInfo;
+class AudioInfo;
+class VideoInfo;
 class MediaRawData;
 class DataBuffer;
 
 namespace layers {
 class ImageContainer;
 }
 
 class MediaDataDecoder;
@@ -86,17 +83,17 @@ public:
   CreateCDMWrapper(CDMProxy* aProxy,
                    bool aHasAudio,
                    bool aHasVideo);
 #endif
 
   // Creates a decoder.
   // See CreateVideoDecoder and CreateAudioDecoder for implementation details.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateDecoder(const mp4_demuxer::TrackConfig& aConfig,
+  CreateDecoder(const TrackInfo& aConfig,
                 FlushableMediaTaskQueue* aTaskQueue,
                 MediaDataDecoderCallback* aCallback,
                 layers::LayersBackend aLayersBackend = layers::LayersBackend::LAYERS_NONE,
                 layers::ImageContainer* aImageContainer = nullptr);
 
   // An audio decoder module must support AAC by default.
   // A video decoder must support H264 by default.
   // If more codecs are to be supported, SupportsMimeType will have
@@ -107,21 +104,21 @@ public:
     kNeedNone,
     kNeedAVCC,
     kNeedAnnexB,
   };
 
   // Indicates that the decoder requires a specific format.
   // The PlatformDecoderModule will convert the demuxed data accordingly before
   // feeding it to MediaDataDecoder::Input.
-  virtual ConversionRequired DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const = 0;
+  virtual ConversionRequired DecoderNeedsConversion(const TrackInfo& aConfig) const = 0;
 
   virtual void DisableHardwareAcceleration() {}
 
-  virtual bool SupportsSharedDecoders(const mp4_demuxer::VideoDecoderConfig& aConfig) const {
+  virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const {
     return true;
   }
 
 protected:
   PlatformDecoderModule() {}
   virtual ~PlatformDecoderModule() {}
 
   friend class H264Converter;
@@ -132,34 +129,34 @@ protected:
   // not hold a reference to it.
   // Output and errors should be returned to the reader via aCallback.
   // On Windows the task queue's threads in have MSCOM initialized with
   // COINIT_MULTITHREADED.
   // Returns nullptr if the decoder can't be created.
   // It is safe to store a reference to aConfig.
   // This is called on the decode task queue.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) = 0;
 
   // Creates an Audio decoder with the specified properties.
   // Asynchronous decoding of audio should be done in runnables dispatched to
   // aAudioTaskQueue. If the task queue isn't needed, the decoder should
   // not hold a reference to it.
   // Output and errors should be returned to the reader via aCallback.
   // Returns nullptr if the decoder can't be created.
   // On Windows the task queue's threads in have MSCOM initialized with
   // COINIT_MULTITHREADED.
   // It is safe to store a reference to aConfig.
   // This is called on the decode task queue.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) = 0;
 
   // Caches pref media.fragmented-mp4.use-blank-decoder
   static bool sUseBlankDecoder;
   static bool sFFmpegDecoderEnabled;
   static bool sGonkDecoderEnabled;
   static bool sAndroidMCDecoderPreferred;
@@ -255,19 +252,19 @@ public:
   // For Codec Resource Management
   virtual bool IsWaitingMediaResources() {
     return false;
   };
   virtual bool IsHardwareAccelerated() const { return false; }
 
   // ConfigurationChanged will be called to inform the video or audio decoder
   // that the format of the next input sample is about to change.
-  // If video decoder, aConfig will be a VideoDecoderConfig object.
-  // If audio decoder, aConfig will be a AudioDecoderConfig object.
-  virtual nsresult ConfigurationChanged(const mp4_demuxer::TrackConfig& aConfig)
+  // If video decoder, aConfig will be a VideoInfo object.
+  // If audio decoder, aConfig will be a AudioInfo object.
+  virtual nsresult ConfigurationChanged(const TrackInfo& aConfig)
   {
     return NS_OK;
   }
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/fmp4/SharedDecoderManager.cpp
+++ b/dom/media/fmp4/SharedDecoderManager.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "SharedDecoderManager.h"
-#include "mp4_demuxer/DecoderData.h"
 
 namespace mozilla {
 
 class SharedDecoderCallback : public MediaDataDecoderCallback
 {
 public:
   explicit SharedDecoderCallback(SharedDecoderManager* aManager)
     : mManager(aManager)
@@ -71,17 +70,17 @@ SharedDecoderManager::SharedDecoderManag
 
 SharedDecoderManager::~SharedDecoderManager()
 {
 }
 
 already_AddRefed<MediaDataDecoder>
 SharedDecoderManager::CreateVideoDecoder(
   PlatformDecoderModule* aPDM,
-  const mp4_demuxer::VideoDecoderConfig& aConfig,
+  const VideoInfo& aConfig,
   layers::LayersBackend aLayersBackend,
   layers::ImageContainer* aImageContainer,
   FlushableMediaTaskQueue* aVideoTaskQueue,
   MediaDataDecoderCallback* aCallback)
 {
   if (!mDecoder) {
     mLayersBackend = aLayersBackend;
     mImageContainer = aImageContainer;
@@ -111,17 +110,17 @@ SharedDecoderManager::CreateVideoDecoder
 void
 SharedDecoderManager::DisableHardwareAcceleration()
 {
   MOZ_ASSERT(mPDM);
   mPDM->DisableHardwareAcceleration();
 }
 
 bool
-SharedDecoderManager::Recreate(const mp4_demuxer::VideoDecoderConfig& aConfig)
+SharedDecoderManager::Recreate(const VideoInfo& aConfig)
 {
   mDecoder->Flush();
   mDecoder->Shutdown();
   mDecoder = mPDM->CreateDecoder(aConfig,
                                  mTaskQueue,
                                  mCallback,
                                  mLayersBackend,
                                  mImageContainer);
--- a/dom/media/fmp4/SharedDecoderManager.h
+++ b/dom/media/fmp4/SharedDecoderManager.h
@@ -21,33 +21,33 @@ class SharedDecoderManager
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedDecoderManager)
 
   SharedDecoderManager();
 
   already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
     PlatformDecoderModule* aPDM,
-    const mp4_demuxer::VideoDecoderConfig& aConfig,
+    const VideoInfo& aConfig,
     layers::LayersBackend aLayersBackend,
     layers::ImageContainer* aImageContainer,
     FlushableMediaTaskQueue* aVideoTaskQueue,
     MediaDataDecoderCallback* aCallback);
 
   void SetReader(MediaDecoderReader* aReader);
   void Select(SharedDecoderProxy* aProxy);
   void SetIdle(MediaDataDecoder* aProxy);
   void ReleaseMediaResources();
   void Shutdown();
 
   friend class SharedDecoderProxy;
   friend class SharedDecoderCallback;
 
   void DisableHardwareAcceleration();
-  bool Recreate(const mp4_demuxer::VideoDecoderConfig& aConfig);
+  bool Recreate(const VideoInfo& aConfig);
 
 private:
   virtual ~SharedDecoderManager();
   void DrainComplete();
 
   nsRefPtr<PlatformDecoderModule> mPDM;
   nsRefPtr<MediaDataDecoder> mDecoder;
   layers::LayersBackend mLayersBackend;
--- a/dom/media/fmp4/android/AndroidDecoderModule.cpp
+++ b/dom/media/fmp4/android/AndroidDecoderModule.cpp
@@ -7,19 +7,17 @@
 #include "GLBlitHelper.h"
 #include "GLContext.h"
 #include "GLContextEGL.h"
 #include "GLContextProvider.h"
 #include "GLImages.h"
 #include "GLLibraryEGL.h"
 
 #include "MediaData.h"
-
-#include "mp4_demuxer/AnnexB.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "nsPromiseFlatString.h"
 
 #include <jni.h>
 #include <string.h>
 
@@ -33,20 +31,20 @@ static MediaCodec::LocalRef CreateDecode
 {
   MediaCodec::LocalRef codec;
   NS_ENSURE_SUCCESS(MediaCodec::CreateDecoderByType(PromiseFlatCString(aMimeType).get(), &codec), nullptr);
   return codec;
 }
 
 class VideoDataDecoder : public MediaCodecDataDecoder {
 public:
-  VideoDataDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  VideoDataDecoder(const VideoInfo& aConfig,
                    MediaFormat::Param aFormat, MediaDataDecoderCallback* aCallback,
                    layers::ImageContainer* aImageContainer)
-    : MediaCodecDataDecoder(MediaData::Type::VIDEO_DATA, aConfig.mime_type, aFormat, aCallback)
+    : MediaCodecDataDecoder(MediaData::Type::VIDEO_DATA, aConfig.mMimeType, aFormat, aCallback)
     , mImageContainer(aImageContainer)
     , mConfig(aConfig)
   {
 
   }
 
   nsresult Init() override {
     mSurfaceTexture = AndroidSurfaceTexture::Create();
@@ -96,23 +94,20 @@ public:
     return eglImage;
   }
 
   virtual nsresult PostOutput(BufferInfo::Param aInfo, MediaFormat::Param aFormat, Microseconds aDuration) override {
     if (!EnsureGLContext()) {
       return NS_ERROR_FAILURE;
     }
 
-    VideoInfo videoInfo;
-    videoInfo.mDisplay = nsIntSize(mConfig.display_width, mConfig.display_height);
-
     nsRefPtr<layers::Image> img = mImageContainer->CreateImage(ImageFormat::SURFACE_TEXTURE);
     layers::SurfaceTextureImage::Data data;
     data.mSurfTex = mSurfaceTexture.get();
-    data.mSize = gfx::IntSize(mConfig.display_width, mConfig.display_height);
+    data.mSize = mConfig.mDisplay;
     data.mOriginPos = gl::OriginPos::BottomLeft;
 
     layers::SurfaceTextureImage* stImg = static_cast<layers::SurfaceTextureImage*>(img.get());
     stImg->SetData(data);
 
     if (WantCopy()) {
       EGLImage eglImage = CopySurface(img);
       if (!eglImage) {
@@ -133,17 +128,17 @@ public:
         NS_WARNING("No EGL fence support detected, rendering artifacts may occur!");
       }
 
       img = mImageContainer->CreateImage(ImageFormat::EGLIMAGE);
       layers::EGLImageImage::Data data;
       data.mImage = eglImage;
       data.mSync = eglSync;
       data.mOwns = true;
-      data.mSize = gfx::IntSize(mConfig.display_width, mConfig.display_height);
+      data.mSize = mConfig.mDisplay;
       data.mOriginPos = gl::OriginPos::BottomLeft;
 
       layers::EGLImageImage* typedImg = static_cast<layers::EGLImageImage*>(img.get());
       typedImg->SetData(data);
     }
 
     nsresult rv;
     int32_t flags;
@@ -152,60 +147,64 @@ public:
     bool isSync = !!(flags & MediaCodec::BUFFER_FLAG_SYNC_FRAME);
 
     int32_t offset;
     NS_ENSURE_SUCCESS(rv = aInfo->Offset(&offset), rv);
 
     int64_t presentationTimeUs;
     NS_ENSURE_SUCCESS(rv = aInfo->PresentationTimeUs(&presentationTimeUs), rv);
 
-    nsRefPtr<VideoData> v = VideoData::CreateFromImage(videoInfo, mImageContainer, offset,
-                                                       presentationTimeUs,
-                                                       aDuration,
-                                                       img, isSync,
-                                                       presentationTimeUs,
-                                                       gfx::IntRect(0, 0,
-                                                         mConfig.display_width,
-                                                         mConfig.display_height));
+    nsRefPtr<VideoData> v =
+      VideoData::CreateFromImage(mConfig,
+                                 mImageContainer,
+                                 offset,
+                                 presentationTimeUs,
+                                 aDuration,
+                                 img,
+                                 isSync,
+                                 presentationTimeUs,
+                                 gfx::IntRect(0, 0,
+                                              mConfig.mDisplay.width,
+                                              mConfig.mDisplay.height));
     mCallback->Output(v);
     return NS_OK;
   }
 
 protected:
   bool EnsureGLContext() {
     if (mGLContext) {
       return true;
     }
 
     mGLContext = GLContextProvider::CreateHeadless(false);
     return mGLContext;
   }
 
   layers::ImageContainer* mImageContainer;
-  const mp4_demuxer::VideoDecoderConfig& mConfig;
+  const VideoInfo& mConfig;
   RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
   nsRefPtr<GLContext> mGLContext;
 };
 
 class AudioDataDecoder : public MediaCodecDataDecoder {
 private:
   uint8_t csd0[2];
 
 public:
-  AudioDataDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, MediaFormat::Param aFormat, MediaDataDecoderCallback* aCallback)
-    : MediaCodecDataDecoder(MediaData::Type::AUDIO_DATA, aConfig.mime_type, aFormat, aCallback)
+  AudioDataDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat, MediaDataDecoderCallback* aCallback)
+    : MediaCodecDataDecoder(MediaData::Type::AUDIO_DATA, aConfig.mMimeType, aFormat, aCallback)
   {
     JNIEnv* env = GetJNIForThread();
 
     jni::Object::LocalRef buffer(env);
     NS_ENSURE_SUCCESS_VOID(aFormat->GetByteBuffer(NS_LITERAL_STRING("csd-0"), &buffer));
 
-    if (!buffer && aConfig.audio_specific_config->Length() >= 2) {
-      csd0[0] = (*aConfig.audio_specific_config)[0];
-      csd0[1] = (*aConfig.audio_specific_config)[1];
+    if (!buffer && aConfig.mCodecSpecificConfig->Length() >= 2) {
+      csd0[0] = (*aConfig.mCodecSpecificConfig)[0];
+      csd0[1] = (*aConfig.mCodecSpecificConfig)[1];
 
       buffer = jni::Object::LocalRef::Adopt(env, env->NewDirectByteBuffer(csd0, 2));
       NS_ENSURE_SUCCESS_VOID(aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"), buffer));
     }
   }
 
   nsresult Output(BufferInfo::Param aInfo, void* aBuffer, MediaFormat::Param aFormat, Microseconds aDuration) {
     // The output on Android is always 16-bit signed
@@ -250,62 +249,62 @@ bool AndroidDecoderModule::SupportsMimeT
       aMimeType.EqualsLiteral("video/avc")) {
     return true;
   }
   return static_cast<bool>(mozilla::CreateDecoder(aMimeType));
 }
 
 already_AddRefed<MediaDataDecoder>
 AndroidDecoderModule::CreateVideoDecoder(
-                                const mp4_demuxer::VideoDecoderConfig& aConfig,
+                                const VideoInfo& aConfig,
                                 layers::LayersBackend aLayersBackend,
                                 layers::ImageContainer* aImageContainer,
                                 FlushableMediaTaskQueue* aVideoTaskQueue,
                                 MediaDataDecoderCallback* aCallback)
 {
   MediaFormat::LocalRef format;
 
   NS_ENSURE_SUCCESS(MediaFormat::CreateVideoFormat(
-      aConfig.mime_type,
-      aConfig.display_width,
-      aConfig.display_height,
+      aConfig.mMimeType,
+      aConfig.mDisplay.width,
+      aConfig.mDisplay.height,
       &format), nullptr);
 
   nsRefPtr<MediaDataDecoder> decoder =
     new VideoDataDecoder(aConfig, format, aCallback, aImageContainer);
 
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-AndroidDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+AndroidDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
                                          FlushableMediaTaskQueue* aAudioTaskQueue,
                                          MediaDataDecoderCallback* aCallback)
 {
-  MOZ_ASSERT(aConfig.bits_per_sample == 16, "We only handle 16-bit audio!");
+  MOZ_ASSERT(aConfig.mBitDepth == 16, "We only handle 16-bit audio!");
 
   MediaFormat::LocalRef format;
 
   NS_ENSURE_SUCCESS(MediaFormat::CreateAudioFormat(
-      aConfig.mime_type,
-      aConfig.samples_per_second,
-      aConfig.channel_count,
+      aConfig.mMimeType,
+      aConfig.mBitDepth,
+      aConfig.mChannels,
       &format), nullptr);
 
   nsRefPtr<MediaDataDecoder> decoder =
     new AudioDataDecoder(aConfig, format, aCallback);
 
   return decoder.forget();
 
 }
 
 PlatformDecoderModule::ConversionRequired
-AndroidDecoderModule::DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const
+AndroidDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
-  if (aConfig.IsVideoConfig()) {
+  if (aConfig.IsVideo()) {
     return kNeedAnnexB;
   } else {
     return kNeedNone;
   }
 }
 
 MediaCodecDataDecoder::MediaCodecDataDecoder(MediaData::Type aType,
                                              const nsACString& aMimeType,
--- a/dom/media/fmp4/android/AndroidDecoderModule.h
+++ b/dom/media/fmp4/android/AndroidDecoderModule.h
@@ -15,35 +15,35 @@
 
 namespace mozilla {
 
 typedef std::queue<nsRefPtr<MediaRawData>> SampleQueue;
 
 class AndroidDecoderModule : public PlatformDecoderModule {
 public:
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
 
   AndroidDecoderModule() {}
   virtual ~AndroidDecoderModule() {}
 
   virtual bool SupportsMimeType(const nsACString& aMimeType) override;
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override;
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 };
 
 class MediaCodecDataDecoder : public MediaDataDecoder {
 public:
 
   MediaCodecDataDecoder(MediaData::Type aType,
                         const nsACString& aMimeType,
                         widget::sdk::MediaFormat::Param aFormat,
--- a/dom/media/fmp4/apple/AppleATDecoder.cpp
+++ b/dom/media/fmp4/apple/AppleATDecoder.cpp
@@ -3,51 +3,51 @@
 /* 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 "AppleUtils.h"
 #include "MP4Reader.h"
 #include "MP4Decoder.h"
 #include "mp4_demuxer/Adts.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "AppleATDecoder.h"
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* GetAppleMediaLog();
 #define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
 #else
 #define LOG(...)
 #endif
 #define FourCC2Str(n) ((char[5]){(char)(n >> 24), (char)(n >> 16), (char)(n >> 8), (char)(n), 0})
 
 namespace mozilla {
 
-AppleATDecoder::AppleATDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+AppleATDecoder::AppleATDecoder(const AudioInfo& aConfig,
                                FlushableMediaTaskQueue* aAudioTaskQueue,
                                MediaDataDecoderCallback* aCallback)
   : mConfig(aConfig)
   , mFileStreamError(false)
   , mTaskQueue(aAudioTaskQueue)
   , mCallback(aCallback)
   , mConverter(nullptr)
   , mStream(nullptr)
 {
   MOZ_COUNT_CTOR(AppleATDecoder);
   LOG("Creating Apple AudioToolbox decoder");
   LOG("Audio Decoder configuration: %s %d Hz %d channels %d bits per channel",
-      mConfig.mime_type.get(),
-      mConfig.samples_per_second,
-      mConfig.channel_count,
-      mConfig.bits_per_sample);
+      mConfig.mMimeType.get(),
+      mConfig.mRate,
+      mConfig.mChannels,
+      mConfig.mBitDepth);
 
-  if (mConfig.mime_type.EqualsLiteral("audio/mpeg")) {
+  if (mConfig.mMimeType.EqualsLiteral("audio/mpeg")) {
     mFormatID = kAudioFormatMPEGLayer3;
-  } else if (mConfig.mime_type.EqualsLiteral("audio/mp4a-latm")) {
+  } else if (mConfig.mMimeType.EqualsLiteral("audio/mp4a-latm")) {
     mFormatID = kAudioFormatMPEG4AAC;
   } else {
     mFormatID = 0;
   }
 }
 
 AppleATDecoder::~AppleATDecoder()
 {
@@ -293,29 +293,29 @@ nsresult
 AppleATDecoder::GetInputAudioDescription(AudioStreamBasicDescription& aDesc,
                                          const nsTArray<uint8_t>& aExtraData)
 {
   // Request the properties from CoreAudio using the codec magic cookie
   AudioFormatInfo formatInfo;
   PodZero(&formatInfo.mASBD);
   formatInfo.mASBD.mFormatID = mFormatID;
   if (mFormatID == kAudioFormatMPEG4AAC) {
-    formatInfo.mASBD.mFormatFlags = mConfig.extended_profile;
+    formatInfo.mASBD.mFormatFlags = mConfig.mExtendedProfile;
   }
   formatInfo.mMagicCookieSize = aExtraData.Length();
   formatInfo.mMagicCookie = aExtraData.Elements();
 
   UInt32 formatListSize;
   // Attempt to retrieve the default format using
   // kAudioFormatProperty_FormatInfo method.
   // This method only retrieves the FramesPerPacket information required
   // by the decoder, which depends on the codec type and profile.
   aDesc.mFormatID = mFormatID;
-  aDesc.mChannelsPerFrame = mConfig.channel_count;
-  aDesc.mSampleRate = mConfig.samples_per_second;
+  aDesc.mChannelsPerFrame = mConfig.mChannels;
+  aDesc.mSampleRate = mConfig.mRate;
   UInt32 inputFormatSize = sizeof(aDesc);
   OSStatus rv = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
                                        0,
                                        NULL,
                                        &inputFormatSize,
                                        &aDesc);
   if (NS_WARN_IF(rv)) {
     return NS_ERROR_FAILURE;
@@ -362,17 +362,17 @@ AppleATDecoder::GetInputAudioDescription
 
   return NS_OK;
 }
 
 nsresult
 AppleATDecoder::SetupDecoder(MediaRawData* aSample)
 {
   if (mFormatID == kAudioFormatMPEG4AAC &&
-      mConfig.extended_profile == 2) {
+      mConfig.mExtendedProfile == 2) {
     // Check for implicit SBR signalling if stream is AAC-LC
     // This will provide us with an updated magic cookie for use with
     // GetInputAudioDescription.
     if (NS_SUCCEEDED(GetImplicitAACMagicCookie(aSample)) &&
         !mMagicCookie.Length()) {
       // nothing found yet, will try again later
       return NS_ERROR_NOT_INITIALIZED;
     }
@@ -381,17 +381,17 @@ AppleATDecoder::SetupDecoder(MediaRawDat
 
   LOG("Initializing Apple AudioToolbox decoder");
 
   AudioStreamBasicDescription inputFormat;
   PodZero(&inputFormat);
   nsresult rv =
     GetInputAudioDescription(inputFormat,
                              mMagicCookie.Length() ?
-                                 mMagicCookie : *mConfig.extra_data);
+                                 mMagicCookie : *mConfig.mExtraData);
   if (NS_FAILED(rv)) {
     return rv;
   }
   // Fill in the output format manually.
   PodZero(&mOutputFormat);
   mOutputFormat.mFormatID = kAudioFormatLinearPCM;
   mOutputFormat.mSampleRate = inputFormat.mSampleRate;
   mOutputFormat.mChannelsPerFrame = inputFormat.mChannelsPerFrame;
@@ -463,20 +463,22 @@ static void
 nsresult
 AppleATDecoder::GetImplicitAACMagicCookie(const MediaRawData* aSample)
 {
   // Prepend ADTS header to AAC audio.
   nsRefPtr<MediaRawData> adtssample(aSample->Clone());
   if (!adtssample) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
+  int8_t frequency_index =
+    mp4_demuxer::Adts::GetFrequencyIndex(mConfig.mRate);
 
-  bool rv = mp4_demuxer::Adts::ConvertSample(mConfig.channel_count,
-                                             mConfig.frequency_index,
-                                             mConfig.aac_profile,
+  bool rv = mp4_demuxer::Adts::ConvertSample(mConfig.mChannels,
+                                             frequency_index,
+                                             mConfig.mProfile,
                                              adtssample);
   if (!rv) {
     NS_WARNING("Failed to apply ADTS header");
     return NS_ERROR_FAILURE;
   }
   if (!mStream) {
     OSStatus rv = AudioFileStreamOpen(this,
                                       _MetadataCallback,
--- a/dom/media/fmp4/apple/AppleATDecoder.h
+++ b/dom/media/fmp4/apple/AppleATDecoder.h
@@ -15,29 +15,29 @@
 
 namespace mozilla {
 
 class FlushableMediaTaskQueue;
 class MediaDataDecoderCallback;
 
 class AppleATDecoder : public MediaDataDecoder {
 public:
-  AppleATDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  AppleATDecoder(const AudioInfo& aConfig,
                  FlushableMediaTaskQueue* aVideoTaskQueue,
                  MediaDataDecoderCallback* aCallback);
   virtual ~AppleATDecoder();
 
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Flush() override;
   virtual nsresult Drain() override;
   virtual nsresult Shutdown() override;
 
   // Callbacks also need access to the config.
-  const mp4_demuxer::AudioDecoderConfig& mConfig;
+  const AudioInfo& mConfig;
 
   // Use to extract magic cookie for HE-AAC detection.
   nsTArray<uint8_t> mMagicCookie;
   // Will be set to true should an error occurred while attempting to retrieve
   // the magic cookie property.
   bool mFileStreamError;
 
 private:
--- a/dom/media/fmp4/apple/AppleDecoderModule.cpp
+++ b/dom/media/fmp4/apple/AppleDecoderModule.cpp
@@ -144,17 +144,17 @@ AppleDecoderModule::Startup()
 
   nsCOMPtr<nsIRunnable> task(new LinkTask());
   NS_DispatchToMainThread(task, NS_DISPATCH_SYNC);
 
   return NS_OK;
 }
 
 already_AddRefed<MediaDataDecoder>
-AppleDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+AppleDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                        layers::LayersBackend aLayersBackend,
                                        layers::ImageContainer* aImageContainer,
                                        FlushableMediaTaskQueue* aVideoTaskQueue,
                                        MediaDataDecoderCallback* aCallback)
 {
   nsRefPtr<MediaDataDecoder> decoder;
 
   if (sIsVDAAvailable && (!sIsVTHWAvailable || sForceVDA)) {
@@ -172,35 +172,35 @@ AppleDecoderModule::CreateVideoDecoder(c
   if (sIsVTAvailable) {
     decoder =
       new AppleVTDecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer);
   }
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-AppleDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+AppleDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
                                        FlushableMediaTaskQueue* aAudioTaskQueue,
                                        MediaDataDecoderCallback* aCallback)
 {
   nsRefPtr<MediaDataDecoder> decoder =
     new AppleATDecoder(aConfig, aAudioTaskQueue, aCallback);
   return decoder.forget();
 }
 
 bool
 AppleDecoderModule::SupportsMimeType(const nsACString& aMimeType)
 {
   return aMimeType.EqualsLiteral("audio/mpeg") ||
     PlatformDecoderModule::SupportsMimeType(aMimeType);
 }
 
 PlatformDecoderModule::ConversionRequired
-AppleDecoderModule::DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const
+AppleDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
-  if (aConfig.IsVideoConfig()) {
+  if (aConfig.IsVideo()) {
     return kNeedAVCC;
   } else {
     return kNeedNone;
   }
 }
 
 } // namespace mozilla
--- a/dom/media/fmp4/apple/AppleDecoderModule.h
+++ b/dom/media/fmp4/apple/AppleDecoderModule.h
@@ -15,32 +15,32 @@ class AppleDecoderModule : public Platfo
 public:
   AppleDecoderModule();
   virtual ~AppleDecoderModule();
 
   virtual nsresult Startup() override;
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   virtual bool SupportsMimeType(const nsACString& aMimeType) override;
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override;
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 
   static void Init();
   static nsresult CanDecode();
 
 private:
   friend class InitTask;
   friend class LinkTask;
   friend class UnlinkTask;
--- a/dom/media/fmp4/apple/AppleVDADecoder.cpp
+++ b/dom/media/fmp4/apple/AppleVDADecoder.cpp
@@ -4,17 +4,17 @@
  * 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 <CoreFoundation/CFString.h>
 
 #include "AppleUtils.h"
 #include "AppleVDADecoder.h"
 #include "AppleVDALinker.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "mp4_demuxer/H264.h"
 #include "MP4Decoder.h"
 #include "MediaData.h"
 #include "MacIOSurfaceImage.h"
 #include "mozilla/ArrayUtils.h"
 #include "nsAutoPtr.h"
 #include "nsCocoaFeatures.h"
 #include "nsThreadUtils.h"
@@ -28,37 +28,36 @@ PRLogModuleInfo* GetAppleMediaLog();
 #define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
 //#define LOG_MEDIA_SHA1
 #else
 #define LOG(...)
 #endif
 
 namespace mozilla {
 
-AppleVDADecoder::AppleVDADecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+AppleVDADecoder::AppleVDADecoder(const VideoInfo& aConfig,
                                FlushableMediaTaskQueue* aVideoTaskQueue,
                                MediaDataDecoderCallback* aCallback,
                                layers::ImageContainer* aImageContainer)
   : mTaskQueue(aVideoTaskQueue)
   , mCallback(aCallback)
   , mImageContainer(aImageContainer)
-  , mPictureWidth(aConfig.image_width)
-  , mPictureHeight(aConfig.image_height)
-  , mDisplayWidth(aConfig.display_width)
-  , mDisplayHeight(aConfig.display_height)
+  , mPictureWidth(aConfig.mImage.width)
+  , mPictureHeight(aConfig.mImage.height)
+  , mDisplayWidth(aConfig.mDisplay.width)
+  , mDisplayHeight(aConfig.mDisplay.height)
   , mDecoder(nullptr)
   , mIs106(!nsCocoaFeatures::OnLionOrLater())
 {
   MOZ_COUNT_CTOR(AppleVDADecoder);
   // TODO: Verify aConfig.mime_type.
 
+  mExtraData = aConfig.mExtraData;
+  mMaxRefFrames = 4;
   // Retrieve video dimensions from H264 SPS NAL.
-  mPictureWidth = aConfig.image_width;
-  mExtraData = aConfig.extra_data;
-  mMaxRefFrames = 4;
   mp4_demuxer::SPSData spsdata;
   if (mp4_demuxer::H264::DecodeSPSFromExtraData(mExtraData, spsdata)) {
     // max_num_ref_frames determines the size of the sliding window
     // we need to queue that many frames in order to guarantee proper
     // pts frames ordering. Use a minimum of 4 to ensure proper playback of
     // non compliant videos.
     mMaxRefFrames =
       std::min(std::max(mMaxRefFrames, spsdata.max_num_ref_frames + 1), 16u);
@@ -497,17 +496,17 @@ AppleVDADecoder::CreateOutputConfigurati
                             ArrayLength(outputKeys),
                             &kCFTypeDictionaryKeyCallBacks,
                             &kCFTypeDictionaryValueCallBacks);
 }
 
 /* static */
 already_AddRefed<AppleVDADecoder>
 AppleVDADecoder::CreateVDADecoder(
-  const mp4_demuxer::VideoDecoderConfig& aConfig,
+  const VideoInfo& aConfig,
   FlushableMediaTaskQueue* aVideoTaskQueue,
   MediaDataDecoderCallback* aCallback,
   layers::ImageContainer* aImageContainer)
 {
   nsRefPtr<AppleVDADecoder> decoder =
     new AppleVDADecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer);
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
--- a/dom/media/fmp4/apple/AppleVDADecoder.h
+++ b/dom/media/fmp4/apple/AppleVDADecoder.h
@@ -55,22 +55,22 @@ public:
       , is_sync_point(aIs_sync_point)
     {
     }
   };
 
   // Return a new created AppleVDADecoder or nullptr if media or hardware is
   // not supported by current configuration.
   static already_AddRefed<AppleVDADecoder> CreateVDADecoder(
-    const mp4_demuxer::VideoDecoderConfig& aConfig,
+    const VideoInfo& aConfig,
     FlushableMediaTaskQueue* aVideoTaskQueue,
     MediaDataDecoderCallback* aCallback,
     layers::ImageContainer* aImageContainer);
 
-  AppleVDADecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  AppleVDADecoder(const VideoInfo& aConfig,
                   FlushableMediaTaskQueue* aVideoTaskQueue,
                   MediaDataDecoderCallback* aCallback,
                   layers::ImageContainer* aImageContainer);
   virtual ~AppleVDADecoder();
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Flush() override;
   virtual nsresult Drain() override;
--- a/dom/media/fmp4/apple/AppleVTDecoder.cpp
+++ b/dom/media/fmp4/apple/AppleVTDecoder.cpp
@@ -29,17 +29,17 @@ PRLogModuleInfo* GetAppleMediaLog();
 #endif
 
 #ifdef LOG_MEDIA_SHA1
 #include "mozilla/SHA1.h"
 #endif
 
 namespace mozilla {
 
-AppleVTDecoder::AppleVTDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig,
                                FlushableMediaTaskQueue* aVideoTaskQueue,
                                MediaDataDecoderCallback* aCallback,
                                layers::ImageContainer* aImageContainer)
   : AppleVDADecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer)
   , mFormat(nullptr)
   , mSession(nullptr)
   , mIsHardwareAccelerated(false)
 {
--- a/dom/media/fmp4/apple/AppleVTDecoder.h
+++ b/dom/media/fmp4/apple/AppleVTDecoder.h
@@ -10,17 +10,17 @@
 #include "AppleVDADecoder.h"
 
 #include "VideoToolbox/VideoToolbox.h"
 
 namespace mozilla {
 
 class AppleVTDecoder : public AppleVDADecoder {
 public:
-  AppleVTDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  AppleVTDecoder(const VideoInfo& aConfig,
                  FlushableMediaTaskQueue* aVideoTaskQueue,
                  MediaDataDecoderCallback* aCallback,
                  layers::ImageContainer* aImageContainer);
   virtual ~AppleVTDecoder();
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Flush() override;
   virtual nsresult Drain() override;
--- a/dom/media/fmp4/eme/EMEAudioDecoder.h
+++ b/dom/media/fmp4/eme/EMEAudioDecoder.h
@@ -19,17 +19,17 @@ public:
   {}
 
   virtual void Error(GMPErr aErr) override;
 };
 
 class EMEAudioDecoder : public GMPAudioDecoder {
 public:
   EMEAudioDecoder(CDMProxy* aProxy,
-                  const mp4_demuxer::AudioDecoderConfig& aConfig,
+                  const AudioInfo& aConfig,
                   MediaTaskQueue* aTaskQueue,
                   MediaDataDecoderCallbackProxy* aCallback)
    : GMPAudioDecoder(aConfig, aTaskQueue, aCallback, new EMEAudioCallbackAdapter(aCallback))
    , mProxy(aProxy)
   {
   }
 
 private:
--- a/dom/media/fmp4/eme/EMEDecoderModule.cpp
+++ b/dom/media/fmp4/eme/EMEDecoderModule.cpp
@@ -7,17 +7,17 @@
 #include "EMEDecoderModule.h"
 #include "EMEAudioDecoder.h"
 #include "EMEVideoDecoder.h"
 #include "MediaDataDecoderProxy.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/unused.h"
 #include "nsServiceManagerUtils.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 
 namespace mozilla {
 
 class EMEDecryptor : public MediaDataDecoder {
 
 public:
 
   EMEDecryptor(MediaDataDecoder* aDecoder,
@@ -235,23 +235,23 @@ CreateDecoderWrapper(MediaDataDecoderCal
     return nullptr;
   }
 
   nsRefPtr<MediaDataDecoderProxy> decoder(new EMEMediaDataDecoderProxy(thread, aCallback, aProxy, aTaskQueue));
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-EMEDecoderModule::CreateVideoDecoder(const VideoDecoderConfig& aConfig,
+EMEDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                      layers::LayersBackend aLayersBackend,
                                      layers::ImageContainer* aImageContainer,
                                      FlushableMediaTaskQueue* aVideoTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
-  if (mCDMDecodesVideo && aConfig.crypto.mValid) {
+  if (mCDMDecodesVideo && aConfig.mCrypto.mValid) {
     nsRefPtr<MediaDataDecoderProxy> wrapper = CreateDecoderWrapper(aCallback, mProxy, aVideoTaskQueue);
     wrapper->SetProxyTarget(new EMEVideoDecoder(mProxy,
                                                 aConfig,
                                                 aLayersBackend,
                                                 aImageContainer,
                                                 aVideoTaskQueue,
                                                 wrapper->Callback()));
     return wrapper.forget();
@@ -262,59 +262,59 @@ EMEDecoderModule::CreateVideoDecoder(con
                         aVideoTaskQueue,
                         aCallback,
                         aLayersBackend,
                         aImageContainer));
   if (!decoder) {
     return nullptr;
   }
 
-  if (!aConfig.crypto.mValid) {
+  if (!aConfig.mCrypto.mValid) {
     return decoder.forget();
   }
 
   nsRefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
                                                          aCallback,
                                                          mProxy));
   return emeDecoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-EMEDecoderModule::CreateAudioDecoder(const AudioDecoderConfig& aConfig,
+EMEDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
                                      FlushableMediaTaskQueue* aAudioTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
-  if (mCDMDecodesAudio && aConfig.crypto.mValid) {
+  if (mCDMDecodesAudio && aConfig.mCrypto.mValid) {
     nsRefPtr<MediaDataDecoderProxy> wrapper = CreateDecoderWrapper(aCallback, mProxy, aAudioTaskQueue);
     wrapper->SetProxyTarget(new EMEAudioDecoder(mProxy,
                                                 aConfig,
                                                 aAudioTaskQueue,
                                                 wrapper->Callback()));
     return wrapper.forget();
   }
 
   nsRefPtr<MediaDataDecoder> decoder(
     mPDM->CreateDecoder(aConfig, aAudioTaskQueue, aCallback));
   if (!decoder) {
     return nullptr;
   }
 
-  if (!aConfig.crypto.mValid) {
+  if (!aConfig.mCrypto.mValid) {
     return decoder.forget();
   }
 
   nsRefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
                                                          aCallback,
                                                          mProxy));
   return emeDecoder.forget();
 }
 
 PlatformDecoderModule::ConversionRequired
-EMEDecoderModule::DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const
+EMEDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
-  if (aConfig.IsVideoConfig()) {
+  if (aConfig.IsVideo()) {
     return kNeedAVCC;
   } else {
     return kNeedNone;
   }
 }
 
 } // namespace mozilla
--- a/dom/media/fmp4/eme/EMEDecoderModule.h
+++ b/dom/media/fmp4/eme/EMEDecoderModule.h
@@ -12,43 +12,41 @@
 
 namespace mozilla {
 
 class CDMProxy;
 class FlushableMediaTaskQueue;
 
 class EMEDecoderModule : public PlatformDecoderModule {
 private:
-  typedef mp4_demuxer::AudioDecoderConfig AudioDecoderConfig;
-  typedef mp4_demuxer::VideoDecoderConfig VideoDecoderConfig;
 
 public:
   EMEDecoderModule(CDMProxy* aProxy,
                    PlatformDecoderModule* aPDM,
                    bool aCDMDecodesAudio,
                    bool aCDMDecodesVideo);
 
   virtual ~EMEDecoderModule();
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                     layers::LayersBackend aLayersBackend,
                     layers::ImageContainer* aImageContainer,
                     FlushableMediaTaskQueue* aVideoTaskQueue,
                     MediaDataDecoderCallback* aCallback) override;
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override;
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 
 private:
   nsRefPtr<CDMProxy> mProxy;
   // Will be null if CDM has decoding capability.
   nsRefPtr<PlatformDecoderModule> mPDM;
   // We run the PDM on its own task queue.
   nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
   bool mCDMDecodesAudio;
--- a/dom/media/fmp4/eme/EMEVideoDecoder.h
+++ b/dom/media/fmp4/eme/EMEVideoDecoder.h
@@ -24,24 +24,30 @@ public:
   {}
 
   virtual void Error(GMPErr aErr) override;
 };
 
 class EMEVideoDecoder : public GMPVideoDecoder {
 public:
   EMEVideoDecoder(CDMProxy* aProxy,
-                  const mp4_demuxer::VideoDecoderConfig& aConfig,
+                  const VideoInfo& aConfig,
                   layers::LayersBackend aLayersBackend,
                   layers::ImageContainer* aImageContainer,
                   MediaTaskQueue* aTaskQueue,
                   MediaDataDecoderCallbackProxy* aCallback)
-   : GMPVideoDecoder(aConfig, aLayersBackend, aImageContainer, aTaskQueue, aCallback,
-                     new EMEVideoCallbackAdapter(aCallback, VideoInfo(aConfig.display_width,
-                                                                      aConfig.display_height), aImageContainer))
+   : GMPVideoDecoder(aConfig,
+                     aLayersBackend,
+                     aImageContainer,
+                     aTaskQueue,
+                     aCallback,
+                     new EMEVideoCallbackAdapter(aCallback,
+                                                 VideoInfo(aConfig.mDisplay.width,
+                                                           aConfig.mDisplay.height),
+                                                 aImageContainer))
    , mProxy(aProxy)
   {
   }
 
 private:
   virtual void InitTags(nsTArray<nsCString>& aTags) override;
   virtual nsCString GetNodeId() override;
   virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample) override;
--- a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
+++ b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
@@ -3,33 +3,32 @@
 /* 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 "MediaTaskQueue.h"
 #include "FFmpegRuntimeLinker.h"
 
 #include "FFmpegAudioDecoder.h"
-#include "mp4_demuxer/Adts.h"
 
 #define MAX_CHANNELS 16
 
 namespace mozilla
 {
 
 FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(
   FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
-  const mp4_demuxer::AudioDecoderConfig& aConfig)
-  : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mime_type))
+  const AudioInfo& aConfig)
+  : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mMimeType))
   , mCallback(aCallback)
 {
   MOZ_COUNT_CTOR(FFmpegAudioDecoder);
   // Use a new DataBuffer as the object will be modified during initialization.
   mExtraData = new DataBuffer;
-  mExtraData->AppendElements(*aConfig.audio_specific_config);
+  mExtraData->AppendElements(*aConfig.mCodecSpecificConfig);
 }
 
 nsresult
 FFmpegAudioDecoder<LIBAV_VER>::Init()
 {
   nsresult rv = FFmpegDataDecoder::Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h
+++ b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h
@@ -17,17 +17,17 @@ template <int V> class FFmpegAudioDecode
 };
 
 template <>
 class FFmpegAudioDecoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
 {
 public:
   FFmpegAudioDecoder(FlushableMediaTaskQueue* aTaskQueue,
                      MediaDataDecoderCallback* aCallback,
-                     const mp4_demuxer::AudioDecoderConfig& aConfig);
+                     const AudioInfo& aConfig);
   virtual ~FFmpegAudioDecoder();
 
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Drain() override;
   static AVCodecID GetCodecId(const nsACString& aMimeType);
 
 private:
--- a/dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h
+++ b/dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h
@@ -24,50 +24,50 @@ public:
     nsRefPtr<PlatformDecoderModule> pdm = new FFmpegDecoderModule();
     return pdm.forget();
   }
 
   FFmpegDecoderModule() {}
   virtual ~FFmpegDecoderModule() {}
 
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override
   {
     nsRefPtr<MediaDataDecoder> decoder =
       new FFmpegH264Decoder<V>(aVideoTaskQueue, aCallback, aConfig,
                                aImageContainer);
     return decoder.forget();
   }
 
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override
   {
     nsRefPtr<MediaDataDecoder> decoder =
       new FFmpegAudioDecoder<V>(aAudioTaskQueue, aCallback, aConfig);
     return decoder.forget();
   }
 
   virtual bool SupportsMimeType(const nsACString& aMimeType) override
   {
     return FFmpegAudioDecoder<V>::GetCodecId(aMimeType) != AV_CODEC_ID_NONE ||
       FFmpegH264Decoder<V>::GetCodecId(aMimeType) != AV_CODEC_ID_NONE;
   }
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override
   {
-    if (aConfig.IsVideoConfig() &&
-        (aConfig.mime_type.EqualsLiteral("video/avc") ||
-         aConfig.mime_type.EqualsLiteral("video/mp4"))) {
+    if (aConfig.IsVideo() &&
+        (aConfig.mMimeType.EqualsLiteral("video/avc") ||
+         aConfig.mMimeType.EqualsLiteral("video/mp4"))) {
       return PlatformDecoderModule::kNeedAVCC;
     } else {
       return kNeedNone;
     }
   }
 
 };
 
--- a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
+++ b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
@@ -4,42 +4,42 @@
  * 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 "MediaTaskQueue.h"
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "ImageContainer.h"
 
-#include "mp4_demuxer/mp4_demuxer.h"
+#include "MediaInfo.h"
 
 #include "FFmpegH264Decoder.h"
 
 #define GECKO_FRAME_TYPE 0x00093CC0
 
 typedef mozilla::layers::Image Image;
 typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
 
 namespace mozilla
 {
 
 FFmpegH264Decoder<LIBAV_VER>::FFmpegH264Decoder(
   FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
-  const mp4_demuxer::VideoDecoderConfig& aConfig,
+  const VideoInfo& aConfig,
   ImageContainer* aImageContainer)
-  : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mime_type))
+  : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mMimeType))
   , mCallback(aCallback)
   , mImageContainer(aImageContainer)
-  , mDisplayWidth(aConfig.display_width)
-  , mDisplayHeight(aConfig.display_height)
+  , mDisplayWidth(aConfig.mDisplay.width)
+  , mDisplayHeight(aConfig.mDisplay.height)
 {
   MOZ_COUNT_CTOR(FFmpegH264Decoder);
   // Use a new DataBuffer as the object will be modified during initialization.
   mExtraData = new DataBuffer;
-  mExtraData->AppendElements(*aConfig.extra_data);
+  mExtraData->AppendElements(*aConfig.mExtraData);
 }
 
 nsresult
 FFmpegH264Decoder<LIBAV_VER>::Init()
 {
   nsresult rv = FFmpegDataDecoder::Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h
+++ b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h
@@ -27,17 +27,17 @@ class FFmpegH264Decoder<LIBAV_VER> : pub
     DECODE_FRAME,
     DECODE_NO_FRAME,
     DECODE_ERROR
   };
 
 public:
   FFmpegH264Decoder(FlushableMediaTaskQueue* aTaskQueue,
                     MediaDataDecoderCallback* aCallback,
-                    const mp4_demuxer::VideoDecoderConfig& aConfig,
+                    const VideoInfo& aConfig,
                     ImageContainer* aImageContainer);
   virtual ~FFmpegH264Decoder();
 
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Drain() override;
   virtual nsresult Flush() override;
   static AVCodecID GetCodecId(const nsACString& aMimeType);
--- a/dom/media/fmp4/gmp/GMPAudioDecoder.cpp
+++ b/dom/media/fmp4/gmp/GMPAudioDecoder.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "GMPAudioDecoder.h"
 #include "nsServiceManagerUtils.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 
 namespace mozilla {
 
 #if defined(DEBUG)
 bool IsOnGMPThread()
 {
   nsCOMPtr<mozIGeckoMediaPluginService> mps = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
   MOZ_ASSERT(mps);
@@ -148,23 +148,23 @@ GMPAudioDecoder::GetGMPAPI(GMPInitDoneRu
   }
 }
 
 void
 GMPAudioDecoder::GMPInitDone(GMPAudioDecoderProxy* aGMP)
 {
   MOZ_ASSERT(aGMP);
   nsTArray<uint8_t> codecSpecific;
-  codecSpecific.AppendElements(mConfig.audio_specific_config->Elements(),
-                               mConfig.audio_specific_config->Length());
+  codecSpecific.AppendElements(mConfig.mCodecSpecificConfig->Elements(),
+                               mConfig.mCodecSpecificConfig->Length());
 
   nsresult rv = aGMP->InitDecode(kGMPAudioCodecAAC,
-                                 mConfig.channel_count,
-                                 mConfig.bits_per_sample,
-                                 mConfig.samples_per_second,
+                                 mConfig.mChannels,
+                                 mConfig.mBitDepth,
+                                 mConfig.mRate,
                                  codecSpecific,
                                  mAdapter);
   if (NS_SUCCEEDED(rv)) {
     mGMP = aGMP;
   }
 }
 
 nsresult
@@ -199,17 +199,17 @@ GMPAudioDecoder::Input(MediaRawData* aSa
   nsRefPtr<MediaRawData> sample(aSample);
   if (!mGMP) {
     mCallback->Error();
     return NS_ERROR_FAILURE;
   }
 
   mAdapter->SetLastStreamOffset(sample->mOffset);
 
-  gmp::GMPAudioSamplesImpl samples(sample, mConfig.channel_count, mConfig.samples_per_second);
+  gmp::GMPAudioSamplesImpl samples(sample, mConfig.mChannels, mConfig.mRate);
   nsresult rv = mGMP->Decode(samples);
   if (NS_FAILED(rv)) {
     mCallback->Error();
     return rv;
   }
 
   return NS_OK;
 }
--- a/dom/media/fmp4/gmp/GMPAudioDecoder.h
+++ b/dom/media/fmp4/gmp/GMPAudioDecoder.h
@@ -42,29 +42,29 @@ private:
 
   int64_t mAudioFrameSum;
   int64_t mAudioFrameOffset;
   bool mMustRecaptureAudioPosition;
 };
 
 class GMPAudioDecoder : public MediaDataDecoder {
 protected:
-  GMPAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  GMPAudioDecoder(const AudioInfo& aConfig,
                   MediaTaskQueue* aTaskQueue,
                   MediaDataDecoderCallbackProxy* aCallback,
                   AudioCallbackAdapter* aAdapter)
    : mConfig(aConfig)
    , mCallback(aCallback)
    , mGMP(nullptr)
    , mAdapter(aAdapter)
   {
   }
 
 public:
-  GMPAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  GMPAudioDecoder(const AudioInfo& aConfig,
                   MediaTaskQueue* aTaskQueue,
                   MediaDataDecoderCallbackProxy* aCallback)
    : mConfig(aConfig)
    , mCallback(aCallback)
    , mGMP(nullptr)
    , mAdapter(new AudioCallbackAdapter(aCallback))
   {
   }
@@ -132,17 +132,17 @@ private:
     }
 
   private:
     nsRefPtr<GMPAudioDecoder> mDecoder;
     nsRefPtr<GMPInitDoneRunnable> mGMPInitDone;
   };
   void GMPInitDone(GMPAudioDecoderProxy* aGMP);
 
-  const mp4_demuxer::AudioDecoderConfig& mConfig;
+  const AudioInfo& mConfig;
   MediaDataDecoderCallbackProxy* mCallback;
   nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
   GMPAudioDecoderProxy* mGMP;
   nsAutoPtr<AudioCallbackAdapter> mAdapter;
 };
 
 } // namespace mozilla
 
--- a/dom/media/fmp4/gmp/GMPDecoderModule.cpp
+++ b/dom/media/fmp4/gmp/GMPDecoderModule.cpp
@@ -35,55 +35,55 @@ CreateDecoderWrapper(MediaDataDecoderCal
     return nullptr;
   }
 
   nsRefPtr<MediaDataDecoderProxy> decoder(new MediaDataDecoderProxy(thread, aCallback));
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-GMPDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+GMPDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                      layers::LayersBackend aLayersBackend,
                                      layers::ImageContainer* aImageContainer,
                                      FlushableMediaTaskQueue* aVideoTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
-  if (!aConfig.mime_type.EqualsLiteral("video/avc")) {
+  if (!aConfig.mMimeType.EqualsLiteral("video/avc")) {
     return nullptr;
   }
 
   nsRefPtr<MediaDataDecoderProxy> wrapper = CreateDecoderWrapper(aCallback);
   wrapper->SetProxyTarget(new GMPVideoDecoder(aConfig,
                                               aLayersBackend,
                                               aImageContainer,
                                               aVideoTaskQueue,
                                               wrapper->Callback()));
   return wrapper.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-GMPDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+GMPDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
                                      FlushableMediaTaskQueue* aAudioTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
-  if (!aConfig.mime_type.EqualsLiteral("audio/mp4a-latm")) {
+  if (!aConfig.mMimeType.EqualsLiteral("audio/mp4a-latm")) {
     return nullptr;
   }
 
   nsRefPtr<MediaDataDecoderProxy> wrapper = CreateDecoderWrapper(aCallback);
   wrapper->SetProxyTarget(new GMPAudioDecoder(aConfig,
                                               aAudioTaskQueue,
                                               wrapper->Callback()));
   return wrapper.forget();
 }
 
 PlatformDecoderModule::ConversionRequired
-GMPDecoderModule::DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const
+GMPDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
   // GMPVideoCodecType::kGMPVideoCodecH264 specifies that encoded frames must be in AVCC format.
-  if (aConfig.IsVideoConfig()) {
+  if (aConfig.IsVideo()) {
     return kNeedAVCC;
   } else {
     return kNeedNone;
   }
 }
 
 } // namespace mozilla
--- a/dom/media/fmp4/gmp/GMPDecoderModule.h
+++ b/dom/media/fmp4/gmp/GMPDecoderModule.h
@@ -14,27 +14,27 @@ namespace mozilla {
 class GMPDecoderModule : public PlatformDecoderModule {
 public:
   GMPDecoderModule();
 
   virtual ~GMPDecoderModule();
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override;
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 };
 
 } // namespace mozilla
 
 #endif // GMPDecoderModule_h_
--- a/dom/media/fmp4/gmp/GMPVideoDecoder.cpp
+++ b/dom/media/fmp4/gmp/GMPVideoDecoder.cpp
@@ -4,17 +4,16 @@
  * 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 "GMPVideoDecoder.h"
 #include "GMPVideoHost.h"
 #include "mozilla/Endian.h"
 #include "prsystem.h"
 #include "MediaData.h"
-#include "mp4_demuxer/DecoderData.h"
 
 namespace mozilla {
 
 #if defined(DEBUG)
 extern bool IsOnGMPThread();
 #endif
 
 void
@@ -144,18 +143,18 @@ GMPVideoDecoder::CreateFrame(MediaRawDat
       uint32_t length = BigEndian::readUint32(buf) + kNALLengthSize;
       *reinterpret_cast<uint32_t *>(buf) = length;
       buf += length;
     }
   }
 
   frame->SetBufferType(GMP_BufferLength32);
 
-  frame->SetEncodedWidth(mConfig.display_width);
-  frame->SetEncodedHeight(mConfig.display_height);
+  frame->SetEncodedWidth(mConfig.mDisplay.width);
+  frame->SetEncodedHeight(mConfig.mDisplay.height);
   frame->SetTimeStamp(aSample->mTime);
   frame->SetCompleteFrame(true);
   frame->SetDuration(aSample->mDuration);
   frame->SetFrameType(aSample->mKeyframe ? kGMPKeyFrame : kGMPDeltaFrame);
 
   return frame;
 }
 
@@ -179,23 +178,23 @@ GMPVideoDecoder::GMPInitDone(GMPVideoDec
   MOZ_ASSERT(aHost && aGMP);
 
   GMPVideoCodec codec;
   memset(&codec, 0, sizeof(codec));
 
   codec.mGMPApiVersion = kGMPVersion33;
 
   codec.mCodecType = kGMPVideoCodecH264;
-  codec.mWidth = mConfig.display_width;
-  codec.mHeight = mConfig.display_height;
+  codec.mWidth = mConfig.mDisplay.width;
+  codec.mHeight = mConfig.mDisplay.height;
 
   nsTArray<uint8_t> codecSpecific;
   codecSpecific.AppendElement(0); // mPacketizationMode.
-  codecSpecific.AppendElements(mConfig.extra_data->Elements(),
-                               mConfig.extra_data->Length());
+  codecSpecific.AppendElements(mConfig.mExtraData->Elements(),
+                               mConfig.mExtraData->Length());
 
   nsresult rv = aGMP->InitDecode(codec,
                                  codecSpecific,
                                  mAdapter,
                                  PR_GetNumberOfProcessors());
   if (NS_SUCCEEDED(rv)) {
     mGMP = aGMP;
     mHost = aHost;
--- a/dom/media/fmp4/gmp/GMPVideoDecoder.h
+++ b/dom/media/fmp4/gmp/GMPVideoDecoder.h
@@ -7,17 +7,17 @@
 #if !defined(GMPVideoDecoder_h_)
 #define GMPVideoDecoder_h_
 
 #include "GMPVideoDecoderProxy.h"
 #include "ImageContainer.h"
 #include "MediaDataDecoderProxy.h"
 #include "PlatformDecoderModule.h"
 #include "mozIGeckoMediaPluginService.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 
 namespace mozilla {
 
 class VideoCallbackAdapter : public GMPVideoDecoderCallbackProxy {
 public:
   VideoCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback,
                        VideoInfo aVideoInfo,
                        layers::ImageContainer* aImageContainer)
@@ -46,44 +46,44 @@ private:
   int64_t mLastStreamOffset;
 
   VideoInfo mVideoInfo;
   nsRefPtr<layers::ImageContainer> mImageContainer;
 };
 
 class GMPVideoDecoder : public MediaDataDecoder {
 protected:
-  GMPVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  GMPVideoDecoder(const VideoInfo& aConfig,
                   layers::LayersBackend aLayersBackend,
                   layers::ImageContainer* aImageContainer,
                   MediaTaskQueue* aTaskQueue,
                   MediaDataDecoderCallbackProxy* aCallback,
                   VideoCallbackAdapter* aAdapter)
    : mConfig(aConfig)
    , mCallback(aCallback)
    , mGMP(nullptr)
    , mHost(nullptr)
    , mAdapter(aAdapter)
    , mConvertNALUnitLengths(false)
   {
   }
 
 public:
-  GMPVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  GMPVideoDecoder(const VideoInfo& aConfig,
                   layers::LayersBackend aLayersBackend,
                   layers::ImageContainer* aImageContainer,
                   MediaTaskQueue* aTaskQueue,
                   MediaDataDecoderCallbackProxy* aCallback)
    : mConfig(aConfig)
    , mCallback(aCallback)
    , mGMP(nullptr)
    , mHost(nullptr)
    , mAdapter(new VideoCallbackAdapter(aCallback,
-                                       VideoInfo(aConfig.display_width,
-                                                 aConfig.display_height),
+                                       VideoInfo(aConfig.mDisplay.width,
+                                                 aConfig.mDisplay.height),
                                        aImageContainer))
    , mConvertNALUnitLengths(false)
   {
   }
 
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Flush() override;
@@ -148,17 +148,17 @@ private:
     }
 
   private:
     nsRefPtr<GMPVideoDecoder> mDecoder;
     nsRefPtr<GMPInitDoneRunnable> mGMPInitDone;
   };
   void GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost);
 
-  const mp4_demuxer::VideoDecoderConfig& mConfig;
+  const VideoInfo& mConfig;
   MediaDataDecoderCallbackProxy* mCallback;
   nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
   GMPVideoDecoderProxy* mGMP;
   GMPVideoHost* mHost;
   nsAutoPtr<VideoCallbackAdapter> mAdapter;
   bool mConvertNALUnitLengths;
 };
 
--- a/dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp
+++ b/dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp
@@ -15,16 +15,17 @@
 #include "prlog.h"
 #include "stagefright/MediaBuffer.h"
 #include "stagefright/MetaData.h"
 #include "stagefright/MediaErrors.h"
 #include <stagefright/foundation/AMessage.h>
 #include <stagefright/foundation/ALooper.h>
 #include "media/openmax/OMX_Audio.h"
 #include "MediaData.h"
+#include "MediaInfo.h"
 
 #include <android/log.h>
 #define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__)
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* GetDemuxerLog();
 #define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
 #else
@@ -34,30 +35,30 @@ PRLogModuleInfo* GetDemuxerLog();
 
 using namespace android;
 typedef android::MediaCodecProxy MediaCodecProxy;
 
 namespace mozilla {
 
 GonkAudioDecoderManager::GonkAudioDecoderManager(
   MediaTaskQueue* aTaskQueue,
-  const mp4_demuxer::AudioDecoderConfig& aConfig)
+  const AudioInfo& aConfig)
   : GonkDecoderManager(aTaskQueue)
-  , mAudioChannels(aConfig.channel_count)
-  , mAudioRate(aConfig.samples_per_second)
-  , mAudioProfile(aConfig.aac_profile)
+  , mAudioChannels(aConfig.mChannels)
+  , mAudioRate(aConfig.mRate)
+  , mAudioProfile(aConfig.mProfile)
   , mUseAdts(true)
   , mAudioBuffer(nullptr)
 {
   MOZ_COUNT_CTOR(GonkAudioDecoderManager);
   MOZ_ASSERT(mAudioChannels);
-  mUserData.AppendElements(aConfig.audio_specific_config->Elements(),
-                           aConfig.audio_specific_config->Length());
+  mUserData.AppendElements(aConfig.mCodecSpecificConfig->Elements(),
+                           aConfig.mCodecSpecificConfig->Length());
   // Pass through mp3 without applying an ADTS header.
-  if (!aConfig.mime_type.EqualsLiteral("audio/mp4a-latm")) {
+  if (!aConfig.mMimeType.EqualsLiteral("audio/mp4a-latm")) {
       mUseAdts = false;
   }
 }
 
 GonkAudioDecoderManager::~GonkAudioDecoderManager()
 {
   MOZ_COUNT_DTOR(GonkAudioDecoderManager);
 }
--- a/dom/media/fmp4/gonk/GonkAudioDecoderManager.h
+++ b/dom/media/fmp4/gonk/GonkAudioDecoderManager.h
@@ -19,17 +19,17 @@ class MOZ_EXPORT MediaBuffer;
 } // namespace android
 
 namespace mozilla {
 
 class GonkAudioDecoderManager : public GonkDecoderManager {
 typedef android::MediaCodecProxy MediaCodecProxy;
 public:
   GonkAudioDecoderManager(MediaTaskQueue* aTaskQueue,
-                          const mp4_demuxer::AudioDecoderConfig& aConfig);
+                          const AudioInfo& aConfig);
   ~GonkAudioDecoderManager();
 
   virtual android::sp<MediaCodecProxy> Init(MediaDataDecoderCallback* aCallback) override;
 
   virtual nsresult Output(int64_t aStreamOffset,
                           nsRefPtr<MediaData>& aOutput) override;
 
   virtual nsresult Flush() override;
--- a/dom/media/fmp4/gonk/GonkDecoderModule.cpp
+++ b/dom/media/fmp4/gonk/GonkDecoderModule.cpp
@@ -22,43 +22,43 @@ GonkDecoderModule::~GonkDecoderModule()
 /* static */
 void
 GonkDecoderModule::Init()
 {
   MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
 }
 
 already_AddRefed<MediaDataDecoder>
-GonkDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+GonkDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                      mozilla::layers::LayersBackend aLayersBackend,
                                      mozilla::layers::ImageContainer* aImageContainer,
                                      FlushableMediaTaskQueue* aVideoTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
   nsRefPtr<MediaDataDecoder> decoder =
   new GonkMediaDataDecoder(new GonkVideoDecoderManager(aVideoTaskQueue,
                                                        aImageContainer, aConfig),
                            aVideoTaskQueue, aCallback);
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-GonkDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+GonkDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
                                       FlushableMediaTaskQueue* aAudioTaskQueue,
                                       MediaDataDecoderCallback* aCallback)
 {
   nsRefPtr<MediaDataDecoder> decoder =
   new GonkMediaDataDecoder(new GonkAudioDecoderManager(aAudioTaskQueue, aConfig),
                            aAudioTaskQueue, aCallback);
   return decoder.forget();
 }
 
 PlatformDecoderModule::ConversionRequired
-GonkDecoderModule::DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const
+GonkDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
-  if (aConfig.IsVideoConfig()) {
+  if (aConfig.IsVideo()) {
     return kNeedAnnexB;
   } else {
     return kNeedNone;
   }
 }
 
 } // namespace mozilla
--- a/dom/media/fmp4/gonk/GonkDecoderModule.h
+++ b/dom/media/fmp4/gonk/GonkDecoderModule.h
@@ -13,29 +13,29 @@ namespace mozilla {
 
 class GonkDecoderModule : public PlatformDecoderModule {
 public:
   GonkDecoderModule();
   virtual ~GonkDecoderModule();
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      mozilla::layers::LayersBackend aLayersBackend,
                      mozilla::layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   // Decode thread.
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   static void Init();
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override;
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/fmp4/gonk/GonkVideoDecoderManager.cpp
+++ b/dom/media/fmp4/gonk/GonkVideoDecoderManager.cpp
@@ -16,17 +16,16 @@
 #include "prlog.h"
 #include "stagefright/MediaBuffer.h"
 #include "stagefright/MetaData.h"
 #include "stagefright/MediaErrors.h"
 #include <stagefright/foundation/ADebug.h>
 #include <stagefright/foundation/AMessage.h>
 #include <stagefright/foundation/AString.h>
 #include <stagefright/foundation/ALooper.h>
-#include "mp4_demuxer/AnnexB.h"
 #include "GonkNativeWindow.h"
 #include "GonkNativeWindowClient.h"
 #include "mozilla/layers/GrallocTextureClient.h"
 #include "mozilla/layers/TextureClient.h"
 
 #define READ_OUTPUT_BUFFER_TIMEOUT_US  3000
 
 #include <android/log.h>
@@ -42,34 +41,32 @@ using namespace mozilla::layers;
 using namespace android;
 typedef android::MediaCodecProxy MediaCodecProxy;
 
 namespace mozilla {
 
 GonkVideoDecoderManager::GonkVideoDecoderManager(
   MediaTaskQueue* aTaskQueue,
   mozilla::layers::ImageContainer* aImageContainer,
-  const mp4_demuxer::VideoDecoderConfig& aConfig)
+  const VideoInfo& aConfig)
   : GonkDecoderManager(aTaskQueue)
   , mImageContainer(aImageContainer)
   , mReaderCallback(nullptr)
   , mColorConverterBufferSize(0)
   , mNativeWindow(nullptr)
   , mPendingVideoBuffersLock("GonkVideoDecoderManager::mPendingVideoBuffersLock")
 {
   NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
   MOZ_ASSERT(mImageContainer);
   MOZ_COUNT_CTOR(GonkVideoDecoderManager);
-  mVideoWidth  = aConfig.display_width;
-  mVideoHeight = aConfig.display_height;
-  mDisplayWidth = aConfig.display_width;
-  mDisplayHeight = aConfig.display_height;
-  mInfo.mVideo.mHasVideo = true;
-  nsIntSize displaySize(mDisplayWidth, mDisplayHeight);
-  mInfo.mVideo.mDisplay = displaySize;
+  mVideoWidth  = aConfig.mDisplay.width;
+  mVideoHeight = aConfig.mDisplay.height;
+  mDisplayWidth = aConfig.mDisplay.width;
+  mDisplayHeight = aConfig.mDisplay.height;
+  mInfo.mVideo = aConfig;
 
   nsIntRect pictureRect(0, 0, mVideoWidth, mVideoHeight);
   nsIntSize frameSize(mVideoWidth, mVideoHeight);
   mPicture = pictureRect;
   mInitialFrame = frameSize;
   mHandler = new MessageHandler(this);
   mVideoListener = new VideoResourceListener(this);
 
--- a/dom/media/fmp4/gonk/GonkVideoDecoderManager.h
+++ b/dom/media/fmp4/gonk/GonkVideoDecoderManager.h
@@ -35,17 +35,17 @@ class TextureClient;
 
 class GonkVideoDecoderManager : public GonkDecoderManager {
 typedef android::MediaCodecProxy MediaCodecProxy;
 typedef mozilla::layers::TextureClient TextureClient;
 
 public:
   GonkVideoDecoderManager(MediaTaskQueue* aTaskQueue,
                           mozilla::layers::ImageContainer* aImageContainer,
-		                      const mp4_demuxer::VideoDecoderConfig& aConfig);
+                          const VideoInfo& aConfig);
 
   ~GonkVideoDecoderManager();
 
   virtual android::sp<MediaCodecProxy> Init(MediaDataDecoderCallback* aCallback) override;
 
   virtual nsresult Output(int64_t aStreamOffset,
                           nsRefPtr<MediaData>& aOutput) override;
 
--- a/dom/media/fmp4/wmf/WMFAudioMFTManager.cpp
+++ b/dom/media/fmp4/wmf/WMFAudioMFTManager.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "WMFAudioMFTManager.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "VideoUtils.h"
 #include "WMFUtils.h"
 #include "nsTArray.h"
 
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* GetDemuxerLog();
@@ -63,32 +63,32 @@ AACAudioSpecificConfigToUserData(uint8_t
   w[0] = 0x0; // Payload type raw AAC packet
   w[1] = aAACProfileLevelIndication;
 
   aOutUserData.AppendElements(heeInfo, heeInfoLen);
   aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength);
 }
 
 WMFAudioMFTManager::WMFAudioMFTManager(
-  const mp4_demuxer::AudioDecoderConfig& aConfig)
-  : mAudioChannels(aConfig.channel_count)
-  , mAudioRate(aConfig.samples_per_second)
+  const AudioInfo& aConfig)
+  : mAudioChannels(aConfig.mChannels)
+  , mAudioRate(aConfig.mRate)
   , mAudioFrameOffset(0)
   , mAudioFrameSum(0)
   , mMustRecaptureAudioPosition(true)
 {
   MOZ_COUNT_CTOR(WMFAudioMFTManager);
 
-  if (aConfig.mime_type.EqualsLiteral("audio/mpeg")) {
+  if (aConfig.mMimeType.EqualsLiteral("audio/mpeg")) {
     mStreamType = MP3;
-  } else if (aConfig.mime_type.EqualsLiteral("audio/mp4a-latm")) {
+  } else if (aConfig.mMimeType.EqualsLiteral("audio/mp4a-latm")) {
     mStreamType = AAC;
-    AACAudioSpecificConfigToUserData(aConfig.aac_profile,
-                                     aConfig.audio_specific_config->Elements(),
-                                     aConfig.audio_specific_config->Length(),
+    AACAudioSpecificConfigToUserData(aConfig.mProfile,
+                                     aConfig.mCodecSpecificConfig->Elements(),
+                                     aConfig.mCodecSpecificConfig->Length(),
                                      mUserData);
   } else {
     mStreamType = Unknown;
   }
 }
 
 WMFAudioMFTManager::~WMFAudioMFTManager()
 {
--- a/dom/media/fmp4/wmf/WMFAudioMFTManager.h
+++ b/dom/media/fmp4/wmf/WMFAudioMFTManager.h
@@ -12,17 +12,17 @@
 #include "MFTDecoder.h"
 #include "mozilla/RefPtr.h"
 #include "WMFMediaDataDecoder.h"
 
 namespace mozilla {
 
 class WMFAudioMFTManager : public MFTManager {
 public:
-  WMFAudioMFTManager(const mp4_demuxer::AudioDecoderConfig& aConfig);
+  WMFAudioMFTManager(const AudioInfo& aConfig);
   ~WMFAudioMFTManager();
 
   virtual TemporaryRef<MFTDecoder> Init() override;
 
   virtual HRESULT Input(MediaRawData* aSample) override;
 
   // Note WMF's AAC decoder sometimes output negatively timestamped samples,
   // presumably they're the preroll samples, and we strip them. We may return
--- a/dom/media/fmp4/wmf/WMFDecoderModule.cpp
+++ b/dom/media/fmp4/wmf/WMFDecoderModule.cpp
@@ -13,16 +13,17 @@
 #include "mozilla/DebugOnly.h"
 #include "WMFMediaDataDecoder.h"
 #include "nsIWindowsRegKey.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIGfxInfo.h"
 #include "GfxDriverInfo.h"
 #include "gfxWindowsPlatform.h"
+#include "MediaInfo.h"
 
 namespace mozilla {
 
 bool WMFDecoderModule::sIsWMFEnabled = false;
 bool WMFDecoderModule::sDXVAEnabled = false;
 
 WMFDecoderModule::WMFDecoderModule()
 {
@@ -59,66 +60,66 @@ WMFDecoderModule::Startup()
   if (FAILED(wmf::MFStartup())) {
     NS_WARNING("Failed to initialize Windows Media Foundation");
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 already_AddRefed<MediaDataDecoder>
-WMFDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+WMFDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
                                      layers::LayersBackend aLayersBackend,
                                      layers::ImageContainer* aImageContainer,
                                      FlushableMediaTaskQueue* aVideoTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
   nsRefPtr<MediaDataDecoder> decoder =
     new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
                                                    aLayersBackend,
                                                    aImageContainer,
                                                    sDXVAEnabled && ShouldUseDXVA(aConfig)),
                             aVideoTaskQueue,
                             aCallback);
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
-WMFDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+WMFDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
                                      FlushableMediaTaskQueue* aAudioTaskQueue,
                                      MediaDataDecoderCallback* aCallback)
 {
   nsRefPtr<MediaDataDecoder> decoder =
     new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig),
                             aAudioTaskQueue,
                             aCallback);
   return decoder.forget();
 }
 
 bool
-WMFDecoderModule::ShouldUseDXVA(const mp4_demuxer::VideoDecoderConfig& aConfig) const
+WMFDecoderModule::ShouldUseDXVA(const VideoInfo& aConfig) const
 {
   static bool isAMD = false;
   static bool initialized = false;
   if (!initialized) {
     nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
     nsAutoString vendor;
     gfxInfo->GetAdapterVendorID(vendor);
     isAMD = vendor.Equals(widget::GfxDriverInfo::GetDeviceVendor(widget::VendorAMD), nsCaseInsensitiveStringComparator()) ||
             vendor.Equals(widget::GfxDriverInfo::GetDeviceVendor(widget::VendorATI), nsCaseInsensitiveStringComparator());
     initialized = true;
   }
   if (!isAMD) {
     return true;
   }
   // Don't use DXVA for 4k videos or above, since it seems to perform poorly.
-  return aConfig.display_height <= 1920 && aConfig.display_height <= 1200;
+  return aConfig.mDisplay.width <= 1920 && aConfig.mDisplay.height <= 1200;
 }
 
 bool
-WMFDecoderModule::SupportsSharedDecoders(const mp4_demuxer::VideoDecoderConfig& aConfig) const
+WMFDecoderModule::SupportsSharedDecoders(const VideoInfo& aConfig) const
 {
   // If DXVA is enabled, but we're not going to use it for this specific config, then
   // we can't use the shared decoder.
   return !sDXVAEnabled || ShouldUseDXVA(aConfig);
 }
 
 bool
 WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType)
@@ -127,21 +128,21 @@ WMFDecoderModule::SupportsMimeType(const
          aMimeType.EqualsLiteral("video/avc") ||
          aMimeType.EqualsLiteral("video/webm; codecs=vp8") ||
          aMimeType.EqualsLiteral("video/webm; codecs=vp9") ||
          aMimeType.EqualsLiteral("audio/mp4a-latm") ||
          aMimeType.EqualsLiteral("audio/mpeg");
 }
 
 PlatformDecoderModule::ConversionRequired
-WMFDecoderModule::DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const
+WMFDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
-  if (aConfig.IsVideoConfig() &&
-      (aConfig.mime_type.EqualsLiteral("video/avc") ||
-       aConfig.mime_type.EqualsLiteral("video/mp4"))) {
+  if (aConfig.IsVideo() &&
+      (aConfig.mMimeType.EqualsLiteral("video/avc") ||
+       aConfig.mMimeType.EqualsLiteral("video/mp4"))) {
     return kNeedAnnexB;
   } else {
     return kNeedNone;
   }
 }
 
 static bool
 ClassesRootRegKeyExists(const nsAString& aRegKeyPath)
--- a/dom/media/fmp4/wmf/WMFDecoderModule.h
+++ b/dom/media/fmp4/wmf/WMFDecoderModule.h
@@ -15,50 +15,50 @@ class WMFDecoderModule : public Platform
 public:
   WMFDecoderModule();
   virtual ~WMFDecoderModule();
 
   // Initializes the module, loads required dynamic libraries, etc.
   virtual nsresult Startup() override;
 
   virtual already_AddRefed<MediaDataDecoder>
-  CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableMediaTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   virtual already_AddRefed<MediaDataDecoder>
-  CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
+  CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableMediaTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override;
 
   bool SupportsMimeType(const nsACString& aMimeType) override;
 
   virtual void DisableHardwareAcceleration() override
   {
     sDXVAEnabled = false;
   }
 
-  virtual bool SupportsSharedDecoders(const mp4_demuxer::VideoDecoderConfig& aConfig) const override;
+  virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const override;
 
   virtual ConversionRequired
-  DecoderNeedsConversion(const mp4_demuxer::TrackConfig& aConfig) const override;
+  DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 
   // Accessors that report whether we have the required MFTs available
   // on the system to play various codecs. Windows Vista doesn't have the
   // H.264/AAC decoders if the "Platform Update Supplement for Windows Vista"
   // is not installed.
   static bool HasAAC();
   static bool HasH264();
 
   // Called on main thread.
   static void Init();
 private:
-  bool ShouldUseDXVA(const mp4_demuxer::VideoDecoderConfig& aConfig) const;
+  bool ShouldUseDXVA(const VideoInfo& aConfig) const;
 
   static bool sIsWMFEnabled;
   static bool sDXVAEnabled;
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/fmp4/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/fmp4/wmf/WMFVideoMFTManager.cpp
@@ -9,18 +9,17 @@
 #include "MediaDecoderReader.h"
 #include "WMFUtils.h"
 #include "ImageContainer.h"
 #include "VideoUtils.h"
 #include "DXVA2Manager.h"
 #include "nsThreadUtils.h"
 #include "Layers.h"
 #include "mozilla/layers/LayersTypes.h"
-#include "mp4_demuxer/AnnexB.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "prlog.h"
 #include "gfx2DGlue.h"
 #include "gfxWindowsPlatform.h"
 #include "IMFYCbCrImage.h"
 #include "mozilla/WindowsVersion.h"
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* GetDemuxerLog();
@@ -65,37 +64,37 @@ const CLSID CLSID_WebmMfVp9Dec =
   0x1979,
   0x4fcd,
   {0xa6, 0x97, 0xdf, 0x9a, 0xd1, 0x5b, 0x34, 0xfe}
 };
 
 namespace mozilla {
 
 WMFVideoMFTManager::WMFVideoMFTManager(
-                            const mp4_demuxer::VideoDecoderConfig& aConfig,
+                            const VideoInfo& aConfig,
                             mozilla::layers::LayersBackend aLayersBackend,
                             mozilla::layers::ImageContainer* aImageContainer,
                             bool aDXVAEnabled)
   : mImageContainer(aImageContainer)
   , mDXVAEnabled(aDXVAEnabled)
   , mLayersBackend(aLayersBackend)
   // mVideoStride, mVideoWidth, mVideoHeight, mUseHwAccel are initialized in
   // Init().
 {
   NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
   MOZ_ASSERT(mImageContainer);
   MOZ_COUNT_CTOR(WMFVideoMFTManager);
 
   // Need additional checks/params to check vp8/vp9
-  if (aConfig.mime_type.EqualsLiteral("video/mp4") ||
-      aConfig.mime_type.EqualsLiteral("video/avc")) {
+  if (aConfig.mMimeType.EqualsLiteral("video/mp4") ||
+      aConfig.mMimeType.EqualsLiteral("video/avc")) {
     mStreamType = H264;
-  } else if (aConfig.mime_type.EqualsLiteral("video/webm; codecs=vp8")) {
+  } else if (aConfig.mMimeType.EqualsLiteral("video/webm; codecs=vp8")) {
     mStreamType = VP8;
-  } else if (aConfig.mime_type.EqualsLiteral("video/webm; codecs=vp9")) {
+  } else if (aConfig.mMimeType.EqualsLiteral("video/webm; codecs=vp9")) {
     mStreamType = VP9;
   } else {
     mStreamType = Unknown;
   }
 }
 
 WMFVideoMFTManager::~WMFVideoMFTManager()
 {
--- a/dom/media/fmp4/wmf/WMFVideoMFTManager.h
+++ b/dom/media/fmp4/wmf/WMFVideoMFTManager.h
@@ -15,17 +15,17 @@
 #include "mozilla/RefPtr.h"
 
 namespace mozilla {
 
 class DXVA2Manager;
 
 class WMFVideoMFTManager : public MFTManager {
 public:
-  WMFVideoMFTManager(const mp4_demuxer::VideoDecoderConfig& aConfig,
+  WMFVideoMFTManager(const VideoInfo& aConfig,
                      mozilla::layers::LayersBackend aLayersBackend,
                      mozilla::layers::ImageContainer* aImageContainer,
                      bool aDXVAEnabled);
   ~WMFVideoMFTManager();
 
   virtual TemporaryRef<MFTDecoder> Init() override;
 
   virtual HRESULT Input(MediaRawData* aSample) override;
--- a/dom/media/fmp4/wrappers/H264Converter.cpp
+++ b/dom/media/fmp4/wrappers/H264Converter.cpp
@@ -2,30 +2,25 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "H264Converter.h"
 #include "ImageContainer.h"
 #include "MediaTaskQueue.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "mp4_demuxer/AnnexB.h"
 #include "mp4_demuxer/H264.h"
 
 namespace mozilla
 {
 
-  // H264 AnnexB or AVCC handler
-#include "mp4_demuxer/DecoderData.h"
-#include "mp4_demuxer/AnnexB.h"
-#include "mp4_demuxer/H264.h"
-
 H264Converter::H264Converter(PlatformDecoderModule* aPDM,
-                             const mp4_demuxer::VideoDecoderConfig& aConfig,
+                             const VideoInfo& aConfig,
                              layers::LayersBackend aLayersBackend,
                              layers::ImageContainer* aImageContainer,
                              FlushableMediaTaskQueue* aVideoTaskQueue,
                              MediaDataDecoderCallback* aCallback)
   : mPDM(aPDM)
   , mCurrentConfig(aConfig)
   , mLayersBackend(aLayersBackend)
   , mImageContainer(aImageContainer)
@@ -74,17 +69,17 @@ H264Converter::Input(MediaRawData* aSamp
       // Ignore for the time being, the MediaRawData will be dropped.
       return NS_OK;
     }
   } else {
     rv = CheckForSPSChange(aSample);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
-  aSample->mExtraData = mCurrentConfig.extra_data;
+  aSample->mExtraData = mCurrentConfig.mExtraData;
 
   return mDecoder->Input(aSample);
 }
 
 nsresult
 H264Converter::Flush()
 {
   if (mDecoder) {
@@ -129,21 +124,21 @@ H264Converter::IsHardwareAccelerated() c
     return mDecoder->IsHardwareAccelerated();
   }
   return MediaDataDecoder::IsHardwareAccelerated();
 }
 
 nsresult
 H264Converter::CreateDecoder()
 {
-  if (mNeedAVCC && !mp4_demuxer::AnnexB::HasSPS(mCurrentConfig.extra_data)) {
+  if (mNeedAVCC && !mp4_demuxer::AnnexB::HasSPS(mCurrentConfig.mExtraData)) {
     // nothing found yet, will try again later
     return NS_ERROR_NOT_INITIALIZED;
   }
-  UpdateConfigFromExtraData(mCurrentConfig.extra_data);
+  UpdateConfigFromExtraData(mCurrentConfig.mExtraData);
 
   mDecoder = mPDM->CreateVideoDecoder(mCurrentConfig,
                                       mLayersBackend,
                                       mImageContainer,
                                       mVideoTaskQueue,
                                       mCallback);
   if (!mDecoder) {
     mLastError = NS_ERROR_FAILURE;
@@ -169,17 +164,17 @@ H264Converter::CreateDecoderAndInit(Medi
 
 nsresult
 H264Converter::CheckForSPSChange(MediaRawData* aSample)
 {
   nsRefPtr<DataBuffer> extra_data =
     mp4_demuxer::AnnexB::ExtractExtraData(aSample);
   if (!mp4_demuxer::AnnexB::HasSPS(extra_data) ||
       mp4_demuxer::AnnexB::CompareExtraData(extra_data,
-                                            mCurrentConfig.extra_data)) {
+                                            mCurrentConfig.mExtraData)) {
         return NS_OK;
       }
   if (!mNeedAVCC) {
     UpdateConfigFromExtraData(extra_data);
     mDecoder->ConfigurationChanged(mCurrentConfig);
     return NS_OK;
   }
   // The SPS has changed, signal to flush the current decoder and create a
@@ -191,25 +186,25 @@ H264Converter::CheckForSPSChange(MediaRa
 
 void
 H264Converter::UpdateConfigFromExtraData(DataBuffer* aExtraData)
 {
   mp4_demuxer::SPSData spsdata;
   if (mp4_demuxer::H264::DecodeSPSFromExtraData(aExtraData, spsdata) &&
       spsdata.pic_width > 0 && spsdata.pic_height > 0) {
     mp4_demuxer::H264::EnsureSPSIsSane(spsdata);
-    mCurrentConfig.image_width = spsdata.pic_width;
-    mCurrentConfig.image_height = spsdata.pic_height;
-    mCurrentConfig.display_width = spsdata.display_width;
-    mCurrentConfig.display_height = spsdata.display_height;
+    mCurrentConfig.mImage.width = spsdata.pic_width;
+    mCurrentConfig.mImage.height = spsdata.pic_height;
+    mCurrentConfig.mDisplay.width = spsdata.display_width;
+    mCurrentConfig.mDisplay.height = spsdata.display_height;
   }
-  mCurrentConfig.extra_data = aExtraData;
+  mCurrentConfig.mExtraData = aExtraData;
 }
 
 /* static */
 bool
-H264Converter::IsH264(const mp4_demuxer::TrackConfig& aConfig)
+H264Converter::IsH264(const TrackInfo& aConfig)
 {
-  return aConfig.mime_type.EqualsLiteral("video/avc") ||
-    aConfig.mime_type.EqualsLiteral("video/mp4");
+  return aConfig.mMimeType.EqualsLiteral("video/avc") ||
+    aConfig.mMimeType.EqualsLiteral("video/mp4");
 }
 
 } // namespace mozilla
--- a/dom/media/fmp4/wrappers/H264Converter.h
+++ b/dom/media/fmp4/wrappers/H264Converter.h
@@ -17,45 +17,45 @@ namespace mozilla {
 // provided in the init segment (e.g. AVC3 or Annex B)
 // H264Converter will monitor the input data, and will delay creation of the
 // MediaDataDecoder until a SPS and PPS NALs have been extracted.
 
 class H264Converter : public MediaDataDecoder {
 public:
 
   H264Converter(PlatformDecoderModule* aPDM,
-                const mp4_demuxer::VideoDecoderConfig& aConfig,
+                const VideoInfo& aConfig,
                 layers::LayersBackend aLayersBackend,
                 layers::ImageContainer* aImageContainer,
                 FlushableMediaTaskQueue* aVideoTaskQueue,
                 MediaDataDecoderCallback* aCallback);
   virtual ~H264Converter();
 
   virtual nsresult Init() override;
   virtual nsresult Input(MediaRawData* aSample) override;
   virtual nsresult Flush() override;
   virtual nsresult Drain() override;
   virtual nsresult Shutdown() override;
   virtual bool IsWaitingMediaResources() override;
   virtual bool IsHardwareAccelerated() const override;
 
   // Return true if mimetype is H.264.
-  static bool IsH264(const mp4_demuxer::TrackConfig& aConfig);
+  static bool IsH264(const TrackInfo& aConfig);
 
 private:
   // Will create the required MediaDataDecoder if need AVCC and we have a SPS NAL.
   // Returns NS_ERROR_FAILURE if error is permanent and can't be recovered and
   // will set mError accordingly.
   nsresult CreateDecoder();
   nsresult CreateDecoderAndInit(MediaRawData* aSample);
   nsresult CheckForSPSChange(MediaRawData* aSample);
   void UpdateConfigFromExtraData(DataBuffer* aExtraData);
 
   nsRefPtr<PlatformDecoderModule> mPDM;
-  mp4_demuxer::VideoDecoderConfig mCurrentConfig;
+  VideoInfo mCurrentConfig;
   layers::LayersBackend mLayersBackend;
   nsRefPtr<layers::ImageContainer> mImageContainer;
   nsRefPtr<FlushableMediaTaskQueue> mVideoTaskQueue;
   MediaDataDecoderCallback* mCallback;
   nsRefPtr<MediaDataDecoder> mDecoder;
   bool mNeedAVCC;
   nsresult mLastError;
 };
--- a/dom/media/webm/IntelWebMVideoDecoder.cpp
+++ b/dom/media/webm/IntelWebMVideoDecoder.cpp
@@ -114,34 +114,34 @@ IntelWebMVideoDecoder::IsSupportedVideoM
 nsresult
 IntelWebMVideoDecoder::Init(unsigned int aWidth, unsigned int aHeight)
 {
   mPlatform = PlatformDecoderModule::Create();
   if (!mPlatform) {
     return NS_ERROR_FAILURE;
   }
 
-  mDecoderConfig = new VideoDecoderConfig();
-  mDecoderConfig->duration = 0;
-  mDecoderConfig->display_width = aWidth;
-  mDecoderConfig->display_height = aHeight;
+  mDecoderConfig = new VideoInfo();
+  mDecoderConfig->mDuration = 0;
+  mDecoderConfig->mDisplay.width = aWidth;
+  mDecoderConfig->mDisplay.height = aHeight;
 
   switch (mReader->GetVideoCodec()) {
   case NESTEGG_CODEC_VP8:
-    mDecoderConfig->mime_type = "video/webm; codecs=vp8";
+    mDecoderConfig->mMimeType = "video/webm; codecs=vp8";
     break;
   case NESTEGG_CODEC_VP9:
-    mDecoderConfig->mime_type = "video/webm; codecs=vp9";
+    mDecoderConfig->mMimeType = "video/webm; codecs=vp9";
     break;
   default:
     return NS_ERROR_FAILURE;
   }
 
-  const VideoDecoderConfig& video = *mDecoderConfig;
-  if (!IsSupportedVideoMimeType(video.mime_type)) {
+  const VideoInfo& video = *mDecoderConfig;
+  if (!IsSupportedVideoMimeType(video.mMimeType)) {
     return NS_ERROR_FAILURE;
   }
   mMediaDataDecoder =
     mPlatform->CreateDecoder(video,
                              mTaskQueue,
                              this,
                              mReader->GetLayersBackendType(),
                              mReader->GetDecoder()->GetImageContainer());
--- a/dom/media/webm/IntelWebMVideoDecoder.h
+++ b/dom/media/webm/IntelWebMVideoDecoder.h
@@ -9,17 +9,17 @@
 #include <stdint.h>
 
 #include "WebMReader.h"
 #include "nsAutoPtr.h"
 #include "PlatformDecoderModule.h"
 #include "mozilla/Monitor.h"
 
 #include "mp4_demuxer/mp4_demuxer.h"
-#include "mp4_demuxer/DecoderData.h"
+#include "MediaInfo.h"
 #include "MediaData.h"
 
 class MediaTaskQueue;
 
 namespace mozilla {
 
 class VP8Sample;
 
@@ -65,17 +65,17 @@ private:
 
   // TaskQueue on which decoder can choose to decode.
   // Only non-null up until the decoder is created.
   nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
 
   // Monitor that protects all non-threadsafe state; the primitives
   // that follow.
   Monitor mMonitor;
-  nsAutoPtr<mp4_demuxer::VideoDecoderConfig> mDecoderConfig;
+  nsAutoPtr<VideoInfo> mDecoderConfig;
 
   VP8SampleQueue mSampleQueue;
   nsRefPtr<VP8Sample> mQueuedVideoSample;
   uint64_t mNumSamplesInput;
   uint64_t mNumSamplesOutput;
   uint64_t mLastReportedNumDecodedFrames;
   uint32_t mDecodeAhead;
 
--- a/media/libstagefright/binding/DecoderData.cpp
+++ b/media/libstagefright/binding/DecoderData.cpp
@@ -98,76 +98,82 @@ CryptoFile::DoUpdate(const uint8_t* aDat
     if (!reader.ReadArray(psshInfo.data, length)) {
       return false;
     }
     pssh.AppendElement(psshInfo);
   }
   return true;
 }
 
-void
-TrackConfig::Update(const MetaData* aMetaData, const char* aMimeType)
+static void
+UpdateTrackInfo(mozilla::TrackInfo& aConfig,
+                const MetaData* aMetaData,
+                const char* aMimeType)
 {
-  mime_type = aMimeType;
-  duration = FindInt64(aMetaData, kKeyDuration);
-  media_time = FindInt64(aMetaData, kKeyMediaTime);
-  mTrackId = FindInt32(aMetaData, kKeyTrackID);
-  crypto.mValid = aMetaData->findInt32(kKeyCryptoMode, &crypto.mMode) &&
+  mozilla::CryptoTrack& crypto = aConfig.mCrypto;
+  aConfig.mMimeType = aMimeType;
+  aConfig.mDuration = FindInt64(aMetaData, kKeyDuration);
+  aConfig.mMediaTime = FindInt64(aMetaData, kKeyMediaTime);
+  aConfig.mTrackId = FindInt32(aMetaData, kKeyTrackID);
+  aConfig.mCrypto.mValid = aMetaData->findInt32(kKeyCryptoMode, &crypto.mMode) &&
     aMetaData->findInt32(kKeyCryptoDefaultIVSize, &crypto.mIVSize) &&
     FindData(aMetaData, kKeyCryptoKey, &crypto.mKeyId);
 }
 
 void
-AudioDecoderConfig::Update(const MetaData* aMetaData, const char* aMimeType)
+MP4AudioInfo::Update(const MetaData* aMetaData,
+                     const char* aMimeType)
 {
-  TrackConfig::Update(aMetaData, aMimeType);
-  channel_count = FindInt32(aMetaData, kKeyChannelCount);
-  bits_per_sample = FindInt32(aMetaData, kKeySampleSize);
-  samples_per_second = FindInt32(aMetaData, kKeySampleRate);
-  frequency_index = Adts::GetFrequencyIndex(samples_per_second);
-  aac_profile = FindInt32(aMetaData, kKeyAACProfile);
+  UpdateTrackInfo(*this, aMetaData, aMimeType);
+  mChannels = FindInt32(aMetaData, kKeyChannelCount);
+  mBitDepth = FindInt32(aMetaData, kKeySampleSize);
+  mRate = FindInt32(aMetaData, kKeySampleRate);
+  mProfile = FindInt32(aMetaData, kKeyAACProfile);
+  mHasAudio = true;
 
-  if (FindData(aMetaData, kKeyESDS, extra_data)) {
-    ESDS esds(extra_data->Elements(), extra_data->Length());
+  if (FindData(aMetaData, kKeyESDS, mExtraData)) {
+    ESDS esds(mExtraData->Elements(), mExtraData->Length());
 
     const void* data;
     size_t size;
     if (esds.getCodecSpecificInfo(&data, &size) == OK) {
       const uint8_t* cdata = reinterpret_cast<const uint8_t*>(data);
-      audio_specific_config->AppendElements(cdata, size);
+      mCodecSpecificConfig->AppendElements(cdata, size);
       if (size > 1) {
         ABitReader br(cdata, size);
-        extended_profile = br.getBits(5);
+        mExtendedProfile = br.getBits(5);
 
-        if (extended_profile == 31) {  // AAC-ELD => additional 6 bits
-          extended_profile = 32 + br.getBits(6);
+        if (mExtendedProfile == 31) {  // AAC-ELD => additional 6 bits
+          mExtendedProfile = 32 + br.getBits(6);
         }
       }
     }
   }
 }
 
 bool
-AudioDecoderConfig::IsValid()
+MP4AudioInfo::IsValid() const
 {
-  return channel_count > 0 && samples_per_second > 0 && frequency_index > 0 &&
-         (!mime_type.Equals(MEDIA_MIMETYPE_AUDIO_AAC) ||
-          aac_profile > 0 || extended_profile > 0);
+  return mChannels > 0 && mRate > 0 &&
+         (!mMimeType.Equals(MEDIA_MIMETYPE_AUDIO_AAC) ||
+          mProfile > 0 || mExtendedProfile > 0);
 }
 
 void
-VideoDecoderConfig::Update(const MetaData* aMetaData, const char* aMimeType)
+MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType)
 {
-  TrackConfig::Update(aMetaData, aMimeType);
-  display_width = FindInt32(aMetaData, kKeyDisplayWidth);
-  display_height = FindInt32(aMetaData, kKeyDisplayHeight);
-  image_width = FindInt32(aMetaData, kKeyWidth);
-  image_height = FindInt32(aMetaData, kKeyHeight);
+  UpdateTrackInfo(*this, aMetaData, aMimeType);
+  mDisplay.width = FindInt32(aMetaData, kKeyDisplayWidth);
+  mDisplay.height = FindInt32(aMetaData, kKeyDisplayHeight);
+  mImage.width = FindInt32(aMetaData, kKeyWidth);
+  mImage.height = FindInt32(aMetaData, kKeyHeight);
+  mHasVideo = true;
 
-  FindData(aMetaData, kKeyAVCC, extra_data);
+  FindData(aMetaData, kKeyAVCC, mExtraData);
 }
 
 bool
-VideoDecoderConfig::IsValid()
+MP4VideoInfo::IsValid() const
 {
-  return display_width > 0 && display_height > 0;
+  return mDisplay.width > 0 && mDisplay.height > 0;
 }
+
 }
--- a/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
@@ -1,16 +1,17 @@
 /* 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 DECODER_DATA_H_
 #define DECODER_DATA_H_
 
 #include "MediaData.h"
+#include "MediaInfo.h"
 #include "mozilla/Types.h"
 #include "mozilla/Vector.h"
 #include "nsRefPtr.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsString.h"
 
 namespace stagefright
@@ -47,106 +48,34 @@ public:
 
   bool valid;
   nsTArray<PsshInfo> pssh;
 
 private:
   bool DoUpdate(const uint8_t* aData, size_t aLength);
 };
 
-class TrackConfig
+class MP4AudioInfo : public mozilla::AudioInfo
 {
 public:
-  enum TrackType {
-    kUndefinedTrack,
-    kAudioTrack,
-    kVideoTrack,
-  };
-  explicit TrackConfig(TrackType aType)
-    : mTrackId(0)
-    , duration(0)
-    , media_time(0)
-    , mType(aType)
-  {
-  }
-
-  nsAutoCString mime_type;
-  uint32_t mTrackId;
-  int64_t duration;
-  int64_t media_time;
-  mozilla::CryptoTrack crypto;
-  TrackType mType;
-
-  bool IsAudioConfig() const
-  {
-    return mType == kAudioTrack;
-  }
-  bool IsVideoConfig() const
-  {
-    return mType == kVideoTrack;
-  }
-  void Update(const stagefright::MetaData* aMetaData,
-              const char* aMimeType);
-};
-
-class AudioDecoderConfig : public TrackConfig
-{
-public:
-  AudioDecoderConfig()
-    : TrackConfig(kAudioTrack)
-    , channel_count(0)
-    , bits_per_sample(0)
-    , samples_per_second(0)
-    , frequency_index(0)
-    , aac_profile(0)
-    , extended_profile(0)
-    , extra_data(new mozilla::DataBuffer)
-    , audio_specific_config(new mozilla::DataBuffer)
-  {
-  }
-
-  uint32_t channel_count;
-  uint32_t bits_per_sample;
-  uint32_t samples_per_second;
-  int8_t frequency_index;
-  int8_t aac_profile;
-  int8_t extended_profile;
-  nsRefPtr<mozilla::DataBuffer> extra_data;
-  nsRefPtr<mozilla::DataBuffer> audio_specific_config;
+  MP4AudioInfo() = default;
 
   void Update(const stagefright::MetaData* aMetaData,
               const char* aMimeType);
-  bool IsValid();
 
-private:
-  friend class MP4Demuxer;
+  virtual bool IsValid() const override;
 };
 
-class VideoDecoderConfig : public TrackConfig
+class MP4VideoInfo : public mozilla::VideoInfo
 {
 public:
-  VideoDecoderConfig()
-    : TrackConfig(kVideoTrack)
-    , display_width(0)
-    , display_height(0)
-    , image_width(0)
-    , image_height(0)
-    , extra_data(new mozilla::DataBuffer)
-  {
-  }
-
-  int32_t display_width;
-  int32_t display_height;
-
-  int32_t image_width;
-  int32_t image_height;
-
-  nsRefPtr<mozilla::DataBuffer> extra_data;   // Unparsed AVCDecoderConfig payload.
+  MP4VideoInfo() = default;
 
   void Update(const stagefright::MetaData* aMetaData,
               const char* aMimeType);
-  bool IsValid();
+
+  virtual bool IsValid() const override;
 };
 
 typedef int64_t Microseconds;
 }
 
 #endif
--- a/media/libstagefright/binding/include/mp4_demuxer/mp4_demuxer.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/mp4_demuxer.h
@@ -58,18 +58,18 @@ public:
   void SeekVideo(Microseconds aTime);
 
   // DemuxAudioSample and DemuxVideoSample functions
   // return nullptr on end of stream or error.
   already_AddRefed<mozilla::MediaRawData> DemuxAudioSample();
   already_AddRefed<mozilla::MediaRawData> DemuxVideoSample();
 
   const CryptoFile& Crypto() { return mCrypto; }
-  const AudioDecoderConfig& AudioConfig() { return mAudioConfig; }
-  const VideoDecoderConfig& VideoConfig() { return mVideoConfig; }
+  const mozilla::AudioInfo& AudioConfig() { return mAudioConfig; }
+  const mozilla::VideoInfo& VideoConfig() { return mVideoConfig; }
 
   void UpdateIndex(const nsTArray<mozilla::MediaByteRange>& aByteRanges);
 
   void ConvertByteRangesToTime(
     const nsTArray<mozilla::MediaByteRange>& aByteRanges,
     nsTArray<Interval<Microseconds>>* aIntervals);
 
   int64_t GetEvictionOffset(Microseconds aTime);
@@ -78,18 +78,18 @@ public:
   // report this.
   Microseconds GetNextKeyframeTime();
 
 protected:
   ~MP4Demuxer();
 
 private:
   void UpdateCrypto(const stagefright::MetaData* aMetaData);
-  AudioDecoderConfig mAudioConfig;
-  VideoDecoderConfig mVideoConfig;
+  MP4AudioInfo mAudioConfig;
+  MP4VideoInfo mVideoConfig;
   CryptoFile mCrypto;
 
   nsAutoPtr<StageFrightPrivate> mPrivate;
   nsRefPtr<Stream> mSource;
   nsTArray<mozilla::MediaByteRange> mCachedByteRanges;
   nsTArray<Interval<Microseconds>> mCachedTimeRanges;
   Monitor* mMonitor;
   Microseconds mNextKeyframeTime;
--- a/media/libstagefright/binding/mp4_demuxer.cpp
+++ b/media/libstagefright/binding/mp4_demuxer.cpp
@@ -136,20 +136,20 @@ MP4Demuxer::Init()
       mPrivate->mIndexes.AppendElement(index);
       mPrivate->mVideoIterator = new SampleIterator(index);
     }
   }
   sp<MetaData> metaData = e->getMetaData();
   UpdateCrypto(metaData.get());
 
   int64_t movieDuration;
-  if (!mVideoConfig.duration && !mAudioConfig.duration &&
+  if (!mVideoConfig.mDuration && !mAudioConfig.mDuration &&
       metaData->findInt64(kKeyMovieDuration, &movieDuration)) {
     // No duration were found in either tracks, use movie extend header box one.
-    mVideoConfig.duration = mAudioConfig.duration = movieDuration;
+    mVideoConfig.mDuration = mAudioConfig.mDuration = movieDuration;
   }
   mPrivate->mCanSeek = e->flags() & MediaExtractor::CAN_SEEK;
 
   return mPrivate->mAudio.get() || mPrivate->mVideo.get();
 }
 
 void
 MP4Demuxer::UpdateCrypto(const MetaData* aMetaData)
@@ -179,17 +179,17 @@ MP4Demuxer::HasValidVideo()
   mMonitor->AssertCurrentThreadOwns();
   return mPrivate->mVideo.get() && mVideoConfig.IsValid();
 }
 
 Microseconds
 MP4Demuxer::Duration()
 {
   mMonitor->AssertCurrentThreadOwns();
-  return std::max(mVideoConfig.duration, mAudioConfig.duration);
+  return std::max(mVideoConfig.mDuration, mAudioConfig.mDuration);
 }
 
 bool
 MP4Demuxer::CanSeek()
 {
   mMonitor->AssertCurrentThreadOwns();
   return mPrivate->mCanSeek;
 }
@@ -218,38 +218,38 @@ MP4Demuxer::DemuxAudioSample()
   mMonitor->AssertCurrentThreadOwns();
   if (!mPrivate->mAudioIterator) {
     return nullptr;
   }
   nsRefPtr<mozilla::MediaRawData> sample(mPrivate->mAudioIterator->GetNext());
   if (sample) {
     if (sample->mCrypto.mValid) {
       nsAutoPtr<MediaRawDataWriter> writer(sample->CreateWriter());
-      writer->mCrypto.mMode = mAudioConfig.crypto.mMode;
-      writer->mCrypto.mIVSize = mAudioConfig.crypto.mIVSize;
-      writer->mCrypto.mKeyId.AppendElements(mAudioConfig.crypto.mKeyId);
+      writer->mCrypto.mMode = mAudioConfig.mCrypto.mMode;
+      writer->mCrypto.mIVSize = mAudioConfig.mCrypto.mIVSize;
+      writer->mCrypto.mKeyId.AppendElements(mAudioConfig.mCrypto.mKeyId);
     }
   }
   return sample.forget();
 }
 
 already_AddRefed<MediaRawData>
 MP4Demuxer::DemuxVideoSample()
 {
   mMonitor->AssertCurrentThreadOwns();
   if (!mPrivate->mVideoIterator) {
     return nullptr;
   }
   nsRefPtr<mozilla::MediaRawData> sample(mPrivate->mVideoIterator->GetNext());
   if (sample) {
-    sample->mExtraData = mVideoConfig.extra_data;
+    sample->mExtraData = mVideoConfig.mExtraData;
     if (sample->mCrypto.mValid) {
       nsAutoPtr<MediaRawDataWriter> writer(sample->CreateWriter());
-      writer->mCrypto.mMode = mVideoConfig.crypto.mMode;
-      writer->mCrypto.mKeyId.AppendElements(mVideoConfig.crypto.mKeyId);
+      writer->mCrypto.mMode = mVideoConfig.mCrypto.mMode;
+      writer->mCrypto.mKeyId.AppendElements(mVideoConfig.mCrypto.mKeyId);
     }
     if (sample->mTime >= mNextKeyframeTime) {
       mNextKeyframeTime = mPrivate->mVideoIterator->GetNextKeyframeTime();
     }
   }
   return sample.forget();
 }