Skip to content

Commit

Permalink
camera: small Media Foundation backend init tweak.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 2, 2024
1 parent e290d16 commit bafd04e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/camera/mediafoundation/SDL_camera_mediafoundation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1084,25 +1084,24 @@ static SDL_bool MEDIAFOUNDATION_Init(SDL_CameraDriverImpl *impl)
LOADSYM(mfreadwrite, MFCreateSourceReaderFromMediaSource);
#undef LOADSYM

if (okay) {
const HRESULT ret = pMFStartup(MF_VERSION, MFSTARTUP_LITE);
if (FAILED(ret)) {
okay = SDL_FALSE;
}
}

if (!okay) {
FreeLibrary(mfreadwrite);
FreeLibrary(mfplat);
FreeLibrary(mf);
return SDL_FALSE;
}

libmf = mf;
libmfplat = mfplat;
libmfreadwrite = mfreadwrite;

const HRESULT ret = pMFStartup(MF_VERSION, MFSTARTUP_LITE);
if (FAILED(ret)) {
FreeLibrary(libmfplat);
libmfplat = NULL;
FreeLibrary(libmf);
libmf = NULL;
return SDL_FALSE;
}

impl->DetectDevices = MEDIAFOUNDATION_DetectDevices;
impl->OpenDevice = MEDIAFOUNDATION_OpenDevice;
impl->CloseDevice = MEDIAFOUNDATION_CloseDevice;
Expand Down

0 comments on commit bafd04e

Please sign in to comment.