From: Brendan McGrath bmcgrath@codeweavers.com
This value is then made available through get_thread_count(). --- dlls/winegstreamer/main.c | 13 +++++++++++++ dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.c | 9 +++++++++ dlls/winegstreamer/unixlib.h | 1 + 4 files changed, 24 insertions(+)
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 747479daf40..596d8442630 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -907,8 +907,21 @@ static BOOL CALLBACK init_gstreamer_proc(INIT_ONCE *once, void *param, void **ct .trace_on = TRACE_ON(mfplat) || TRACE_ON(quartz) || TRACE_ON(wmvcore), .warn_on = WARN_ON(mfplat) || WARN_ON(quartz) || WARN_ON(wmvcore), .err_on = ERR_ON(mfplat) || ERR_ON(quartz) || ERR_ON(wmvcore), + .thread_count = 0, }; HINSTANCE handle; + DWORD_PTR process_mask; + int i; + + if (SUCCEEDED(NtQueryInformationProcess( GetCurrentProcess(), + ProcessAffinityMask, &process_mask, sizeof(process_mask), NULL ))) + { + for (i = 0; i < 8 * sizeof(process_mask); i++) + { + if (process_mask & 1 << i) + params.thread_count++; + } + }
if (WINE_UNIX_CALL(unix_wg_init_gstreamer, ¶ms)) return FALSE; diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 6f01b3a5a69..b9b974972f4 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -45,6 +45,7 @@ extern bool link_src_to_sink(GstPad *src_pad, GstPad *sink_pad); extern bool link_src_to_element(GstPad *src_pad, GstElement *element); extern bool link_element_to_sink(GstElement *element, GstPad *sink_pad); extern bool push_event(GstPad *pad, GstEvent *event); +extern UINT16 get_thread_count(void);
/* wg_format.c */
diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index 175ab92ecdc..b34f8593b94 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -47,6 +47,8 @@
GST_DEBUG_CATEGORY(wine);
+static UINT16 thread_count; + GstStreamType stream_type_from_caps(GstCaps *caps) { const gchar *media_type; @@ -262,6 +264,8 @@ NTSTATUS wg_init_gstreamer(void *arg) setenv("GST_DEBUG", "1", FALSE); setenv("GST_DEBUG_NO_COLOR", "1", FALSE);
+ thread_count = params->thread_count; + /* GStreamer installs a temporary SEGV handler when it loads plugins * to initialize its registry calling exit(-1) when any fault is caught. * We need to make sure any signal reaches our signal handlers to catch @@ -282,3 +286,8 @@ NTSTATUS wg_init_gstreamer(void *arg) gst_version_string(), GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO); return STATUS_SUCCESS; } + +UINT16 get_thread_count(void) +{ + return thread_count; +} diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 153b6c91306..69aed595efd 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -182,6 +182,7 @@ struct wg_init_gstreamer_params UINT8 trace_on; UINT8 warn_on; UINT8 err_on; + UINT16 thread_count; };
struct wg_parser_create_params