bug 1476231 add accessor for ffvpx real DFT functions r=jya

MozReview-Commit-ID: AF2jl6ZnD4z

--HG--
extra : rebase_source : c7f6c60e3f1b282db5aef2f7b84f23b46734513f
This commit is contained in:
Karl Tomlinson 2018-07-14 12:32:20 +12:00
Родитель c0bf3f57b9
Коммит 146c0a09dd
4 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -26,4 +26,11 @@ extern "C" {
}
struct FFmpegRDFTFuncs
{
AvRdftInitFn init;
AvRdftCalcFn calc;
AvRdftEndFn end;
};
#endif // FFmpegRDFTTypes_h

Просмотреть файл

@ -62,6 +62,7 @@ FFVPXRuntimeLinker::Init()
return sLinkStatus == LinkStatus_SUCCEEDED;
}
MOZ_ASSERT(NS_IsMainThread());
sLinkStatus = LinkStatus_FAILED;
// We retrieve the path of the lgpllibs library as this is where mozavcodec
@ -120,4 +121,20 @@ FFVPXRuntimeLinker::CreateDecoderModule()
return FFmpegDecoderModule<FFVPX_VERSION>::Create(&sFFVPXLib);
}
/* static */ void
FFVPXRuntimeLinker::GetRDFTFuncs(FFmpegRDFTFuncs* aOutFuncs)
{
MOZ_ASSERT(sLinkStatus != LinkStatus_INIT);
if (sFFVPXLib.av_rdft_init &&
sFFVPXLib.av_rdft_calc &&
sFFVPXLib.av_rdft_end) {
aOutFuncs->init = sFFVPXLib.av_rdft_init;
aOutFuncs->calc = sFFVPXLib.av_rdft_calc;
aOutFuncs->end = sFFVPXLib.av_rdft_end;
} else {
NS_WARNING("RDFT functions expected but not found");
*aOutFuncs = FFmpegRDFTFuncs(); // zero
}
}
} // namespace mozilla

Просмотреть файл

@ -9,16 +9,24 @@
#include "PlatformDecoderModule.h"
struct FFmpegRDFTFuncs;
namespace mozilla
{
class FFVPXRuntimeLinker
{
public:
// Main thread only.
static bool Init();
// Main thread or after Init().
static already_AddRefed<PlatformDecoderModule> CreateDecoderModule();
// Call (on any thread) after Init().
static void GetRDFTFuncs(FFmpegRDFTFuncs* aOutFuncs);
private:
// Set once on the main thread and then read from other threads.
static enum LinkStatus {
LinkStatus_INIT = 0,
LinkStatus_FAILED,

Просмотреть файл

@ -48,6 +48,9 @@ if CONFIG['MOZ_WMF']:
if CONFIG['MOZ_FFVPX'] or CONFIG['MOZ_FFMPEG']:
# common code to either FFmpeg or FFVPX
EXPORTS += [
'ffmpeg/FFmpegRDFTTypes.h',
]
UNIFIED_SOURCES += [
'ffmpeg/FFmpegLibWrapper.cpp',
]