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

Martin Storsjö martin at martin.st
Thu May 26 00:34:47 EEST 2022


On Wed, 25 May 2022, Timo Rothenpieler wrote:

> On 25/05/2022 22:51, Martin Storsjö wrote:
>> On Wed, 25 May 2022, Trystan Mata wrote:
>> 
>>> Changes since the v5:
>>>  - Library handle and function pointer are back in MFContext.
>>>    - MFTEnumEx has been move to it too.
>>>  - dlopen and dlclose are preferred.
>>>
>>> This will avoid multiple look up on one context. And each context will
>>> have his own library handle.
>> 
>> Thanks, this looks mostly good to me!
>> 
>> In testing of it, I noted that you still need to link against -lmfuuid 
>> when building with MSVC (but in mingw, those UUIDs are defined inline in 
>> headers I think).
>> 
>> Additionally, I realized I do prefer to keep using plain LoadLibraryA 
>> and FreeLibrary instead of using the wrapper, as this file is all quite 
>> Windows specific code; using the direct Windows APIs makes it clearer 
>> what's going on.
>
> There is quite a bit of work put into the wrapper to eliminate a bunch 
> of common attack vectors with LoadLibrary and pitfalls with it on Windows.
> So I'd strongly recommend to use it.

Oh, thanks for catching it and letting me know, and sorry for pushing the 
patch with those changes, without taking it via another round of 
discussions. I'll send another patch to fix that.

// Martin


More information about the ffmpeg-devel mailing list