mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1212795: P3. Make AppleDecoderModule detects if the required modules are loaded. r=jwwang
This commit is contained in:
parent
6d8c447776
commit
a39d774fa7
@ -11,6 +11,7 @@
|
||||
#include "AppleVDALinker.h"
|
||||
#include "AppleVTDecoder.h"
|
||||
#include "AppleVTLinker.h"
|
||||
#include "MacIOSurfaceImage.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Logging.h"
|
||||
@ -18,6 +19,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
bool AppleDecoderModule::sInitialized = false;
|
||||
bool AppleDecoderModule::sIsCoreMediaAvailable = false;
|
||||
bool AppleDecoderModule::sIsVTAvailable = false;
|
||||
bool AppleDecoderModule::sIsVTHWAvailable = false;
|
||||
bool AppleDecoderModule::sIsVDAAvailable = false;
|
||||
@ -46,21 +48,22 @@ AppleDecoderModule::Init()
|
||||
|
||||
// Ensure IOSurface framework is loaded.
|
||||
MacIOSurfaceLib::LoadLibrary();
|
||||
const bool loaded = MacIOSurfaceLib::isInit();
|
||||
|
||||
// dlopen VideoDecodeAcceleration.framework if it's available.
|
||||
sIsVDAAvailable = AppleVDALinker::Link();
|
||||
sIsVDAAvailable = loaded && AppleVDALinker::Link();
|
||||
|
||||
// dlopen CoreMedia.framework if it's available.
|
||||
bool haveCoreMedia = AppleCMLinker::Link();
|
||||
sIsCoreMediaAvailable = AppleCMLinker::Link();
|
||||
// dlopen VideoToolbox.framework if it's available.
|
||||
// We must link both CM and VideoToolbox framework to allow for proper
|
||||
// paired Link/Unlink calls
|
||||
bool haveVideoToolbox = AppleVTLinker::Link();
|
||||
sIsVTAvailable = haveCoreMedia && haveVideoToolbox;
|
||||
bool haveVideoToolbox = loaded && AppleVTLinker::Link();
|
||||
sIsVTAvailable = sIsCoreMediaAvailable && haveVideoToolbox;
|
||||
|
||||
sIsVTHWAvailable = AppleVTLinker::skPropEnableHWAccel != nullptr;
|
||||
|
||||
sCanUseHardwareVideoDecoder =
|
||||
sCanUseHardwareVideoDecoder = loaded &&
|
||||
gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
|
||||
|
||||
sInitialized = true;
|
||||
@ -116,10 +119,12 @@ AppleDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
bool
|
||||
AppleDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
||||
{
|
||||
return aMimeType.EqualsLiteral("audio/mpeg") ||
|
||||
aMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
||||
aMimeType.EqualsLiteral("video/mp4") ||
|
||||
aMimeType.EqualsLiteral("video/avc");
|
||||
return (sIsCoreMediaAvailable &&
|
||||
(aMimeType.EqualsLiteral("audio/mpeg") ||
|
||||
aMimeType.EqualsLiteral("audio/mp4a-latm"))) ||
|
||||
((sIsVTAvailable || sIsVDAAvailable) &&
|
||||
(aMimeType.EqualsLiteral("video/mp4") ||
|
||||
aMimeType.EqualsLiteral("video/avc")));
|
||||
}
|
||||
|
||||
PlatformDecoderModule::ConversionRequired
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
private:
|
||||
static bool sInitialized;
|
||||
static bool sIsCoreMediaAvailable;
|
||||
static bool sIsVTAvailable;
|
||||
static bool sIsVTHWAvailable;
|
||||
static bool sIsVDAAvailable;
|
||||
|
Loading…
Reference in New Issue
Block a user