From d3b4671c043fea7120902da7d60e1ad22249a70d Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Thu, 10 Jul 2014 09:25:10 +1200 Subject: [PATCH] Bug 1016148 - Rename WMFOutputSource and friends to MFTManager, since it now handles input as well as output. r=padenot --HG-- rename : content/media/fmp4/wmf/WMFAudioOutputSource.cpp => content/media/fmp4/wmf/WMFAudioMFTManager.cpp rename : content/media/fmp4/wmf/WMFAudioOutputSource.h => content/media/fmp4/wmf/WMFAudioMFTManager.h rename : content/media/fmp4/wmf/WMFVideoOutputSource.cpp => content/media/fmp4/wmf/WMFVideoMFTManager.cpp rename : content/media/fmp4/wmf/WMFVideoOutputSource.h => content/media/fmp4/wmf/WMFVideoMFTManager.h --- content/media/fmp4/moz.build | 8 ++--- ...utputSource.cpp => WMFAudioMFTManager.cpp} | 18 +++++----- ...dioOutputSource.h => WMFAudioMFTManager.h} | 6 ++-- content/media/fmp4/wmf/WMFDecoderModule.cpp | 14 ++++---- .../media/fmp4/wmf/WMFMediaDataDecoder.cpp | 12 +++---- content/media/fmp4/wmf/WMFMediaDataDecoder.h | 12 +++---- ...utputSource.cpp => WMFVideoMFTManager.cpp} | 36 +++++++++---------- ...deoOutputSource.h => WMFVideoMFTManager.h} | 18 +++++----- 8 files changed, 62 insertions(+), 62 deletions(-) rename content/media/fmp4/wmf/{WMFAudioOutputSource.cpp => WMFAudioMFTManager.cpp} (95%) rename content/media/fmp4/wmf/{WMFAudioOutputSource.h => WMFAudioMFTManager.h} (92%) rename content/media/fmp4/wmf/{WMFVideoOutputSource.cpp => WMFVideoMFTManager.cpp} (92%) rename content/media/fmp4/wmf/{WMFVideoOutputSource.h => WMFVideoMFTManager.h} (79%) diff --git a/content/media/fmp4/moz.build b/content/media/fmp4/moz.build index a0505ff82b3..e7a9f438237 100644 --- a/content/media/fmp4/moz.build +++ b/content/media/fmp4/moz.build @@ -23,17 +23,17 @@ SOURCES += [ if CONFIG['MOZ_WMF']: EXPORTS += [ 'wmf/MFTDecoder.h', - 'wmf/WMFAudioOutputSource.h', + 'wmf/WMFAudioMFTManager.h', 'wmf/WMFDecoderModule.h', 'wmf/WMFMediaDataDecoder.h', - 'wmf/WMFVideoOutputSource.h', + 'wmf/WMFVideoMFTManager.h', ] UNIFIED_SOURCES += [ 'wmf/MFTDecoder.cpp', - 'wmf/WMFAudioOutputSource.cpp', + 'wmf/WMFAudioMFTManager.cpp', 'wmf/WMFDecoderModule.cpp', 'wmf/WMFMediaDataDecoder.cpp', - 'wmf/WMFVideoOutputSource.cpp', + 'wmf/WMFVideoMFTManager.cpp', ] if CONFIG['MOZ_FFMPEG']: diff --git a/content/media/fmp4/wmf/WMFAudioOutputSource.cpp b/content/media/fmp4/wmf/WMFAudioMFTManager.cpp similarity index 95% rename from content/media/fmp4/wmf/WMFAudioOutputSource.cpp rename to content/media/fmp4/wmf/WMFAudioMFTManager.cpp index 829176b7c77..098b96dedc8 100644 --- a/content/media/fmp4/wmf/WMFAudioOutputSource.cpp +++ b/content/media/fmp4/wmf/WMFAudioMFTManager.cpp @@ -4,7 +4,7 @@ * 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 "WMFAudioOutputSource.h" +#include "WMFAudioMFTManager.h" #include "mp4_demuxer/DecoderData.h" #include "VideoUtils.h" #include "WMFUtils.h" @@ -66,7 +66,7 @@ AACAudioSpecificConfigToUserData(const uint8_t* aAudioSpecConfig, aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength); } -WMFAudioOutputSource::WMFAudioOutputSource( +WMFAudioMFTManager::WMFAudioMFTManager( const mp4_demuxer::AudioDecoderConfig& aConfig) : mAudioChannels(aConfig.channel_count) , mAudioBytesPerSample(aConfig.bits_per_sample / 8) @@ -75,19 +75,19 @@ WMFAudioOutputSource::WMFAudioOutputSource( , mAudioFrameSum(0) , mMustRecaptureAudioPosition(true) { - MOZ_COUNT_CTOR(WMFAudioOutputSource); + MOZ_COUNT_CTOR(WMFAudioMFTManager); AACAudioSpecificConfigToUserData(&aConfig.audio_specific_config[0], aConfig.audio_specific_config.length(), mUserData); } -WMFAudioOutputSource::~WMFAudioOutputSource() +WMFAudioMFTManager::~WMFAudioMFTManager() { - MOZ_COUNT_DTOR(WMFAudioOutputSource); + MOZ_COUNT_DTOR(WMFAudioMFTManager); } TemporaryRef -WMFAudioOutputSource::Init() +WMFAudioMFTManager::Init() { RefPtr decoder(new MFTDecoder()); @@ -129,7 +129,7 @@ WMFAudioOutputSource::Init() } HRESULT -WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample) +WMFAudioMFTManager::Input(mp4_demuxer::MP4Sample* aSample) { const uint8_t* data = reinterpret_cast(aSample->data); uint32_t length = aSample->size; @@ -137,8 +137,8 @@ WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample) } HRESULT -WMFAudioOutputSource::Output(int64_t aStreamOffset, - nsAutoPtr& aOutData) +WMFAudioMFTManager::Output(int64_t aStreamOffset, + nsAutoPtr& aOutData) { aOutData = nullptr; RefPtr sample; diff --git a/content/media/fmp4/wmf/WMFAudioOutputSource.h b/content/media/fmp4/wmf/WMFAudioMFTManager.h similarity index 92% rename from content/media/fmp4/wmf/WMFAudioOutputSource.h rename to content/media/fmp4/wmf/WMFAudioMFTManager.h index e3298057f69..9caff24e3c3 100644 --- a/content/media/fmp4/wmf/WMFAudioOutputSource.h +++ b/content/media/fmp4/wmf/WMFAudioMFTManager.h @@ -15,10 +15,10 @@ namespace mozilla { -class WMFAudioOutputSource : public WMFOutputSource { +class WMFAudioMFTManager : public MFTManager { public: - WMFAudioOutputSource(const mp4_demuxer::AudioDecoderConfig& aConfig); - ~WMFAudioOutputSource(); + WMFAudioMFTManager(const mp4_demuxer::AudioDecoderConfig& aConfig); + ~WMFAudioMFTManager(); virtual TemporaryRef Init() MOZ_OVERRIDE; diff --git a/content/media/fmp4/wmf/WMFDecoderModule.cpp b/content/media/fmp4/wmf/WMFDecoderModule.cpp index 6542a1ba476..6cfa495135a 100644 --- a/content/media/fmp4/wmf/WMFDecoderModule.cpp +++ b/content/media/fmp4/wmf/WMFDecoderModule.cpp @@ -7,8 +7,8 @@ #include "WMF.h" #include "WMFDecoderModule.h" #include "WMFDecoder.h" -#include "WMFVideoOutputSource.h" -#include "WMFAudioOutputSource.h" +#include "WMFVideoMFTManager.h" +#include "WMFAudioMFTManager.h" #include "mozilla/Preferences.h" #include "mozilla/DebugOnly.h" #include "WMFMediaDataDecoder.h" @@ -70,10 +70,10 @@ WMFDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConf MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { - return new WMFMediaDataDecoder(new WMFVideoOutputSource(aConfig, - aLayersBackend, - aImageContainer, - sDXVAEnabled), + return new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig, + aLayersBackend, + aImageContainer, + sDXVAEnabled), aVideoTaskQueue, aCallback); } @@ -83,7 +83,7 @@ WMFDecoderModule::CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfi MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { - return new WMFMediaDataDecoder(new WMFAudioOutputSource(aConfig), + return new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig), aAudioTaskQueue, aCallback); } diff --git a/content/media/fmp4/wmf/WMFMediaDataDecoder.cpp b/content/media/fmp4/wmf/WMFMediaDataDecoder.cpp index b2c7df625ec..3b7347422bc 100644 --- a/content/media/fmp4/wmf/WMFMediaDataDecoder.cpp +++ b/content/media/fmp4/wmf/WMFMediaDataDecoder.cpp @@ -21,12 +21,12 @@ PRLogModuleInfo* GetDemuxerLog(); namespace mozilla { -WMFMediaDataDecoder::WMFMediaDataDecoder(WMFOutputSource* aSource, +WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager, MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback) : mTaskQueue(aTaskQueue) , mCallback(aCallback) - , mSource(aSource) + , mMFTManager(aMFTManager) { MOZ_COUNT_CTOR(WMFMediaDataDecoder); } @@ -39,7 +39,7 @@ WMFMediaDataDecoder::~WMFMediaDataDecoder() nsresult WMFMediaDataDecoder::Init() { - mDecoder = mSource->Init(); + mDecoder = mMFTManager->Init(); NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE); return NS_OK; @@ -67,9 +67,9 @@ WMFMediaDataDecoder::Input(mp4_demuxer::MP4Sample* aSample) void WMFMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample) { - HRESULT hr = mSource->Input(aSample); + HRESULT hr = mMFTManager->Input(aSample); if (FAILED(hr)) { - NS_WARNING("WMFOutputSource rejected sample"); + NS_WARNING("MFTManager rejected sample"); mCallback->Error(); return; } @@ -84,7 +84,7 @@ WMFMediaDataDecoder::ProcessOutput() { nsAutoPtr output; HRESULT hr = S_OK; - while (SUCCEEDED(hr = mSource->Output(mLastStreamOffset, output)) && + while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) && output) { mCallback->Output(output.forget()); } diff --git a/content/media/fmp4/wmf/WMFMediaDataDecoder.h b/content/media/fmp4/wmf/WMFMediaDataDecoder.h index c0b61432814..71630db80c0 100644 --- a/content/media/fmp4/wmf/WMFMediaDataDecoder.h +++ b/content/media/fmp4/wmf/WMFMediaDataDecoder.h @@ -22,9 +22,9 @@ namespace mozilla { // Encapsulates the initialization of the MFTDecoder appropriate for decoding // a given stream, and the process of converting the IMFSample produced // by the MFT into a MediaData object. -class WMFOutputSource { +class MFTManager { public: - virtual ~WMFOutputSource() {} + virtual ~MFTManager() {} // Creates an initializs the MFTDecoder. // Returns nullptr on failure. @@ -46,13 +46,13 @@ public: }; // Decodes audio and video using Windows Media Foundation. Samples are decoded -// using the MFTDecoder created by the WMFOutputSource. This class implements +// using the MFTDecoder created by the MFTManager. This class implements // the higher-level logic that drives mapping the MFT to the async // MediaDataDecoder interface. The specifics of decoding the exact stream -// type are handled by WMFOutputSource and the MFTDecoder it creates. +// type are handled by MFTManager and the MFTDecoder it creates. class WMFMediaDataDecoder : public MediaDataDecoder { public: - WMFMediaDataDecoder(WMFOutputSource* aOutputSource, + WMFMediaDataDecoder(MFTManager* aOutputSource, MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback); ~WMFMediaDataDecoder(); @@ -85,7 +85,7 @@ private: MediaDataDecoderCallback* mCallback; RefPtr mDecoder; - nsAutoPtr mSource; + nsAutoPtr mMFTManager; // The last offset into the media resource that was passed into Input(). // This is used to approximate the decoder's position in the media resource. diff --git a/content/media/fmp4/wmf/WMFVideoOutputSource.cpp b/content/media/fmp4/wmf/WMFVideoMFTManager.cpp similarity index 92% rename from content/media/fmp4/wmf/WMFVideoOutputSource.cpp rename to content/media/fmp4/wmf/WMFVideoMFTManager.cpp index c4a31b0cd68..1f19ec94cb2 100644 --- a/content/media/fmp4/wmf/WMFVideoOutputSource.cpp +++ b/content/media/fmp4/wmf/WMFVideoMFTManager.cpp @@ -4,7 +4,7 @@ * 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 "WMFVideoOutputSource.h" +#include "WMFVideoMFTManager.h" #include "MediaDecoderReader.h" #include "WMFUtils.h" #include "ImageContainer.h" @@ -32,7 +32,7 @@ using mozilla::layers::LayersBackend; namespace mozilla { -WMFVideoOutputSource::WMFVideoOutputSource( +WMFVideoMFTManager::WMFVideoMFTManager( const mp4_demuxer::VideoDecoderConfig& aConfig, mozilla::layers::LayersBackend aLayersBackend, mozilla::layers::ImageContainer* aImageContainer, @@ -48,12 +48,12 @@ WMFVideoOutputSource::WMFVideoOutputSource( { NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread."); MOZ_ASSERT(mImageContainer); - MOZ_COUNT_CTOR(WMFVideoOutputSource); + MOZ_COUNT_CTOR(WMFVideoMFTManager); } -WMFVideoOutputSource::~WMFVideoOutputSource() +WMFVideoMFTManager::~WMFVideoMFTManager() { - MOZ_COUNT_DTOR(WMFVideoOutputSource); + MOZ_COUNT_DTOR(WMFVideoMFTManager); // Ensure DXVA/D3D9 related objects are released on the main thread. DeleteOnMainThread(mDXVA2Manager); } @@ -69,7 +69,7 @@ public: }; bool -WMFVideoOutputSource::InitializeDXVA() +WMFVideoMFTManager::InitializeDXVA() { // If we use DXVA but aren't running with a D3D layer manager then the // readback of decoded video frames from GPU to CPU memory grinds painting @@ -90,7 +90,7 @@ WMFVideoOutputSource::InitializeDXVA() } TemporaryRef -WMFVideoOutputSource::Init() +WMFVideoMFTManager::Init() { bool useDxva = InitializeDXVA(); @@ -144,7 +144,7 @@ WMFVideoOutputSource::Init() } HRESULT -WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample) +WMFVideoMFTManager::Input(mp4_demuxer::MP4Sample* aSample) { // We must prepare samples in AVC Annex B. mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b); @@ -155,7 +155,7 @@ WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample) } HRESULT -WMFVideoOutputSource::ConfigureVideoFrameGeometry() +WMFVideoMFTManager::ConfigureVideoFrameGeometry() { RefPtr mediaType; HRESULT hr = mDecoder->GetOutputMediaType(mediaType); @@ -216,9 +216,9 @@ WMFVideoOutputSource::ConfigureVideoFrameGeometry() } HRESULT -WMFVideoOutputSource::CreateBasicVideoFrame(IMFSample* aSample, - int64_t aStreamOffset, - VideoData** aOutVideoData) +WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample, + int64_t aStreamOffset, + VideoData** aOutVideoData) { NS_ENSURE_TRUE(aSample, E_POINTER); NS_ENSURE_TRUE(aOutVideoData, E_POINTER); @@ -311,9 +311,9 @@ WMFVideoOutputSource::CreateBasicVideoFrame(IMFSample* aSample, } HRESULT -WMFVideoOutputSource::CreateD3DVideoFrame(IMFSample* aSample, - int64_t aStreamOffset, - VideoData** aOutVideoData) +WMFVideoMFTManager::CreateD3DVideoFrame(IMFSample* aSample, + int64_t aStreamOffset, + VideoData** aOutVideoData) { NS_ENSURE_TRUE(aSample, E_POINTER); NS_ENSURE_TRUE(aOutVideoData, E_POINTER); @@ -351,8 +351,8 @@ WMFVideoOutputSource::CreateD3DVideoFrame(IMFSample* aSample, // Blocks until decoded sample is produced by the deoder. HRESULT -WMFVideoOutputSource::Output(int64_t aStreamOffset, - nsAutoPtr& aOutData) +WMFVideoMFTManager::Output(int64_t aStreamOffset, + nsAutoPtr& aOutData) { RefPtr sample; HRESULT hr; @@ -379,7 +379,7 @@ WMFVideoOutputSource::Output(int64_t aStreamOffset, break; } // Else unexpected error, assert, and bail. - NS_WARNING("WMFVideoOutputSource::Output() unexpected error"); + NS_WARNING("WMFVideoMFTManager::Output() unexpected error"); return E_FAIL; } diff --git a/content/media/fmp4/wmf/WMFVideoOutputSource.h b/content/media/fmp4/wmf/WMFVideoMFTManager.h similarity index 79% rename from content/media/fmp4/wmf/WMFVideoOutputSource.h rename to content/media/fmp4/wmf/WMFVideoMFTManager.h index c74af3f013d..259d6bfd2bb 100644 --- a/content/media/fmp4/wmf/WMFVideoOutputSource.h +++ b/content/media/fmp4/wmf/WMFVideoMFTManager.h @@ -4,8 +4,8 @@ * 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/. */ -#if !defined(WMFVideoOutputSource_h_) -#define WMFVideoOutputSource_h_ +#if !defined(WMFVideoMFTManager_h_) +#define WMFVideoMFTManager_h_ #include "WMF.h" #include "MP4Reader.h" @@ -18,13 +18,13 @@ namespace mozilla { class DXVA2Manager; -class WMFVideoOutputSource : public WMFOutputSource { +class WMFVideoMFTManager : public MFTManager { public: - WMFVideoOutputSource(const mp4_demuxer::VideoDecoderConfig& aConfig, - mozilla::layers::LayersBackend aLayersBackend, - mozilla::layers::ImageContainer* aImageContainer, - bool aDXVAEnabled); - ~WMFVideoOutputSource(); + WMFVideoMFTManager(const mp4_demuxer::VideoDecoderConfig& aConfig, + mozilla::layers::LayersBackend aLayersBackend, + mozilla::layers::ImageContainer* aImageContainer, + bool aDXVAEnabled); + ~WMFVideoMFTManager(); virtual TemporaryRef Init() MOZ_OVERRIDE; @@ -69,4 +69,4 @@ private: } // namespace mozilla -#endif // WMFVideoOutputSource_h_ +#endif // WMFVideoMFTManager_h_