Issue #2311 - Part 2 - Link ffmpeg real DFT functions

This commit is contained in:
trav90 2023-09-20 13:38:05 -05:00 committed by roytam1
commit 289020a670
3 changed files with 36 additions and 0 deletions

View file

@ -147,6 +147,9 @@ FFmpegLibWrapper::Link()
AV_FUNC(avcodec_free_frame, AV_FUNC_54)
AV_FUNC(avcodec_send_packet, AV_FUNC_58)
AV_FUNC(avcodec_receive_frame, AV_FUNC_58)
AV_FUNC_OPTION(av_rdft_init, AV_FUNC_AVCODEC_ALL)
AV_FUNC_OPTION(av_rdft_calc, AV_FUNC_AVCODEC_ALL)
AV_FUNC_OPTION(av_rdft_end, AV_FUNC_AVCODEC_ALL)
AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL)
AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL)
AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)

View file

@ -5,6 +5,7 @@
#ifndef __FFmpegLibWrapper_h__
#define __FFmpegLibWrapper_h__
#include "FFmpegRDFTTypes.h" // for AvRdftInitFn, etc.
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"
@ -75,6 +76,11 @@ struct FFmpegLibWrapper
int (*avcodec_send_packet)(AVCodecContext* avctx, const AVPacket* avpkt);
int (*avcodec_receive_frame)(AVCodecContext* avctx, AVFrame* frame);
// libavcodec optional
AvRdftInitFn av_rdft_init;
AvRdftCalcFn av_rdft_calc;
AvRdftEndFn av_rdft_end;
// libavutil
void (*av_log_set_level)(int level);
void* (*av_malloc)(size_t size);

View file

@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#ifndef FFmpegRDFTTypes_h
#define FFmpegRDFTTypes_h
struct RDFTContext;
typedef float FFTSample;
enum RDFTransformType {
DFT_R2C,
IDFT_C2R,
IDFT_R2C,
DFT_C2R,
};
extern "C" {
typedef RDFTContext* (*AvRdftInitFn)(int nbits, enum RDFTransformType trans);
typedef void (*AvRdftCalcFn)(RDFTContext *s, FFTSample *data);
typedef void (*AvRdftEndFn)(RDFTContext *s);
}
#endif // FFmpegRDFTTypes_h