From: Ziqing Hui zhui@codeweavers.com
Since 1.20, gst_element_request_pad_simple is available and gst_element_get_request_pad is marked as deprecated. --- configure | 54 +++++++++++++++++++++++++++++++ configure.ac | 3 +- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.c | 35 ++++++++++++++++++++ include/config.h.in | 3 ++ 5 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/configure b/configure index db95cc3588d..3b5dee728ae 100755 --- a/configure +++ b/configure @@ -16992,6 +16992,60 @@ then : : fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lgstreamer-1.0" >&5 +printf %s "checking for -lgstreamer-1.0... " >&6; } +if test ${ac_cv_lib_soname_gstreamer_1_0+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_soname_save_LIBS=$LIBS +LIBS="-lgstreamer-1.0 $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char gst_init (); +int +main (void) +{ +return gst_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + case "$LIBEXT" in + dll) ac_cv_lib_soname_gstreamer_1_0=`$ac_cv_path_LDD conftest.exe | grep "gstreamer-1.0" | sed -e "s/dll.*/dll/"';2,$d'` ;; + dylib) ac_cv_lib_soname_gstreamer_1_0=`$OTOOL -L conftest$ac_exeext | grep "libgstreamer-1.0\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*/(libgstreamer-1.0.[0-9A-Za-z.]*dylib).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_gstreamer_1_0=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libgstreamer-1.0\.$LIBEXT" | sed -e "s/^.*\[\(libgstreamer-1.0\.$LIBEXT[^ ]*\)\].*$/\1/"';2,$d'` + if ${ac_cv_lib_soname_gstreamer_1_0:+false} : +then : + ac_cv_lib_soname_gstreamer_1_0=`$LDD conftest$ac_exeext | grep "libgstreamer-1.0\.$LIBEXT" | sed -e "s/^.*(libgstreamer-1.0.$LIBEXT[^ ]*).*$/\1/"';2,$d'` +fi ;; + esac +else $as_nop + ac_cv_lib_soname_gstreamer_1_0= +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if ${ac_cv_lib_soname_gstreamer_1_0:+false} : +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +printf "%s\n" "not found" >&6; } + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_gstreamer_1_0" >&5 +printf "%s\n" "$ac_cv_lib_soname_gstreamer_1_0" >&6; } + +printf "%s\n" "#define SONAME_LIBGSTREAMER_1_0 "$ac_cv_lib_soname_gstreamer_1_0"" >>confdefs.h + + +fi else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } diff --git a/configure.ac b/configure.ac index e17d28c8601..3b6e297528c 100644 --- a/configure.ac +++ b/configure.ac @@ -1588,7 +1588,8 @@ then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/gst.h>]], [[static int a[sizeof(gint64) > 4 ? 1 : -1]; if (a[0]) return 0;]])], [AC_MSG_RESULT([yes]) - AC_CHECK_LIB(gstreamer-1.0,gst_pad_new,[:],,[$GSTREAMER_LIBS])], + AC_CHECK_LIB(gstreamer-1.0,gst_pad_new,[:],,[$GSTREAMER_LIBS]) + WINE_CHECK_SONAME(gstreamer-1.0, gst_init)], [AC_MSG_RESULT([no]) ac_glib2_broken=yes enable_winegstreamer=${enable_winegstreamer:-no} diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 8bef7b2b2bd..b39252d4d9a 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -40,6 +40,7 @@ extern bool append_element(GstElement *container, GstElement *element, GstElemen extern bool link_src_to_element(GstPad *src_pad, GstElement *element) DECLSPEC_HIDDEN; extern bool link_element_to_sink(GstElement *element, GstPad *sink_pad) DECLSPEC_HIDDEN; extern bool push_event(GstPad *pad, GstEvent *event) DECLSPEC_HIDDEN; +extern GstPad *request_pad(GstElement *element, const char *name) DECLSPEC_HIDDEN;
/* wg_format.c */
diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index eca2bb8aacc..32311acaf7d 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -27,6 +27,7 @@ #include <assert.h> #include <stdarg.h> #include <stdio.h> +#include <dlfcn.h>
#include <gst/gst.h> #include <gst/video/video.h> @@ -47,6 +48,9 @@
GST_DEBUG_CATEGORY(wine);
+GstPad * (*pgst_element_request_pad_simple)(GstElement * element, const gchar * name); +GstPad * (*pgst_element_get_request_pad)(GstElement * element, const gchar * name); + GstStreamType stream_type_from_caps(GstCaps *caps) { const gchar *media_type; @@ -223,6 +227,25 @@ bool push_event(GstPad *pad, GstEvent *event) return true; }
+GstPad *request_pad(GstElement *element, const char *name) +{ + GstPad *pad = NULL; + + if (pgst_element_request_pad_simple) + pad = pgst_element_request_pad_simple(element, name); + else if (pgst_element_get_request_pad) + pad = pgst_element_get_request_pad(element, name); + + if (!pad) + { + gchar *element_name = gst_element_get_name(element); + GST_ERROR("Failed to request pad %s from element %s.", name, element_name); + g_free(element_name); + } + + return pad; +} + NTSTATUS wg_init_gstreamer(void *arg) { char arg0[] = "wine"; @@ -230,8 +253,20 @@ NTSTATUS wg_init_gstreamer(void *arg) char *args[] = {arg0, arg1, NULL}; int argc = ARRAY_SIZE(args) - 1; char **argv = args; + void *gst_handle; GError *err;
+ if (!(gst_handle = dlopen(SONAME_LIBGSTREAMER_1_0, RTLD_NOW))) + { + fprintf(stderr, "Failed to find gstreamer library: %s.\n", SONAME_LIBGSTREAMER_1_0); + return STATUS_DLL_NOT_FOUND; + } + +#define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(gst_handle, #f) + LOAD_OPTIONAL_FUNCPTR(gst_element_request_pad_simple); + LOAD_OPTIONAL_FUNCPTR(gst_element_get_request_pad); +#undef LOAD_OPTIONAL_FUNCPTR + if (!gst_init_check(&argc, &argv, &err)) { fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", err->message); diff --git a/include/config.h.in b/include/config.h.in index fa234a82f84..94684d09b49 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -744,6 +744,9 @@ /* Define to the soname of the libgssapi_krb5 library. */ #undef SONAME_LIBGSSAPI_KRB5
+/* Define to the soname of the libgstreamer-1.0 library. */ +#undef SONAME_LIBGSTREAMER_1_0 + /* Define to the soname of the libkrb5 library. */ #undef SONAME_LIBKRB5