winegstreamer: Update to use gstreamer-1.0.

Based on initial work by Rafał Mużyło.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2016-01-14 13:23:04 -06:00 committed by Alexandre Julliard
parent 99894cf37c
commit e8311270ab
8 changed files with 466 additions and 524 deletions

93
configure vendored
View File

@ -2290,9 +2290,11 @@ Some influential environment variables:
C compiler flags for libpulse, overriding pkg-config C compiler flags for libpulse, overriding pkg-config
PULSE_LIBS Linker flags for libpulse, overriding pkg-config PULSE_LIBS Linker flags for libpulse, overriding pkg-config
GSTREAMER_CFLAGS GSTREAMER_CFLAGS
C compiler flags for gstreamer-app-0.10, overriding pkg-config C compiler flags for gstreamer-1.0 gstreamer-video-1.0
gstreamer-audio-1.0, overriding pkg-config
GSTREAMER_LIBS GSTREAMER_LIBS
Linker flags for gstreamer-app-0.10, overriding pkg-config Linker flags for gstreamer-1.0 gstreamer-video-1.0
gstreamer-audio-1.0, overriding pkg-config
CAPI20_CFLAGS CAPI20_CFLAGS
C compiler flags for capi20, overriding pkg-config C compiler flags for capi20, overriding pkg-config
CAPI20_LIBS Linker flags for capi20, overriding pkg-config CAPI20_LIBS Linker flags for capi20, overriding pkg-config
@ -12591,19 +12593,19 @@ if test "x$with_gstreamer" != "xno"
then then
if ${GSTREAMER_CFLAGS:+false} :; then : if ${GSTREAMER_CFLAGS:+false} :; then :
if ${PKG_CONFIG+:} false; then : if ${PKG_CONFIG+:} false; then :
GSTREAMER_CFLAGS=`$PKG_CONFIG --cflags gstreamer-app-0.10 2>/dev/null` GSTREAMER_CFLAGS=`$PKG_CONFIG --cflags gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 2>/dev/null`
fi fi
fi fi
if ${GSTREAMER_LIBS:+false} :; then : if ${GSTREAMER_LIBS:+false} :; then :
if ${PKG_CONFIG+:} false; then : if ${PKG_CONFIG+:} false; then :
GSTREAMER_LIBS=`$PKG_CONFIG --libs gstreamer-app-0.10 2>/dev/null` GSTREAMER_LIBS=`$PKG_CONFIG --libs gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 2>/dev/null`
fi fi
fi fi
$as_echo "$as_me:${as_lineno-$LINENO}: gstreamer-app-0.10 cflags: $GSTREAMER_CFLAGS" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 cflags: $GSTREAMER_CFLAGS" >&5
$as_echo "$as_me:${as_lineno-$LINENO}: gstreamer-app-0.10 libs: $GSTREAMER_LIBS" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 libs: $GSTREAMER_LIBS" >&5
ac_save_CPPFLAGS=$CPPFLAGS ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $GSTREAMER_CFLAGS" CPPFLAGS="$CPPFLAGS $GSTREAMER_CFLAGS"
ac_gst_incl="" ac_gst_incl=""
@ -12617,13 +12619,13 @@ ac_gst_incl=""
CPPFLAGS="$ac_save_CPPFLAGS $GSTREAMER_CFLAGS" CPPFLAGS="$ac_save_CPPFLAGS $GSTREAMER_CFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "gst/gstpad.h" "ac_cv_header_gst_gstpad_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "gst/gstpad.h" "ac_cv_header_gst_gstpad_h" "$ac_includes_default"
if test "x$ac_cv_header_gst_gstpad_h" = xyes; then : if test "x$ac_cv_header_gst_gstpad_h" = xyes; then :
ac_fn_c_check_header_mongrel "$LINENO" "gst/app/gstappsink.h" "ac_cv_header_gst_app_gstappsink_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "gst/gst.h" "ac_cv_header_gst_gst_h" "$ac_includes_default"
if test "x$ac_cv_header_gst_app_gstappsink_h" = xyes; then : if test "x$ac_cv_header_gst_gst_h" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gint64 defined by gst/gst.h is indeed 64-bit" >&5
$as_echo_n "checking whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit... " >&6; } $as_echo_n "checking whether gint64 defined by gst/gst.h is indeed 64-bit... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <gst/app/gstappsink.h> #include <gst/gst.h>
int int
main () main ()
{ {
@ -12635,13 +12637,13 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gst_pad_get_caps_reffed in -lgstreamer-0.10" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gst_pad_new in -lgstreamer-1.0" >&5
$as_echo_n "checking for gst_pad_get_caps_reffed in -lgstreamer-0.10... " >&6; } $as_echo_n "checking for gst_pad_new in -lgstreamer-1.0... " >&6; }
if ${ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed+:} false; then : if ${ac_cv_lib_gstreamer_1_0_gst_pad_new+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
LIBS="-lgstreamer-0.10 $LIBS" LIBS="-lgstreamer-1.0 $GSTREAMER_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@ -12651,69 +12653,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
char gst_pad_get_caps_reffed (); char gst_pad_new ();
int int
main () main ()
{ {
return gst_pad_get_caps_reffed (); return gst_pad_new ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed=yes ac_cv_lib_gstreamer_1_0_gst_pad_new=yes
else else
ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed=no ac_cv_lib_gstreamer_1_0_gst_pad_new=no
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS LIBS=$ac_check_lib_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gstreamer_1_0_gst_pad_new" >&5
$as_echo "$ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed" >&6; } $as_echo "$ac_cv_lib_gstreamer_1_0_gst_pad_new" >&6; }
if test "x$ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed" = xyes; then : if test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gst_app_buffer_new in -lgstapp-0.10" >&5
$as_echo_n "checking for gst_app_buffer_new in -lgstapp-0.10... " >&6; }
if ${ac_cv_lib_gstapp_0_10_gst_app_buffer_new+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lgstapp-0.10 $GSTREAMER_LIBS $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. */
#ifdef __cplusplus
extern "C"
#endif
char gst_app_buffer_new ();
int
main ()
{
return gst_app_buffer_new ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_gstapp_0_10_gst_app_buffer_new=yes
else
ac_cv_lib_gstapp_0_10_gst_app_buffer_new=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gstapp_0_10_gst_app_buffer_new" >&5
$as_echo "$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" >&6; }
if test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes; then :
: :
fi fi
fi
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
@ -12732,15 +12695,15 @@ test -z "$GSTREAMER_CFLAGS" || GSTREAMER_CFLAGS=`echo " $GSTREAMER_CFLAGS" | sed
test -z "$GSTREAMER_LIBS" || GSTREAMER_LIBS=`echo " $GSTREAMER_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` test -z "$GSTREAMER_LIBS" || GSTREAMER_LIBS=`echo " $GSTREAMER_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'`
fi fi
if test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" != xyes -a "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes; then : if test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes -a "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes; then :
case "x$with_gstreamer" in case "x$with_gstreamer" in
x) as_fn_append wine_notices "|gstreamer-0.10 base plugins ${notice_platform}development files not found, gstreamer support disabled" ;; x) as_fn_append wine_notices "|gstreamer-1.0 base plugins ${notice_platform}development files not found, gstreamer support disabled" ;;
xno) ;; xno) ;;
*) as_fn_error $? "gstreamer-0.10 base plugins ${notice_platform}development files not found, gstreamer support disabled *) as_fn_error $? "gstreamer-1.0 base plugins ${notice_platform}development files not found, gstreamer support disabled
This is an error since --with-gstreamer was requested." "$LINENO" 5 ;; This is an error since --with-gstreamer was requested." "$LINENO" 5 ;;
esac esac
fi fi
test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no} test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no}
ALSA_LIBS="" ALSA_LIBS=""

View File

@ -1460,7 +1460,7 @@ test -n "$PULSE_LIBS" || enable_winepulse_drv=${enable_winepulse_drv:-no}
dnl **** Check for gstreamer **** dnl **** Check for gstreamer ****
if test "x$with_gstreamer" != "xno" if test "x$with_gstreamer" != "xno"
then then
WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-app-0.10],,,, WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0],,,,
[ac_gst_incl="" [ac_gst_incl=""
for i in $GSTREAMER_CFLAGS for i in $GSTREAMER_CFLAGS
do do
@ -1471,19 +1471,18 @@ then
GSTREAMER_CFLAGS=$ac_gst_incl GSTREAMER_CFLAGS=$ac_gst_incl
CPPFLAGS="$ac_save_CPPFLAGS $GSTREAMER_CFLAGS" CPPFLAGS="$ac_save_CPPFLAGS $GSTREAMER_CFLAGS"
AC_CHECK_HEADER([gst/gstpad.h], AC_CHECK_HEADER([gst/gstpad.h],
[AC_CHECK_HEADER([gst/app/gstappsink.h], [AC_CHECK_HEADER([gst/gst.h],
[AC_MSG_CHECKING([whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit]) [AC_MSG_CHECKING([whether gint64 defined by gst/gst.h is indeed 64-bit])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/app/gstappsink.h>]], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/gst.h>]],
[[static int a[sizeof(gint64) > 4 ? 1 : -1]; if (a[0]) return 0;]])], [[static int a[sizeof(gint64) > 4 ? 1 : -1]; if (a[0]) return 0;]])],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
AC_CHECK_LIB(gstreamer-0.10,gst_pad_get_caps_reffed, AC_CHECK_LIB(gstreamer-1.0,gst_pad_new,[:],,[$GSTREAMER_LIBS])],
[AC_CHECK_LIB(gstapp-0.10,gst_app_buffer_new,[:],,[$GSTREAMER_LIBS])])],
[AC_MSG_RESULT([no])])])], [AC_MSG_RESULT([no])])])],
[GSTREAMER_CFLAGS=""])]) [GSTREAMER_CFLAGS=""])])
fi fi
WINE_NOTICE_WITH(gstreamer,[test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" != xyes -a "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes], WINE_NOTICE_WITH(gstreamer,[test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes -a "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes],
[gstreamer-0.10 base plugins ${notice_platform}development files not found, gstreamer support disabled]) [gstreamer-1.0 base plugins ${notice_platform}development files not found, gstreamer support disabled])
test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no} test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no}
dnl **** Check for ALSA 1.x **** dnl **** Check for ALSA 1.x ****
AC_SUBST(ALSA_LIBS,"") AC_SUBST(ALSA_LIBS,"")

View File

@ -18,10 +18,7 @@
#include "config.h" #include "config.h"
#include <gst/app/gstappsink.h> #include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
#include <gst/gstutils.h>
#include "wine/list.h" #include "wine/list.h"
@ -88,35 +85,23 @@ GstBusSyncReply watch_bus_wrapper(GstBus *bus, GstMessage *msg, gpointer user)
return cbdata.u.watch_bus_data.ret; return cbdata.u.watch_bus_data.ret;
} }
void existing_new_pad_wrapper(GstElement *bin, GstPad *pad, gboolean last, void existing_new_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user)
gpointer user)
{ {
struct cb_data cbdata = { EXISTING_NEW_PAD }; struct cb_data cbdata = { EXISTING_NEW_PAD };
cbdata.u.existing_new_pad_data.bin = bin; cbdata.u.existing_new_pad_data.bin = bin;
cbdata.u.existing_new_pad_data.pad = pad; cbdata.u.existing_new_pad_data.pad = pad;
cbdata.u.existing_new_pad_data.last = last;
cbdata.u.existing_new_pad_data.user = user; cbdata.u.existing_new_pad_data.user = user;
call_cb(&cbdata); call_cb(&cbdata);
} }
gboolean check_get_range_wrapper(GstPad *pad) gboolean query_function_wrapper(GstPad *pad, GstObject *parent, GstQuery *query)
{
struct cb_data cbdata = { CHECK_GET_RANGE };
cbdata.u.check_get_range_data.pad = pad;
call_cb(&cbdata);
return cbdata.u.check_get_range_data.ret;
}
gboolean query_function_wrapper(GstPad *pad, GstQuery *query)
{ {
struct cb_data cbdata = { QUERY_FUNCTION }; struct cb_data cbdata = { QUERY_FUNCTION };
cbdata.u.query_function_data.pad = pad; cbdata.u.query_function_data.pad = pad;
cbdata.u.query_function_data.parent = parent;
cbdata.u.query_function_data.query = query; cbdata.u.query_function_data.query = query;
call_cb(&cbdata); call_cb(&cbdata);
@ -124,16 +109,18 @@ gboolean query_function_wrapper(GstPad *pad, GstQuery *query)
return cbdata.u.query_function_data.ret; return cbdata.u.query_function_data.ret;
} }
gboolean activate_push_wrapper(GstPad *pad, gboolean activate) gboolean activate_mode_wrapper(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean activate)
{ {
struct cb_data cbdata = { ACTIVATE_PUSH }; struct cb_data cbdata = { ACTIVATE_MODE };
cbdata.u.activate_push_data.pad = pad; cbdata.u.activate_mode_data.pad = pad;
cbdata.u.activate_push_data.activate = activate; cbdata.u.activate_mode_data.parent = parent;
cbdata.u.activate_mode_data.mode = mode;
cbdata.u.activate_mode_data.activate = activate;
call_cb(&cbdata); call_cb(&cbdata);
return cbdata.u.activate_push_data.ret; return cbdata.u.activate_mode_data.ret;
} }
void no_more_pads_wrapper(GstElement *decodebin, gpointer user) void no_more_pads_wrapper(GstElement *decodebin, gpointer user)
@ -146,12 +133,13 @@ void no_more_pads_wrapper(GstElement *decodebin, gpointer user)
call_cb(&cbdata); call_cb(&cbdata);
} }
GstFlowReturn request_buffer_src_wrapper(GstPad *pad, guint64 ofs, guint len, GstFlowReturn request_buffer_src_wrapper(GstPad *pad, GstObject *parent, guint64 ofs, guint len,
GstBuffer **buf) GstBuffer **buf)
{ {
struct cb_data cbdata = { REQUEST_BUFFER_SRC }; struct cb_data cbdata = { REQUEST_BUFFER_SRC };
cbdata.u.request_buffer_src_data.pad = pad; cbdata.u.request_buffer_src_data.pad = pad;
cbdata.u.request_buffer_src_data.parent = parent;
cbdata.u.request_buffer_src_data.ofs = ofs; cbdata.u.request_buffer_src_data.ofs = ofs;
cbdata.u.request_buffer_src_data.len = len; cbdata.u.request_buffer_src_data.len = len;
cbdata.u.request_buffer_src_data.buf = buf; cbdata.u.request_buffer_src_data.buf = buf;
@ -161,11 +149,12 @@ GstFlowReturn request_buffer_src_wrapper(GstPad *pad, guint64 ofs, guint len,
return cbdata.u.request_buffer_src_data.ret; return cbdata.u.request_buffer_src_data.ret;
} }
gboolean event_src_wrapper(GstPad *pad, GstEvent *event) gboolean event_src_wrapper(GstPad *pad, GstObject *parent, GstEvent *event)
{ {
struct cb_data cbdata = { EVENT_SRC }; struct cb_data cbdata = { EVENT_SRC };
cbdata.u.event_src_data.pad = pad; cbdata.u.event_src_data.pad = pad;
cbdata.u.event_src_data.parent = parent;
cbdata.u.event_src_data.event = event; cbdata.u.event_src_data.event = event;
call_cb(&cbdata); call_cb(&cbdata);
@ -173,11 +162,12 @@ gboolean event_src_wrapper(GstPad *pad, GstEvent *event)
return cbdata.u.event_src_data.ret; return cbdata.u.event_src_data.ret;
} }
gboolean event_sink_wrapper(GstPad *pad, GstEvent *event) gboolean event_sink_wrapper(GstPad *pad, GstObject *parent, GstEvent *event)
{ {
struct cb_data cbdata = { EVENT_SINK }; struct cb_data cbdata = { EVENT_SINK };
cbdata.u.event_sink_data.pad = pad; cbdata.u.event_sink_data.pad = pad;
cbdata.u.event_sink_data.parent = parent;
cbdata.u.event_sink_data.event = event; cbdata.u.event_sink_data.event = event;
call_cb(&cbdata); call_cb(&cbdata);
@ -185,22 +175,6 @@ gboolean event_sink_wrapper(GstPad *pad, GstEvent *event)
return cbdata.u.event_sink_data.ret; return cbdata.u.event_sink_data.ret;
} }
GstFlowReturn request_buffer_sink_wrapper(GstPad *pad, guint64 ofs, guint size,
GstCaps *caps, GstBuffer **buf)
{
struct cb_data cbdata = { REQUEST_BUFFER_SINK };
cbdata.u.request_buffer_sink_data.pad = pad;
cbdata.u.request_buffer_sink_data.ofs = ofs;
cbdata.u.request_buffer_sink_data.size = size;
cbdata.u.request_buffer_sink_data.caps = caps;
cbdata.u.request_buffer_sink_data.buf = buf;
call_cb(&cbdata);
return cbdata.u.request_buffer_sink_data.ret;
}
gboolean accept_caps_sink_wrapper(GstPad *pad, GstCaps *caps) gboolean accept_caps_sink_wrapper(GstPad *pad, GstCaps *caps)
{ {
struct cb_data cbdata = { ACCEPT_CAPS_SINK }; struct cb_data cbdata = { ACCEPT_CAPS_SINK };
@ -225,11 +199,12 @@ gboolean setcaps_sink_wrapper(GstPad *pad, GstCaps *caps)
return cbdata.u.setcaps_sink_data.ret; return cbdata.u.setcaps_sink_data.ret;
} }
GstFlowReturn got_data_sink_wrapper(GstPad *pad, GstBuffer *buf) GstFlowReturn got_data_sink_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf)
{ {
struct cb_data cbdata = { GOT_DATA_SINK }; struct cb_data cbdata = { GOT_DATA_SINK };
cbdata.u.got_data_sink_data.pad = pad; cbdata.u.got_data_sink_data.pad = pad;
cbdata.u.got_data_sink_data.parent = parent;
cbdata.u.got_data_sink_data.buf = buf; cbdata.u.got_data_sink_data.buf = buf;
call_cb(&cbdata); call_cb(&cbdata);
@ -237,11 +212,12 @@ GstFlowReturn got_data_sink_wrapper(GstPad *pad, GstBuffer *buf)
return cbdata.u.got_data_sink_data.ret; return cbdata.u.got_data_sink_data.ret;
} }
GstFlowReturn got_data_wrapper(GstPad *pad, GstBuffer *buf) GstFlowReturn got_data_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf)
{ {
struct cb_data cbdata = { GOT_DATA }; struct cb_data cbdata = { GOT_DATA };
cbdata.u.got_data_data.pad = pad; cbdata.u.got_data_data.pad = pad;
cbdata.u.got_data_data.parent = parent;
cbdata.u.got_data_data.buf = buf; cbdata.u.got_data_data.buf = buf;
call_cb(&cbdata); call_cb(&cbdata);
@ -249,22 +225,6 @@ GstFlowReturn got_data_wrapper(GstPad *pad, GstBuffer *buf)
return cbdata.u.got_data_data.ret; return cbdata.u.got_data_data.ret;
} }
GstFlowReturn request_buffer_wrapper(GstPad *pad, guint64 ofs, guint size,
GstCaps *caps, GstBuffer **buf)
{
struct cb_data cbdata = { REQUEST_BUFFER };
cbdata.u.request_buffer_data.pad = pad;
cbdata.u.request_buffer_data.ofs = ofs;
cbdata.u.request_buffer_data.size = size;
cbdata.u.request_buffer_data.caps = caps;
cbdata.u.request_buffer_data.buf = buf;
call_cb(&cbdata);
return cbdata.u.request_buffer_data.ret;
}
void removed_decoded_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) void removed_decoded_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user)
{ {
struct cb_data cbdata = { REMOVED_DECODED_PAD }; struct cb_data cbdata = { REMOVED_DECODED_PAD };
@ -323,3 +283,14 @@ void Gstreamer_transform_pad_added_wrapper(GstElement *filter, GstPad *pad, gpoi
call_cb(&cbdata); call_cb(&cbdata);
} }
gboolean query_sink_wrapper(GstPad *pad, GstObject *parent, GstQuery *query)
{
struct cb_data cbdata = { QUERY_SINK,
{ .query_sink_data = {pad, parent, query} }
};
call_cb(&cbdata);
return cbdata.u.query_sink_data.ret;
}

View File

@ -32,24 +32,22 @@ typedef enum {
enum CB_TYPE { enum CB_TYPE {
WATCH_BUS, WATCH_BUS,
EXISTING_NEW_PAD, EXISTING_NEW_PAD,
CHECK_GET_RANGE,
QUERY_FUNCTION, QUERY_FUNCTION,
ACTIVATE_PUSH, ACTIVATE_MODE,
NO_MORE_PADS, NO_MORE_PADS,
REQUEST_BUFFER_SRC, REQUEST_BUFFER_SRC,
EVENT_SRC, EVENT_SRC,
EVENT_SINK, EVENT_SINK,
REQUEST_BUFFER_SINK,
ACCEPT_CAPS_SINK, ACCEPT_CAPS_SINK,
SETCAPS_SINK, SETCAPS_SINK,
GOT_DATA_SINK, GOT_DATA_SINK,
GOT_DATA, GOT_DATA,
REQUEST_BUFFER,
REMOVED_DECODED_PAD, REMOVED_DECODED_PAD,
AUTOPLUG_BLACKLIST, AUTOPLUG_BLACKLIST,
UNKNOWN_TYPE, UNKNOWN_TYPE,
RELEASE_SAMPLE, RELEASE_SAMPLE,
TRANSFORM_PAD_ADDED TRANSFORM_PAD_ADDED,
QUERY_SINK
}; };
struct cb_data { struct cb_data {
@ -64,29 +62,28 @@ struct cb_data {
struct existing_new_pad_data { struct existing_new_pad_data {
GstElement *bin; GstElement *bin;
GstPad *pad; GstPad *pad;
gboolean last;
gpointer user; gpointer user;
} existing_new_pad_data; } existing_new_pad_data;
struct check_get_range_data {
GstPad *pad;
gboolean ret;
} check_get_range_data;
struct query_function_data { struct query_function_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
GstQuery *query; GstQuery *query;
gboolean ret; gboolean ret;
} query_function_data; } query_function_data;
struct activate_push_data { struct activate_mode_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
GstPadMode mode;
gboolean activate; gboolean activate;
gboolean ret; gboolean ret;
} activate_push_data; } activate_mode_data;
struct no_more_pads_data { struct no_more_pads_data {
GstElement *decodebin; GstElement *decodebin;
gpointer user; gpointer user;
} no_more_pads_data; } no_more_pads_data;
struct request_buffer_src_data { struct request_buffer_src_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
guint64 ofs; guint64 ofs;
guint len; guint len;
GstBuffer **buf; GstBuffer **buf;
@ -94,22 +91,16 @@ struct cb_data {
} request_buffer_src_data; } request_buffer_src_data;
struct event_src_data { struct event_src_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
GstEvent *event; GstEvent *event;
gboolean ret; gboolean ret;
} event_src_data; } event_src_data;
struct event_sink_data { struct event_sink_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
GstEvent *event; GstEvent *event;
gboolean ret; gboolean ret;
} event_sink_data; } event_sink_data;
struct request_buffer_sink_data {
GstPad *pad;
guint64 ofs;
guint size;
GstCaps *caps;
GstBuffer **buf;
GstFlowReturn ret;
} request_buffer_sink_data;
struct accept_caps_sink_data { struct accept_caps_sink_data {
GstPad *pad; GstPad *pad;
GstCaps *caps; GstCaps *caps;
@ -122,22 +113,16 @@ struct cb_data {
} setcaps_sink_data; } setcaps_sink_data;
struct got_data_sink_data { struct got_data_sink_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
GstBuffer *buf; GstBuffer *buf;
GstFlowReturn ret; GstFlowReturn ret;
} got_data_sink_data; } got_data_sink_data;
struct got_data_data { struct got_data_data {
GstPad *pad; GstPad *pad;
GstObject *parent;
GstBuffer *buf; GstBuffer *buf;
GstFlowReturn ret; GstFlowReturn ret;
} got_data_data; } got_data_data;
struct request_buffer_data {
GstPad *pad;
guint64 ofs;
guint size;
GstCaps *caps;
GstBuffer **buf;
GstFlowReturn ret;
} request_buffer_data;
struct removed_decoded_pad_data { struct removed_decoded_pad_data {
GstElement *bin; GstElement *bin;
GstPad *pad; GstPad *pad;
@ -165,6 +150,12 @@ struct cb_data {
GstPad *pad; GstPad *pad;
gpointer user; gpointer user;
} transform_pad_added_data; } transform_pad_added_data;
struct query_sink_data {
GstPad *pad;
GstObject *parent;
GstQuery *query;
gboolean ret;
} query_sink_data;
} u; } u;
int finished; int finished;
@ -181,24 +172,22 @@ BOOL is_wine_thread(void) DECLSPEC_HIDDEN;
void mark_wine_thread(void) DECLSPEC_HIDDEN; void mark_wine_thread(void) DECLSPEC_HIDDEN;
GstBusSyncReply watch_bus_wrapper(GstBus *bus, GstMessage *msg, gpointer user) DECLSPEC_HIDDEN; GstBusSyncReply watch_bus_wrapper(GstBus *bus, GstMessage *msg, gpointer user) DECLSPEC_HIDDEN;
void existing_new_pad_wrapper(GstElement *bin, GstPad *pad, gboolean last, gpointer user) DECLSPEC_HIDDEN; void existing_new_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
gboolean check_get_range_wrapper(GstPad *pad) DECLSPEC_HIDDEN; gboolean query_function_wrapper(GstPad *pad, GstObject *parent, GstQuery *query) DECLSPEC_HIDDEN;
gboolean query_function_wrapper(GstPad *pad, GstQuery *query) DECLSPEC_HIDDEN; gboolean activate_mode_wrapper(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean activate) DECLSPEC_HIDDEN;
gboolean activate_push_wrapper(GstPad *pad, gboolean activate) DECLSPEC_HIDDEN;
void no_more_pads_wrapper(GstElement *decodebin, gpointer user) DECLSPEC_HIDDEN; void no_more_pads_wrapper(GstElement *decodebin, gpointer user) DECLSPEC_HIDDEN;
GstFlowReturn request_buffer_src_wrapper(GstPad *pad, guint64 ofs, guint len, GstBuffer **buf) DECLSPEC_HIDDEN; GstFlowReturn request_buffer_src_wrapper(GstPad *pad, GstObject *parent, guint64 ofs, guint len, GstBuffer **buf) DECLSPEC_HIDDEN;
gboolean event_src_wrapper(GstPad *pad, GstEvent *event) DECLSPEC_HIDDEN; gboolean event_src_wrapper(GstPad *pad, GstObject *parent, GstEvent *event) DECLSPEC_HIDDEN;
gboolean event_sink_wrapper(GstPad *pad, GstEvent *event) DECLSPEC_HIDDEN; gboolean event_sink_wrapper(GstPad *pad, GstObject *parent, GstEvent *event) DECLSPEC_HIDDEN;
GstFlowReturn request_buffer_sink_wrapper(GstPad *pad, guint64 ofs, guint size, GstCaps *caps, GstBuffer **buf) DECLSPEC_HIDDEN;
gboolean accept_caps_sink_wrapper(GstPad *pad, GstCaps *caps) DECLSPEC_HIDDEN; gboolean accept_caps_sink_wrapper(GstPad *pad, GstCaps *caps) DECLSPEC_HIDDEN;
gboolean setcaps_sink_wrapper(GstPad *pad, GstCaps *caps) DECLSPEC_HIDDEN; gboolean setcaps_sink_wrapper(GstPad *pad, GstCaps *caps) DECLSPEC_HIDDEN;
GstFlowReturn got_data_sink_wrapper(GstPad *pad, GstBuffer *buf) DECLSPEC_HIDDEN; GstFlowReturn got_data_sink_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf) DECLSPEC_HIDDEN;
GstFlowReturn got_data_wrapper(GstPad *pad, GstBuffer *buf) DECLSPEC_HIDDEN; GstFlowReturn got_data_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf) DECLSPEC_HIDDEN;
GstFlowReturn request_buffer_wrapper(GstPad *pad, guint64 ofs, guint size, GstCaps *caps, GstBuffer **buf) DECLSPEC_HIDDEN;
void removed_decoded_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) DECLSPEC_HIDDEN; void removed_decoded_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
GstAutoplugSelectResult autoplug_blacklist_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) DECLSPEC_HIDDEN; GstAutoplugSelectResult autoplug_blacklist_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) DECLSPEC_HIDDEN;
void unknown_type_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer user) DECLSPEC_HIDDEN; void unknown_type_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer user) DECLSPEC_HIDDEN;
void release_sample_wrapper(gpointer data) DECLSPEC_HIDDEN; void release_sample_wrapper(gpointer data) DECLSPEC_HIDDEN;
void Gstreamer_transform_pad_added_wrapper(GstElement *filter, GstPad *pad, gpointer user) DECLSPEC_HIDDEN; void Gstreamer_transform_pad_added_wrapper(GstElement *filter, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
gboolean query_sink_wrapper(GstPad *pad, GstObject *parent, GstQuery *query) DECLSPEC_HIDDEN;
#endif #endif

View File

@ -44,10 +44,12 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr)
DWORD Gstreamer_init(void); DWORD Gstreamer_init(void);
GstFlowReturn got_data(GstPad *pad, GstBuffer *buf) DECLSPEC_HIDDEN; GstFlowReturn got_data(GstPad *pad, GstObject *parent, GstBuffer *buf) DECLSPEC_HIDDEN;
GstFlowReturn request_buffer(GstPad *pad, guint64 ofs, guint size, GstCaps *caps, GstBuffer **buf) DECLSPEC_HIDDEN; GstFlowReturn request_buffer(GstPad *pad, guint64 ofs, guint size, GstCaps *caps, GstBuffer **buf) DECLSPEC_HIDDEN;
void Gstreamer_transform_pad_added(GstElement *filter, GstPad *pad, gpointer user) DECLSPEC_HIDDEN; void Gstreamer_transform_pad_added(GstElement *filter, GstPad *pad, gpointer user) DECLSPEC_HIDDEN;
void start_dispatch_thread(void) DECLSPEC_HIDDEN; void start_dispatch_thread(void) DECLSPEC_HIDDEN;
extern const char *media_quark_string DECLSPEC_HIDDEN;
#endif /* __GST_PRIVATE_INCLUDED__ */ #endif /* __GST_PRIVATE_INCLUDED__ */

File diff suppressed because it is too large Load Diff

View File

@ -22,9 +22,9 @@
#include "config.h" #include "config.h"
#include <gst/app/gstappsink.h> #include <gst/gst.h>
#include <gst/app/gstappsrc.h> #include <gst/video/video.h>
#include <gst/app/gstappbuffer.h> #include <gst/audio/audio.h>
#include "gst_private.h" #include "gst_private.h"
#include "gst_guids.h" #include "gst_guids.h"
@ -97,7 +97,7 @@ static const char *Gstreamer_FindMatch(const char *strcaps)
data.caps = caps; data.caps = caps;
data.type = "Decoder"; data.type = "Decoder";
copy = gst_default_registry_feature_filter(match_element, 0, &data); copy = gst_registry_feature_filter(gst_registry_get(), match_element, 0, &data);
for (list = copy; list; list = list->next) { for (list = copy; list; list = list->next) {
GstElementFactory *factory = (GstElementFactory*)list->data; GstElementFactory *factory = (GstElementFactory*)list->data;
guint rank; guint rank;
@ -155,18 +155,39 @@ static HRESULT WINAPI Gstreamer_transform_DecideBufferSize(TransformFilter *tf,
return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual); return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
} }
GstFlowReturn got_data(GstPad *pad, GstBuffer *buf) GstFlowReturn got_data(GstPad *pad, GstObject *parent, GstBuffer *buf)
{ {
GstTfImpl *This = gst_pad_get_element_private(pad); GstTfImpl *This = gst_pad_get_element_private(pad);
IMediaSample *sample = GST_APP_BUFFER(buf)->priv; IMediaSample *sample = (IMediaSample *) gst_mini_object_get_qdata(GST_MINI_OBJECT(buf), g_quark_from_static_string(media_quark_string));
REFERENCE_TIME tStart, tStop; REFERENCE_TIME tStart, tStop;
HRESULT hr; HRESULT hr;
TRACE("%p, %p\n", pad, buf); TRACE("%p, %p\n", pad, buf);
if (GST_BUFFER_TIMESTAMP_IS_VALID(buf) && if(!sample){
GstMapInfo info;
BYTE *ptr;
gst_buffer_map(buf, &info, GST_MAP_READ);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &sample, NULL, NULL, 0);
if (FAILED(hr)) {
ERR("Could not get output buffer: %08x\n", hr);
return GST_FLOW_FLUSHING;
}
IMediaSample_SetActualDataLength(sample, info.size);
IMediaSample_GetPointer(sample, &ptr);
memcpy(ptr, info.data, info.size);
gst_buffer_unmap(buf, &info);
}
if (GST_BUFFER_PTS_IS_VALID(buf) &&
GST_BUFFER_DURATION_IS_VALID(buf)) { GST_BUFFER_DURATION_IS_VALID(buf)) {
tStart = buf->timestamp / 100; tStart = buf->pts / 100;
tStop = tStart + buf->duration / 100; tStop = tStart + buf->duration / 100;
IMediaSample_SetTime(sample, &tStart, &tStop); IMediaSample_SetTime(sample, &tStart, &tStop);
} }
@ -182,45 +203,15 @@ GstFlowReturn got_data(GstPad *pad, GstBuffer *buf)
IMediaSample_SetMediaTime(sample, NULL, NULL); IMediaSample_SetMediaTime(sample, NULL, NULL);
IMediaSample_SetDiscontinuity(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DISCONT)); IMediaSample_SetDiscontinuity(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DISCONT));
IMediaSample_SetPreroll(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_PREROLL)); IMediaSample_SetPreroll(sample, GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_LIVE));
IMediaSample_SetSyncPoint(sample, !GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT)); IMediaSample_SetSyncPoint(sample, !GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT));
IMediaSample_SetActualDataLength(sample, GST_BUFFER_SIZE(buf)); IMediaSample_SetActualDataLength(sample, gst_buffer_get_size(buf));
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], sample); hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], sample);
IMediaSample_Release(sample);
gst_buffer_unref(buf); gst_buffer_unref(buf);
if (FAILED(hr)) if (FAILED(hr))
return GST_FLOW_WRONG_STATE; return GST_FLOW_FLUSHING;
if (hr != S_OK)
return GST_FLOW_RESEND;
return GST_FLOW_OK;
}
GstFlowReturn request_buffer(GstPad *pad, guint64 ofs, guint size, GstCaps *caps, GstBuffer **buf)
{
GstTfImpl *This = gst_pad_get_element_private(pad);
IMediaSample *sample;
BYTE *ptr;
HRESULT hr;
TRACE("%p %s %u %p %p\n", pad, wine_dbgstr_longlong(ofs), size, caps, buf);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &sample, NULL, NULL, 0);
if (FAILED(hr)) {
ERR("Could not get output buffer: %08x\n", hr);
return GST_FLOW_WRONG_STATE;
}
IMediaSample_SetActualDataLength(sample, size);
IMediaSample_GetPointer(sample, &ptr);
*buf = gst_app_buffer_new(ptr, size, release_sample_wrapper, sample);
if (!*buf) {
IMediaSample_Release(sample);
ERR("Out of memory\n");
return GST_FLOW_ERROR;
}
if (!caps)
caps = gst_pad_get_caps_reffed(This->my_sink);
gst_buffer_set_caps(*buf, caps);
return GST_FLOW_OK; return GST_FLOW_OK;
} }
@ -231,6 +222,7 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
BYTE *data; BYTE *data;
GstBuffer *buf; GstBuffer *buf;
HRESULT hr; HRESULT hr;
DWORD bufsize;
int ret; int ret;
TRACE("%p, %p\n", This, sample); TRACE("%p, %p\n", This, sample);
@ -239,17 +231,23 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
EnterCriticalSection(&This->tf.csReceive); EnterCriticalSection(&This->tf.csReceive);
IMediaSample_GetPointer(sample, &data); IMediaSample_GetPointer(sample, &data);
buf = gst_app_buffer_new(data, IMediaSample_GetActualDataLength(sample), release_sample_wrapper, sample);
IMediaSample_AddRef(sample);
bufsize = IMediaSample_GetActualDataLength(sample);
buf = gst_buffer_new_wrapped_full(0, data, bufsize, 0, bufsize, sample, release_sample_wrapper);
if (!buf) { if (!buf) {
IMediaSample_Release(sample);
LeaveCriticalSection(&This->tf.csReceive); LeaveCriticalSection(&This->tf.csReceive);
return S_OK; return S_OK;
} }
gst_buffer_set_caps(buf, gst_pad_get_caps_reffed(This->my_src));
IMediaSample_AddRef(sample); IMediaSample_AddRef(sample);
buf->duration = buf->timestamp = -1; gst_mini_object_set_qdata(GST_MINI_OBJECT(buf), g_quark_from_static_string(media_quark_string), sample, release_sample_wrapper);
buf->duration = buf->pts = -1;
hr = IMediaSample_GetTime(sample, &tStart, &tStop); hr = IMediaSample_GetTime(sample, &tStart, &tStop);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
buf->timestamp = tStart * 100; buf->pts = tStart * 100;
if (hr == S_OK) if (hr == S_OK)
buf->duration = (tStop - tStart)*100; buf->duration = (tStop - tStart)*100;
} }
@ -260,19 +258,15 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
if (IMediaSample_IsDiscontinuity(sample) == S_OK) if (IMediaSample_IsDiscontinuity(sample) == S_OK)
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DISCONT);
if (IMediaSample_IsPreroll(sample) == S_OK) if (IMediaSample_IsPreroll(sample) == S_OK)
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_PREROLL); GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_LIVE);
if (IMediaSample_IsSyncPoint(sample) != S_OK) if (IMediaSample_IsSyncPoint(sample) != S_OK)
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT); GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT);
LeaveCriticalSection(&This->tf.csReceive); LeaveCriticalSection(&This->tf.csReceive);
ret = gst_pad_push(This->my_src, buf); ret = gst_pad_push(This->my_src, buf);
if (ret) if (ret)
WARN("Sending returned: %i\n", ret); WARN("Sending returned: %i\n", ret);
if (ret == GST_FLOW_ERROR) if (ret == GST_FLOW_FLUSHING)
return E_FAIL;
if (ret == GST_FLOW_WRONG_STATE)
return VFW_E_WRONG_STATE; return VFW_E_WRONG_STATE;
if (ret == GST_FLOW_RESEND)
return S_FALSE;
return S_OK; return S_OK;
} }
@ -304,9 +298,6 @@ void Gstreamer_transform_pad_added(GstElement *filter, GstPad *pad, gpointer use
if (ret < 0) if (ret < 0)
WARN("Failed to link with %i\n", ret); WARN("Failed to link with %i\n", ret);
This->their_src = pad; This->their_src = pad;
gst_pad_set_active(pad, TRUE);
gst_pad_set_active(This->my_sink, TRUE);
} }
static HRESULT Gstreamer_transform_ConnectInput(GstTfImpl *This, const AM_MEDIA_TYPE *amt, GstCaps *capsin, GstCaps *capsout) static HRESULT Gstreamer_transform_ConnectInput(GstTfImpl *This, const AM_MEDIA_TYPE *amt, GstCaps *capsin, GstCaps *capsout)
@ -324,36 +315,27 @@ static HRESULT Gstreamer_transform_ConnectInput(GstTfImpl *This, const AM_MEDIA_
FIXME("Could not make %s filter\n", This->gstreamer_name); FIXME("Could not make %s filter\n", This->gstreamer_name);
return E_FAIL; return E_FAIL;
} }
This->my_src = gst_pad_new(NULL, GST_PAD_SRC); This->my_src = gst_pad_new("yuvsrc", GST_PAD_SRC);
gst_pad_set_element_private (This->my_src, This); gst_pad_set_element_private (This->my_src, This);
gst_pad_set_active(This->my_src, 1);
This->my_sink = gst_pad_new(NULL, GST_PAD_SINK); This->my_sink = gst_pad_new("yuvsink", GST_PAD_SINK);
gst_pad_set_chain_function(This->my_sink, got_data_wrapper); gst_pad_set_chain_function(This->my_sink, got_data_wrapper);
gst_pad_set_bufferalloc_function(This->my_sink, request_buffer_wrapper);
gst_pad_set_element_private (This->my_sink, This); gst_pad_set_element_private (This->my_sink, This);
gst_pad_set_active(This->my_sink, 1);
ret = gst_pad_set_caps(This->my_src, capsin);
if (ret < 0) {
WARN("Failed to set caps on own source with %i\n", ret);
return E_FAIL;
}
ret = gst_pad_set_caps(This->my_sink, capsout);
if (ret < 0) {
WARN("Failed to set caps on own sink with %i\n", ret);
return E_FAIL;
}
it = gst_element_iterate_sink_pads(This->filter); it = gst_element_iterate_sink_pads(This->filter);
while (!done) { while (!done) {
gpointer item; GValue item = {0};
switch (gst_iterator_next(it, &item)) { switch (gst_iterator_next(it, &item)) {
case GST_ITERATOR_RESYNC: case GST_ITERATOR_RESYNC:
gst_iterator_resync (it); gst_iterator_resync (it);
break; break;
case GST_ITERATOR_OK: case GST_ITERATOR_OK:
This->their_sink = item; This->their_sink = g_value_get_object(&item);
gst_object_ref(This->their_sink);
g_value_reset(&item);
case GST_ITERATOR_ERROR: case GST_ITERATOR_ERROR:
case GST_ITERATOR_DONE: case GST_ITERATOR_DONE:
done = TRUE; done = TRUE;
@ -370,14 +352,16 @@ static HRESULT Gstreamer_transform_ConnectInput(GstTfImpl *This, const AM_MEDIA_
gst_iterator_resync(it); gst_iterator_resync(it);
done = FALSE; done = FALSE;
while (!done) { while (!done) {
gpointer item; GValue item = {0};
switch (gst_iterator_next(it, &item)) { switch (gst_iterator_next(it, &item)) {
case GST_ITERATOR_RESYNC: case GST_ITERATOR_RESYNC:
gst_iterator_resync (it); gst_iterator_resync (it);
break; break;
case GST_ITERATOR_OK: case GST_ITERATOR_OK:
This->their_src = item; This->their_src = g_value_get_object(&item);
gst_object_ref(This->their_src);
g_value_reset(&item);
case GST_ITERATOR_ERROR: case GST_ITERATOR_ERROR:
case GST_ITERATOR_DONE: case GST_ITERATOR_DONE:
done = TRUE; done = TRUE;
@ -394,12 +378,24 @@ static HRESULT Gstreamer_transform_ConnectInput(GstTfImpl *This, const AM_MEDIA_
return E_FAIL; return E_FAIL;
} }
ret = gst_pad_set_caps(This->my_src, capsin);
if (ret < 0) {
WARN("Failed to set caps on own source with %i\n", ret);
return E_FAIL;
}
if (found) if (found)
Gstreamer_transform_pad_added(This->filter, This->their_src, This); Gstreamer_transform_pad_added(This->filter, This->their_src, This);
if (!gst_pad_is_linked(This->my_sink)) if (!gst_pad_is_linked(This->my_sink))
return E_FAIL; return E_FAIL;
ret = gst_pad_set_caps(This->my_sink, capsout);
if (ret < 0) {
WARN("Failed to set caps on own sink with %i\n", ret);
return E_FAIL;
}
TRACE("Connected\n"); TRACE("Connected\n");
return S_OK; return S_OK;
} }
@ -422,10 +418,12 @@ static HRESULT WINAPI Gstreamer_transform_Cleanup(TransformFilter *tf, PIN_DIREC
if (This->my_src) { if (This->my_src) {
gst_pad_unlink(This->my_src, This->their_sink); gst_pad_unlink(This->my_src, This->their_sink);
gst_object_unref(This->my_src); gst_object_unref(This->my_src);
gst_object_unref(This->their_sink);
} }
if (This->my_sink) { if (This->my_sink) {
gst_pad_unlink(This->their_src, This->my_sink); gst_pad_unlink(This->their_src, This->my_sink);
gst_object_unref(This->my_sink); gst_object_unref(This->my_sink);
gst_object_unref(This->their_src);
} }
This->my_sink = This->my_src = This->their_sink = This->their_src = NULL; This->my_sink = This->my_src = This->their_sink = This->their_src = NULL;
} }
@ -458,18 +456,20 @@ static HRESULT WINAPI Gstreamer_transform_EndFlush(TransformFilter *iface)
TRACE("%p\n", This); TRACE("%p\n", This);
mark_wine_thread(); mark_wine_thread();
gst_pad_push_event(This->my_src, gst_event_new_flush_stop()); gst_pad_push_event(This->my_src, gst_event_new_flush_stop(TRUE));
return S_OK; return S_OK;
} }
static HRESULT WINAPI Gstreamer_transform_NewSegment(TransformFilter *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) static HRESULT WINAPI Gstreamer_transform_NewSegment(TransformFilter *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{ {
GstTfImpl *This = (GstTfImpl*)iface; GstTfImpl *This = (GstTfImpl*)iface;
const GstSegment segment = { GST_SEGMENT_FLAG_NONE, 1.0, dRate, GST_FORMAT_TIME, 0, 0, 0, tStop <= tStart ? -1 : tStop * 100, 0, tStart*100, -1 };
TRACE("%p\n", This); TRACE("%p\n", This);
mark_wine_thread(); mark_wine_thread();
gst_pad_push_event(This->my_src, gst_event_new_new_segment_full(1, gst_pad_push_event(This->my_src, gst_event_new_segment(&segment));
1.0, dRate, GST_FORMAT_TIME, 0, tStop <= tStart ? -1 : tStop * 100, tStart*100));
return S_OK; return S_OK;
} }
@ -484,7 +484,7 @@ static HRESULT WINAPI Gstreamer_transform_QOS(TransformFilter *iface, IBaseFilte
if (qm.Late < 0 && -qm.Late > qm.TimeStamp) if (qm.Late < 0 && -qm.Late > qm.TimeStamp)
late = -qm.TimeStamp; late = -qm.TimeStamp;
gst_pad_push_event(This->my_sink, gst_event_new_qos(1000. / qm.Proportion, late * 100, qm.TimeStamp * 100)); gst_pad_push_event(This->my_sink, gst_event_new_qos(late <= 0 ? GST_QOS_TYPE_OVERFLOW : GST_QOS_TYPE_UNDERFLOW, 1000. / qm.Proportion, late * 100, qm.TimeStamp * 100));
return TransformFilterImpl_Notify(iface, sender, qm); return TransformFilterImpl_Notify(iface, sender, qm);
} }
@ -515,8 +515,9 @@ static HRESULT WINAPI Gstreamer_Mp3_QueryConnect(TransformFilter *iface, const A
!IsEqualGUID(&amt->majortype, &MEDIATYPE_Stream)) || !IsEqualGUID(&amt->majortype, &MEDIATYPE_Stream)) ||
(!IsEqualGUID(&amt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload) && (!IsEqualGUID(&amt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload) &&
!IsEqualGUID(&amt->subtype, &WMMEDIASUBTYPE_MP3)) !IsEqualGUID(&amt->subtype, &WMMEDIASUBTYPE_MP3))
|| !IsEqualGUID(&amt->formattype, &FORMAT_WaveFormatEx)) || !IsEqualGUID(&amt->formattype, &FORMAT_WaveFormatEx)){
return S_FALSE; return S_FALSE;
}
return S_OK; return S_OK;
} }
@ -578,11 +579,8 @@ static HRESULT WINAPI Gstreamer_Mp3_SetMediaType(TransformFilter *tf, PIN_DIRECT
"rate", G_TYPE_INT, wfx->nSamplesPerSec, "rate", G_TYPE_INT, wfx->nSamplesPerSec,
"channels", G_TYPE_INT, wfx->nChannels, "channels", G_TYPE_INT, wfx->nChannels,
NULL); NULL);
capsout = gst_caps_new_simple("audio/x-raw-int", capsout = gst_caps_new_simple("audio/x-raw",
"endianness", G_TYPE_INT, 1234, "format", G_TYPE_STRING, "S16LE"
"signed", G_TYPE_BOOLEAN, 1,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, wfx->nSamplesPerSec, "rate", G_TYPE_INT, wfx->nSamplesPerSec,
"channels", G_TYPE_INT, wfx->nChannels, "channels", G_TYPE_INT, wfx->nChannels,
NULL); NULL);
@ -727,22 +725,19 @@ static HRESULT WINAPI Gstreamer_YUV_SetMediaType(TransformFilter *tf, PIN_DIRECT
outpmt->subtype = MEDIASUBTYPE_RGB24; outpmt->subtype = MEDIASUBTYPE_RGB24;
capsin = gst_caps_new_simple("video/x-raw-yuv", capsin = gst_caps_new_simple("video/x-raw",
"format", GST_TYPE_FOURCC, amt->subtype.Data1, "format", G_TYPE_STRING,
gst_video_format_to_string(
gst_video_format_from_fourcc(amt->subtype.Data1)),
"width", G_TYPE_INT, width, "width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "height", G_TYPE_INT, height,
"framerate", GST_TYPE_FRACTION, 10000000, avgtime, "framerate", GST_TYPE_FRACTION, 10000000, avgtime,
NULL); NULL);
capsout = gst_caps_new_simple("video/x-raw-rgb", capsout = gst_caps_new_simple("video/x-raw",
"endianness", G_TYPE_INT, 4321, "format", G_TYPE_STRING, "BGR",
"width", G_TYPE_INT, width, "width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "height", G_TYPE_INT, height,
"framerate", GST_TYPE_FRACTION, 10000000, avgtime, "framerate", GST_TYPE_FRACTION, 10000000, avgtime,
"bpp", G_TYPE_INT, 24,
"depth", G_TYPE_INT, 24,
"red_mask", G_TYPE_INT, 0xff,
"green_mask", G_TYPE_INT, 0xff00,
"blue_mask", G_TYPE_INT, 0xff0000,
NULL); NULL);
hr = Gstreamer_transform_ConnectInput(This, amt, capsin, capsout); hr = Gstreamer_transform_ConnectInput(This, amt, capsin, capsout);
@ -781,7 +776,7 @@ IUnknown * CALLBACK Gstreamer_YUV_create(IUnknown *punkouter, HRESULT *phr)
return NULL; return NULL;
} }
*phr = Gstreamer_transform_create(punkouter, &CLSID_Gstreamer_YUV, "ffmpegcolorspace", &Gstreamer_YUV_vtbl, (LPVOID*)&obj); *phr = Gstreamer_transform_create(punkouter, &CLSID_Gstreamer_YUV, "videoconvert", &Gstreamer_YUV_vtbl, (LPVOID*)&obj);
TRACE("returning %p\n", obj); TRACE("returning %p\n", obj);
@ -815,6 +810,7 @@ static HRESULT WINAPI Gstreamer_AudioConvert_SetMediaType(TransformFilter *tf, P
WAVEFORMATEX *inwfe; WAVEFORMATEX *inwfe;
WAVEFORMATEX *outwfe; WAVEFORMATEX *outwfe;
WAVEFORMATEXTENSIBLE *outwfx; WAVEFORMATEXTENSIBLE *outwfx;
GstAudioFormat format;
HRESULT hr; HRESULT hr;
BOOL inisfloat = FALSE; BOOL inisfloat = FALSE;
int indepth; int indepth;
@ -844,10 +840,12 @@ static HRESULT WINAPI Gstreamer_AudioConvert_SetMediaType(TransformFilter *tf, P
indepth = inwfx->Samples.wValidBitsPerSample; indepth = inwfx->Samples.wValidBitsPerSample;
} }
capsin = gst_caps_new_simple(inisfloat ? "audio/x-raw-float" : "audio/x-raw-int", format = inisfloat ? (inwfe->wBitsPerSample == 64 ? GST_AUDIO_FORMAT_F64LE : GST_AUDIO_FORMAT_F32LE)
"endianness", G_TYPE_INT, 1234, : gst_audio_format_build_integer(inwfe->wBitsPerSample == 8 ? FALSE : TRUE,
"width", G_TYPE_INT, inwfe->wBitsPerSample, inwfe->wBitsPerSample,
"depth", G_TYPE_INT, indepth, indepth, G_LITTLE_ENDIAN);
capsin = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, gst_audio_format_to_string(format),
"channels", G_TYPE_INT, inwfe->nChannels, "channels", G_TYPE_INT, inwfe->nChannels,
"rate", G_TYPE_INT, inwfe->nSamplesPerSec, "rate", G_TYPE_INT, inwfe->nSamplesPerSec,
NULL); NULL);
@ -865,14 +863,13 @@ static HRESULT WINAPI Gstreamer_AudioConvert_SetMediaType(TransformFilter *tf, P
outwfx->dwChannelMask = SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT; outwfx->dwChannelMask = SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT;
outwfx->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; outwfx->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
capsout = gst_caps_new_simple("audio/x-raw-int", capsout = gst_caps_new_simple("audio/x-raw",
"endianness", G_TYPE_INT, 1234, "format", G_TYPE_STRING, "S16LE",
"width", G_TYPE_INT, outwfe->wBitsPerSample,
"depth", G_TYPE_INT, outwfx->Samples.wValidBitsPerSample,
"channels", G_TYPE_INT, outwfe->nChannels, "channels", G_TYPE_INT, outwfe->nChannels,
"rate", G_TYPE_INT, outwfe->nSamplesPerSec, "rate", G_TYPE_INT, outwfe->nSamplesPerSec,
NULL); NULL);
hr = Gstreamer_transform_ConnectInput(This, amt, capsin, capsout); hr = Gstreamer_transform_ConnectInput(This, amt, capsin, capsout);
gst_caps_unref(capsin); gst_caps_unref(capsin);
gst_caps_unref(capsout); gst_caps_unref(capsout);

View File

@ -22,9 +22,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <gst/app/gstappsink.h> #include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"