From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/winedmo/main.c | 49 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/dlls/winedmo/main.c b/dlls/winedmo/main.c index 27263b64826..8c7e84e7e44 100644 --- a/dlls/winedmo/main.c +++ b/dlls/winedmo/main.c @@ -335,6 +335,53 @@ static const struct winedmo_demuxer_funcs winedmo_demuxer_funcs = winedmo_demuxer_stream_type, }; +#ifndef WINEDMO_VERSION + +static const WCHAR *dynamic_modules[] = +{ + L"winedmo8", + L"winedmo7", + L"winedmo6", + L"winedmo5", + L"winedmo4", +}; + +static const struct winedmo_demuxer_funcs *load_demuxer_funcs( const WCHAR *module_name, const char *mime_type, UINT version ) +{ + const struct winedmo_demuxer_funcs *(*CDECL get_funcs)( const char *, UINT ); + HMODULE module; + + if (!(module = LoadLibraryW( module_name ))) return NULL; + if (!(get_funcs = (void *)GetProcAddress( module, "winedmo_get_demuxer_funcs" ))) + { + FreeLibrary( module ); + return NULL; + } + + TRACE( "loading demuxer from %s\n", debugstr_w(module_name) ); + return get_funcs( mime_type, version ); +} + +static const struct winedmo_demuxer_funcs *get_dynamic_demuxer_funcs( const char *mime_type, UINT version ) +{ + const struct winedmo_demuxer_funcs *funcs; + + for (UINT i = 0; i < ARRAY_SIZE(dynamic_modules); i++) + if ((funcs = load_demuxer_funcs( dynamic_modules[i], mime_type, version ))) + return funcs; + + return NULL; +} + +#else + +static const struct winedmo_demuxer_funcs *get_dynamic_demuxer_funcs( const char *mime_type, UINT version ) +{ + return NULL; +} + +#endif + const struct winedmo_demuxer_funcs *CDECL winedmo_get_demuxer_funcs( const char *mime_type, UINT version ) { struct demuxer_check_params params = {0}; @@ -352,7 +399,7 @@ const struct winedmo_demuxer_funcs *CDECL winedmo_get_demuxer_funcs( const char if ((status = UNIX_CALL( demuxer_check, ¶ms ))) { WARN( "unsupported mime type %s demuxer, status %#lx\n", debugstr_a(mime_type), status ); - return NULL; + return get_dynamic_demuxer_funcs( mime_type, version ); } return &winedmo_demuxer_funcs; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9913