Issue #2311 - Part 3 - Add accessor for ffvpx real DFT functions

This commit is contained in:
trav90 2023-09-20 13:49:59 -05:00 committed by roytam1
commit 0e796b1dcd
4 changed files with 35 additions and 0 deletions

View file

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

View file

@ -48,6 +48,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
@ -109,4 +110,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

View file

@ -8,16 +8,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,

View file

@ -43,6 +43,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',
]