[FFmpeg-devel] [PATCH v3] avcodec/mfenc: Dynamically load MFPlat.DLL

Martin Storsjö martin at martin.st
Fri May 20 23:05:13 EEST 2022


On Fri, 20 May 2022, Trystan Mata wrote:

> From 2bdef1bdb93efa40b7d3fe21270f9f23465bee90 Mon Sep 17 00:00:00 2001
> From: Trystan Mata <trystan.mata at tytanium.xyz>
> Date: Fri, 20 May 2022 14:26:49 +0200
> Subject: [PATCH] avcodec/mfenc: Dynamically load MFPlat.DLL
> 
> Allow builds of FFmpeg with MediaFoundation to work under N editions of
> Windows which are without MediaFoundation by default.
> 
> Signed-off-by: Trystan Mata <trystan.mata at tytanium.xyz>
> ---
>  configure             |  4 +-
>  libavcodec/mf_utils.c | 26 +++++++------
>  libavcodec/mf_utils.h | 16 ++++++--
>  libavcodec/mfenc.c    | 91 ++++++++++++++++++++++++++++++++++++-------
>  4 files changed, 107 insertions(+), 30 deletions(-)

This patch on its own breaks builds for UWP targets (where LoadLibrary 
isn't available). Or more precisely, previously mfenc was enabled, now it 
no longer is available.

For such targets, one can unconditionally assume that the functions are 
available and can link directly against them. See ff_MFTEnumEx in 
mf_utils.c how that's done so far. Doing the same instead of LoadLibrary 
probably shouldn't be an issue for you, but I think we'd need to drop the 
dependency on LoadLibrary in configure. (I think that's fine, we don't 
really lose anything by doing that.)

Btw, when sending updates to an earlier posted patch, it'd be nice if 
you'd mention somewhere what changed compared to the previous revision of 
the patch.

// Martin



More information about the ffmpeg-devel mailing list