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
This commit is contained in:
Chris Pearce 2014-07-10 09:25:10 +12:00
parent 9f57ce1f16
commit d3b4671c04
8 changed files with 62 additions and 62 deletions

View File

@ -23,17 +23,17 @@ SOURCES += [
if CONFIG['MOZ_WMF']: if CONFIG['MOZ_WMF']:
EXPORTS += [ EXPORTS += [
'wmf/MFTDecoder.h', 'wmf/MFTDecoder.h',
'wmf/WMFAudioOutputSource.h', 'wmf/WMFAudioMFTManager.h',
'wmf/WMFDecoderModule.h', 'wmf/WMFDecoderModule.h',
'wmf/WMFMediaDataDecoder.h', 'wmf/WMFMediaDataDecoder.h',
'wmf/WMFVideoOutputSource.h', 'wmf/WMFVideoMFTManager.h',
] ]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'wmf/MFTDecoder.cpp', 'wmf/MFTDecoder.cpp',
'wmf/WMFAudioOutputSource.cpp', 'wmf/WMFAudioMFTManager.cpp',
'wmf/WMFDecoderModule.cpp', 'wmf/WMFDecoderModule.cpp',
'wmf/WMFMediaDataDecoder.cpp', 'wmf/WMFMediaDataDecoder.cpp',
'wmf/WMFVideoOutputSource.cpp', 'wmf/WMFVideoMFTManager.cpp',
] ]
if CONFIG['MOZ_FFMPEG']: if CONFIG['MOZ_FFMPEG']:

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WMFAudioOutputSource.h" #include "WMFAudioMFTManager.h"
#include "mp4_demuxer/DecoderData.h" #include "mp4_demuxer/DecoderData.h"
#include "VideoUtils.h" #include "VideoUtils.h"
#include "WMFUtils.h" #include "WMFUtils.h"
@ -66,7 +66,7 @@ AACAudioSpecificConfigToUserData(const uint8_t* aAudioSpecConfig,
aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength); aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength);
} }
WMFAudioOutputSource::WMFAudioOutputSource( WMFAudioMFTManager::WMFAudioMFTManager(
const mp4_demuxer::AudioDecoderConfig& aConfig) const mp4_demuxer::AudioDecoderConfig& aConfig)
: mAudioChannels(aConfig.channel_count) : mAudioChannels(aConfig.channel_count)
, mAudioBytesPerSample(aConfig.bits_per_sample / 8) , mAudioBytesPerSample(aConfig.bits_per_sample / 8)
@ -75,19 +75,19 @@ WMFAudioOutputSource::WMFAudioOutputSource(
, mAudioFrameSum(0) , mAudioFrameSum(0)
, mMustRecaptureAudioPosition(true) , mMustRecaptureAudioPosition(true)
{ {
MOZ_COUNT_CTOR(WMFAudioOutputSource); MOZ_COUNT_CTOR(WMFAudioMFTManager);
AACAudioSpecificConfigToUserData(&aConfig.audio_specific_config[0], AACAudioSpecificConfigToUserData(&aConfig.audio_specific_config[0],
aConfig.audio_specific_config.length(), aConfig.audio_specific_config.length(),
mUserData); mUserData);
} }
WMFAudioOutputSource::~WMFAudioOutputSource() WMFAudioMFTManager::~WMFAudioMFTManager()
{ {
MOZ_COUNT_DTOR(WMFAudioOutputSource); MOZ_COUNT_DTOR(WMFAudioMFTManager);
} }
TemporaryRef<MFTDecoder> TemporaryRef<MFTDecoder>
WMFAudioOutputSource::Init() WMFAudioMFTManager::Init()
{ {
RefPtr<MFTDecoder> decoder(new MFTDecoder()); RefPtr<MFTDecoder> decoder(new MFTDecoder());
@ -129,7 +129,7 @@ WMFAudioOutputSource::Init()
} }
HRESULT HRESULT
WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample) WMFAudioMFTManager::Input(mp4_demuxer::MP4Sample* aSample)
{ {
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data); const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
uint32_t length = aSample->size; uint32_t length = aSample->size;
@ -137,8 +137,8 @@ WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
} }
HRESULT HRESULT
WMFAudioOutputSource::Output(int64_t aStreamOffset, WMFAudioMFTManager::Output(int64_t aStreamOffset,
nsAutoPtr<MediaData>& aOutData) nsAutoPtr<MediaData>& aOutData)
{ {
aOutData = nullptr; aOutData = nullptr;
RefPtr<IMFSample> sample; RefPtr<IMFSample> sample;

View File

@ -15,10 +15,10 @@
namespace mozilla { namespace mozilla {
class WMFAudioOutputSource : public WMFOutputSource { class WMFAudioMFTManager : public MFTManager {
public: public:
WMFAudioOutputSource(const mp4_demuxer::AudioDecoderConfig& aConfig); WMFAudioMFTManager(const mp4_demuxer::AudioDecoderConfig& aConfig);
~WMFAudioOutputSource(); ~WMFAudioMFTManager();
virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE; virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE;

View File

@ -7,8 +7,8 @@
#include "WMF.h" #include "WMF.h"
#include "WMFDecoderModule.h" #include "WMFDecoderModule.h"
#include "WMFDecoder.h" #include "WMFDecoder.h"
#include "WMFVideoOutputSource.h" #include "WMFVideoMFTManager.h"
#include "WMFAudioOutputSource.h" #include "WMFAudioMFTManager.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "WMFMediaDataDecoder.h" #include "WMFMediaDataDecoder.h"
@ -70,10 +70,10 @@ WMFDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConf
MediaTaskQueue* aVideoTaskQueue, MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MediaDataDecoderCallback* aCallback)
{ {
return new WMFMediaDataDecoder(new WMFVideoOutputSource(aConfig, return new WMFMediaDataDecoder(new WMFVideoMFTManager(aConfig,
aLayersBackend, aLayersBackend,
aImageContainer, aImageContainer,
sDXVAEnabled), sDXVAEnabled),
aVideoTaskQueue, aVideoTaskQueue,
aCallback); aCallback);
} }
@ -83,7 +83,7 @@ WMFDecoderModule::CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfi
MediaTaskQueue* aAudioTaskQueue, MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MediaDataDecoderCallback* aCallback)
{ {
return new WMFMediaDataDecoder(new WMFAudioOutputSource(aConfig), return new WMFMediaDataDecoder(new WMFAudioMFTManager(aConfig),
aAudioTaskQueue, aAudioTaskQueue,
aCallback); aCallback);
} }

View File

@ -21,12 +21,12 @@ PRLogModuleInfo* GetDemuxerLog();
namespace mozilla { namespace mozilla {
WMFMediaDataDecoder::WMFMediaDataDecoder(WMFOutputSource* aSource, WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
MediaTaskQueue* aTaskQueue, MediaTaskQueue* aTaskQueue,
MediaDataDecoderCallback* aCallback) MediaDataDecoderCallback* aCallback)
: mTaskQueue(aTaskQueue) : mTaskQueue(aTaskQueue)
, mCallback(aCallback) , mCallback(aCallback)
, mSource(aSource) , mMFTManager(aMFTManager)
{ {
MOZ_COUNT_CTOR(WMFMediaDataDecoder); MOZ_COUNT_CTOR(WMFMediaDataDecoder);
} }
@ -39,7 +39,7 @@ WMFMediaDataDecoder::~WMFMediaDataDecoder()
nsresult nsresult
WMFMediaDataDecoder::Init() WMFMediaDataDecoder::Init()
{ {
mDecoder = mSource->Init(); mDecoder = mMFTManager->Init();
NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE); NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE);
return NS_OK; return NS_OK;
@ -67,9 +67,9 @@ WMFMediaDataDecoder::Input(mp4_demuxer::MP4Sample* aSample)
void void
WMFMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample) WMFMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample)
{ {
HRESULT hr = mSource->Input(aSample); HRESULT hr = mMFTManager->Input(aSample);
if (FAILED(hr)) { if (FAILED(hr)) {
NS_WARNING("WMFOutputSource rejected sample"); NS_WARNING("MFTManager rejected sample");
mCallback->Error(); mCallback->Error();
return; return;
} }
@ -84,7 +84,7 @@ WMFMediaDataDecoder::ProcessOutput()
{ {
nsAutoPtr<MediaData> output; nsAutoPtr<MediaData> output;
HRESULT hr = S_OK; HRESULT hr = S_OK;
while (SUCCEEDED(hr = mSource->Output(mLastStreamOffset, output)) && while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) &&
output) { output) {
mCallback->Output(output.forget()); mCallback->Output(output.forget());
} }

View File

@ -22,9 +22,9 @@ namespace mozilla {
// Encapsulates the initialization of the MFTDecoder appropriate for decoding // Encapsulates the initialization of the MFTDecoder appropriate for decoding
// a given stream, and the process of converting the IMFSample produced // a given stream, and the process of converting the IMFSample produced
// by the MFT into a MediaData object. // by the MFT into a MediaData object.
class WMFOutputSource { class MFTManager {
public: public:
virtual ~WMFOutputSource() {} virtual ~MFTManager() {}
// Creates an initializs the MFTDecoder. // Creates an initializs the MFTDecoder.
// Returns nullptr on failure. // Returns nullptr on failure.
@ -46,13 +46,13 @@ public:
}; };
// Decodes audio and video using Windows Media Foundation. Samples are decoded // 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 // the higher-level logic that drives mapping the MFT to the async
// MediaDataDecoder interface. The specifics of decoding the exact stream // 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 { class WMFMediaDataDecoder : public MediaDataDecoder {
public: public:
WMFMediaDataDecoder(WMFOutputSource* aOutputSource, WMFMediaDataDecoder(MFTManager* aOutputSource,
MediaTaskQueue* aAudioTaskQueue, MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback); MediaDataDecoderCallback* aCallback);
~WMFMediaDataDecoder(); ~WMFMediaDataDecoder();
@ -85,7 +85,7 @@ private:
MediaDataDecoderCallback* mCallback; MediaDataDecoderCallback* mCallback;
RefPtr<MFTDecoder> mDecoder; RefPtr<MFTDecoder> mDecoder;
nsAutoPtr<WMFOutputSource> mSource; nsAutoPtr<MFTManager> mMFTManager;
// The last offset into the media resource that was passed into Input(). // 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. // This is used to approximate the decoder's position in the media resource.

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WMFVideoOutputSource.h" #include "WMFVideoMFTManager.h"
#include "MediaDecoderReader.h" #include "MediaDecoderReader.h"
#include "WMFUtils.h" #include "WMFUtils.h"
#include "ImageContainer.h" #include "ImageContainer.h"
@ -32,7 +32,7 @@ using mozilla::layers::LayersBackend;
namespace mozilla { namespace mozilla {
WMFVideoOutputSource::WMFVideoOutputSource( WMFVideoMFTManager::WMFVideoMFTManager(
const mp4_demuxer::VideoDecoderConfig& aConfig, const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend, mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer, mozilla::layers::ImageContainer* aImageContainer,
@ -48,12 +48,12 @@ WMFVideoOutputSource::WMFVideoOutputSource(
{ {
NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread."); NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
MOZ_ASSERT(mImageContainer); 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. // Ensure DXVA/D3D9 related objects are released on the main thread.
DeleteOnMainThread(mDXVA2Manager); DeleteOnMainThread(mDXVA2Manager);
} }
@ -69,7 +69,7 @@ public:
}; };
bool bool
WMFVideoOutputSource::InitializeDXVA() WMFVideoMFTManager::InitializeDXVA()
{ {
// If we use DXVA but aren't running with a D3D layer manager then the // 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 // readback of decoded video frames from GPU to CPU memory grinds painting
@ -90,7 +90,7 @@ WMFVideoOutputSource::InitializeDXVA()
} }
TemporaryRef<MFTDecoder> TemporaryRef<MFTDecoder>
WMFVideoOutputSource::Init() WMFVideoMFTManager::Init()
{ {
bool useDxva = InitializeDXVA(); bool useDxva = InitializeDXVA();
@ -144,7 +144,7 @@ WMFVideoOutputSource::Init()
} }
HRESULT HRESULT
WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample) WMFVideoMFTManager::Input(mp4_demuxer::MP4Sample* aSample)
{ {
// We must prepare samples in AVC Annex B. // We must prepare samples in AVC Annex B.
mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b); mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b);
@ -155,7 +155,7 @@ WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
} }
HRESULT HRESULT
WMFVideoOutputSource::ConfigureVideoFrameGeometry() WMFVideoMFTManager::ConfigureVideoFrameGeometry()
{ {
RefPtr<IMFMediaType> mediaType; RefPtr<IMFMediaType> mediaType;
HRESULT hr = mDecoder->GetOutputMediaType(mediaType); HRESULT hr = mDecoder->GetOutputMediaType(mediaType);
@ -216,9 +216,9 @@ WMFVideoOutputSource::ConfigureVideoFrameGeometry()
} }
HRESULT HRESULT
WMFVideoOutputSource::CreateBasicVideoFrame(IMFSample* aSample, WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
int64_t aStreamOffset, int64_t aStreamOffset,
VideoData** aOutVideoData) VideoData** aOutVideoData)
{ {
NS_ENSURE_TRUE(aSample, E_POINTER); NS_ENSURE_TRUE(aSample, E_POINTER);
NS_ENSURE_TRUE(aOutVideoData, E_POINTER); NS_ENSURE_TRUE(aOutVideoData, E_POINTER);
@ -311,9 +311,9 @@ WMFVideoOutputSource::CreateBasicVideoFrame(IMFSample* aSample,
} }
HRESULT HRESULT
WMFVideoOutputSource::CreateD3DVideoFrame(IMFSample* aSample, WMFVideoMFTManager::CreateD3DVideoFrame(IMFSample* aSample,
int64_t aStreamOffset, int64_t aStreamOffset,
VideoData** aOutVideoData) VideoData** aOutVideoData)
{ {
NS_ENSURE_TRUE(aSample, E_POINTER); NS_ENSURE_TRUE(aSample, E_POINTER);
NS_ENSURE_TRUE(aOutVideoData, 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. // Blocks until decoded sample is produced by the deoder.
HRESULT HRESULT
WMFVideoOutputSource::Output(int64_t aStreamOffset, WMFVideoMFTManager::Output(int64_t aStreamOffset,
nsAutoPtr<MediaData>& aOutData) nsAutoPtr<MediaData>& aOutData)
{ {
RefPtr<IMFSample> sample; RefPtr<IMFSample> sample;
HRESULT hr; HRESULT hr;
@ -379,7 +379,7 @@ WMFVideoOutputSource::Output(int64_t aStreamOffset,
break; break;
} }
// Else unexpected error, assert, and bail. // Else unexpected error, assert, and bail.
NS_WARNING("WMFVideoOutputSource::Output() unexpected error"); NS_WARNING("WMFVideoMFTManager::Output() unexpected error");
return E_FAIL; return E_FAIL;
} }

View File

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(WMFVideoOutputSource_h_) #if !defined(WMFVideoMFTManager_h_)
#define WMFVideoOutputSource_h_ #define WMFVideoMFTManager_h_
#include "WMF.h" #include "WMF.h"
#include "MP4Reader.h" #include "MP4Reader.h"
@ -18,13 +18,13 @@ namespace mozilla {
class DXVA2Manager; class DXVA2Manager;
class WMFVideoOutputSource : public WMFOutputSource { class WMFVideoMFTManager : public MFTManager {
public: public:
WMFVideoOutputSource(const mp4_demuxer::VideoDecoderConfig& aConfig, WMFVideoMFTManager(const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend, mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer, mozilla::layers::ImageContainer* aImageContainer,
bool aDXVAEnabled); bool aDXVAEnabled);
~WMFVideoOutputSource(); ~WMFVideoMFTManager();
virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE; virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE;
@ -69,4 +69,4 @@ private:
} // namespace mozilla } // namespace mozilla
#endif // WMFVideoOutputSource_h_ #endif // WMFVideoMFTManager_h_