mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:30:50 +00:00
winegstreamer: Initialize GStreamer in wg_parser_create().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51086 Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
eab189810d
commit
3643f73ab6
|
@ -1846,6 +1846,28 @@ static BOOL wave_parser_init_gst(struct wg_parser *parser)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void init_gstreamer_once(void)
|
||||
{
|
||||
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))
|
||||
{
|
||||
fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", debugstr_a(err->message));
|
||||
g_error_free(err);
|
||||
return;
|
||||
}
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT(wine, "WINE", GST_DEBUG_FG_RED, "Wine GStreamer support");
|
||||
|
||||
GST_INFO("GStreamer library version %s; wine built with %d.%d.%d.\n",
|
||||
gst_version_string(), GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO);
|
||||
}
|
||||
|
||||
static struct wg_parser * CDECL wg_parser_create(enum wg_parser_type type)
|
||||
{
|
||||
static const init_gst_cb init_funcs[] =
|
||||
|
@ -1856,8 +1878,12 @@ static struct wg_parser * CDECL wg_parser_create(enum wg_parser_type type)
|
|||
[WG_PARSER_WAVPARSE] = wave_parser_init_gst,
|
||||
};
|
||||
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
struct wg_parser *parser;
|
||||
|
||||
if (pthread_once(&once, init_gstreamer_once))
|
||||
return NULL;
|
||||
|
||||
if (!(parser = calloc(1, sizeof(*parser))))
|
||||
return NULL;
|
||||
|
||||
|
@ -1923,27 +1949,6 @@ static const struct unix_funcs funcs =
|
|||
NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)
|
||||
{
|
||||
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))
|
||||
{
|
||||
fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", debugstr_a(err->message));
|
||||
g_error_free(err);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT(wine, "WINE", GST_DEBUG_FG_RED, "Wine GStreamer support");
|
||||
|
||||
GST_INFO("GStreamer library version %s; wine built with %d.%d.%d.\n",
|
||||
gst_version_string(), GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO);
|
||||
|
||||
*(const struct unix_funcs **)ptr_out = &funcs;
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue