mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
9f57ce1f16
commit
d3b4671c04
@ -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']:
|
||||
|
@ -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<MFTDecoder>
|
||||
WMFAudioOutputSource::Init()
|
||||
WMFAudioMFTManager::Init()
|
||||
{
|
||||
RefPtr<MFTDecoder> 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<const uint8_t*>(aSample->data);
|
||||
uint32_t length = aSample->size;
|
||||
@ -137,8 +137,8 @@ WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFAudioOutputSource::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
WMFAudioMFTManager::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
{
|
||||
aOutData = nullptr;
|
||||
RefPtr<IMFSample> sample;
|
@ -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<MFTDecoder> Init() MOZ_OVERRIDE;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<MediaData> output;
|
||||
HRESULT hr = S_OK;
|
||||
while (SUCCEEDED(hr = mSource->Output(mLastStreamOffset, output)) &&
|
||||
while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) &&
|
||||
output) {
|
||||
mCallback->Output(output.forget());
|
||||
}
|
||||
|
@ -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<MFTDecoder> mDecoder;
|
||||
nsAutoPtr<WMFOutputSource> mSource;
|
||||
nsAutoPtr<MFTManager> 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.
|
||||
|
@ -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<MFTDecoder>
|
||||
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<IMFMediaType> 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<MediaData>& aOutData)
|
||||
WMFVideoMFTManager::Output(int64_t aStreamOffset,
|
||||
nsAutoPtr<MediaData>& aOutData)
|
||||
{
|
||||
RefPtr<IMFSample> 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;
|
||||
}
|
||||
|
@ -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<MFTDecoder> Init() MOZ_OVERRIDE;
|
||||
|
||||
@ -69,4 +69,4 @@ private:
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // WMFVideoOutputSource_h_
|
||||
#endif // WMFVideoMFTManager_h_
|
Loading…
Reference in New Issue
Block a user