winegstreamer: Move GStreamer library initialization to __wine_init_unix_lib().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dbd927f4ad
commit
10dde32dc6
|
@ -174,41 +174,16 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
|
||||||
|
|
||||||
static BOOL CALLBACK init_gstreamer_proc(INIT_ONCE *once, void *param, void **ctx)
|
static BOOL CALLBACK init_gstreamer_proc(INIT_ONCE *once, void *param, void **ctx)
|
||||||
{
|
{
|
||||||
BOOL *status = param;
|
HINSTANCE handle;
|
||||||
char argv0[] = "wine";
|
|
||||||
char argv1[] = "--gst-disable-registry-fork";
|
|
||||||
char *args[3];
|
|
||||||
char **argv = args;
|
|
||||||
int argc = 2;
|
|
||||||
GError *err = NULL;
|
|
||||||
|
|
||||||
TRACE("Initializing...\n");
|
/* Unloading glib is a bad idea.. it installs atexit handlers,
|
||||||
|
* so never unload the dll after loading */
|
||||||
|
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
|
||||||
|
(LPCWSTR)winegstreamer_instance, &handle);
|
||||||
|
if (!handle)
|
||||||
|
ERR("Failed to pin module %p.\n", winegstreamer_instance);
|
||||||
|
|
||||||
argv[0] = argv0;
|
start_dispatch_thread();
|
||||||
argv[1] = argv1;
|
|
||||||
argv[2] = NULL;
|
|
||||||
*status = gst_init_check(&argc, &argv, &err);
|
|
||||||
if (*status)
|
|
||||||
{
|
|
||||||
HINSTANCE handle;
|
|
||||||
|
|
||||||
TRACE("Initialized, version %s. Built with %d.%d.%d.\n", gst_version_string(),
|
|
||||||
GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO);
|
|
||||||
|
|
||||||
/* Unloading glib is a bad idea.. it installs atexit handlers,
|
|
||||||
* so never unload the dll after loading */
|
|
||||||
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
|
|
||||||
(LPCWSTR)winegstreamer_instance, &handle);
|
|
||||||
if (!handle)
|
|
||||||
ERR("Failed to pin module %p.\n", winegstreamer_instance);
|
|
||||||
|
|
||||||
start_dispatch_thread();
|
|
||||||
}
|
|
||||||
else if (err)
|
|
||||||
{
|
|
||||||
ERR("Failed to initialize gstreamer: %s\n", debugstr_a(err->message));
|
|
||||||
g_error_free(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -216,11 +191,10 @@ static BOOL CALLBACK init_gstreamer_proc(INIT_ONCE *once, void *param, void **ct
|
||||||
BOOL init_gstreamer(void)
|
BOOL init_gstreamer(void)
|
||||||
{
|
{
|
||||||
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
|
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
|
||||||
static BOOL status;
|
|
||||||
|
|
||||||
InitOnceExecuteOnce(&once, init_gstreamer_proc, &status, NULL);
|
InitOnceExecuteOnce(&once, init_gstreamer_proc, NULL, NULL);
|
||||||
|
|
||||||
return status;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const REGPINTYPES reg_audio_mt = {&MEDIATYPE_Audio, &GUID_NULL};
|
static const REGPINTYPES reg_audio_mt = {&MEDIATYPE_Audio, &GUID_NULL};
|
||||||
|
|
|
@ -1023,7 +1023,24 @@ NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *pt
|
||||||
{
|
{
|
||||||
if (reason == DLL_PROCESS_ATTACH)
|
if (reason == DLL_PROCESS_ATTACH)
|
||||||
{
|
{
|
||||||
|
char arg0[] = "wine";
|
||||||
|
char arg1[] = "--gst-disable-registry-fork";
|
||||||
|
char *args[] = {arg0, arg1, NULL};
|
||||||
|
int argc = ARRAY_SIZE(args) - 1;
|
||||||
|
char **argv = args;
|
||||||
|
GError *err;
|
||||||
|
|
||||||
|
if (!gst_init_check(&argc, &argv, &err))
|
||||||
|
{
|
||||||
|
ERR("Failed to initialize GStreamer: %s\n", debugstr_a(err->message));
|
||||||
|
g_error_free(err);
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
TRACE("GStreamer library version %s; wine built with %d.%d.%d.\n",
|
||||||
|
gst_version_string(), GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO);
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT(wine, "WINE", GST_DEBUG_FG_RED, "Wine GStreamer support");
|
GST_DEBUG_CATEGORY_INIT(wine, "WINE", GST_DEBUG_FG_RED, "Wine GStreamer support");
|
||||||
|
|
||||||
*(const struct unix_funcs **)ptr_out = &funcs;
|
*(const struct unix_funcs **)ptr_out = &funcs;
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue