From: Víctor Manuel Jáquez Leal Date: Tue, 21 May 2013 16:42:39 +0000 (-0400) Subject: plugins: initial port to GStreamer 1.2. X-Git-Tag: 0.5.7~62 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f75762d910097f0fe4f730fad3dc9ff1d4985438;p=platform%2Fupstream%2Fgstreamer-vaapi.git plugins: initial port to GStreamer 1.2. Port vaapidecode and vaapisink plugins to GStreamer API >= 1.2. This is rather minimalistic so that to test the basic functionality. Disable vaapipostproc plugin for now as further polishing is needed. Also disable GstVideoContext interface support since this API is now gone in 1.2.x. This is preparatory work for GstContext support. https://bugzilla.gnome.org/show_bug.cgi?id=703235 Signed-off-by: Gwenole Beauchesne --- diff --git a/configure.ac b/configure.ac index 3ff07bd..2767349 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,9 @@ m4_define([gst0_plugins_bad_version], [0.10.22]) m4_define([gst1_version], [1.0.0]) m4_define([gst1_plugins_base_version], [1.0.0]) m4_define([gst1_plugins_bad_version], [1.0.0]) +m4_define([gst12_version], [1.1.0]) +m4_define([gst12_plugins_base_version], [1.1.0]) +m4_define([gst12_plugins_bad_version], [1.1.0]) # Wayland minimum version number m4_define([wayland_api_version], [1.0.0]) @@ -158,6 +161,11 @@ case $GST_API_VERSION in GST_PLUGINS_BASE_VERSION_REQUIRED=gst1_plugins_base_version GST_PLUGINS_BAD_VERSION_REQUIRED=gst1_plugins_bad_version ;; +1.2) + GST_VERSION_REQUIRED=gst12_version + GST_PLUGINS_BASE_VERSION_REQUIRED=gst12_plugins_base_version + GST_PLUGINS_BAD_VERSION_REQUIRED=gst12_plugins_bad_version + ;; *) AC_MSG_ERROR([unsupported GStreamer API version $GST_API_VERSION]) ;; @@ -169,12 +177,22 @@ AC_SUBST(GST_PLUGINS_BAD_VERSION_REQUIRED) USE_GST_API_0_10="no" USE_GST_API_1_0p="no" +USE_GST_API_1_2p="no" AS_VERSION_COMPARE([$GST_API_VERSION], [0.10], [], [USE_GST_API_0_10="yes"], []) AS_VERSION_COMPARE([$GST_API_VERSION], [1.0], [], [USE_GST_API_1_0p="yes"], [USE_GST_API_1_0p="yes"]) +AS_VERSION_COMPARE([$GST_API_VERSION], [1.2], + [], [USE_GST_API_1_2p="yes"], [USE_GST_API_1_2p="yes"]) AM_CONDITIONAL([USE_GST_API_0_10], [test "$USE_GST_API_0_10" = "yes"]) AM_CONDITIONAL([USE_GST_API_1_0p], [test "$USE_GST_API_1_0p" = "yes"]) +AM_CONDITIONAL([USE_GST_API_1_2p], [test "$USE_GST_API_1_2p" = "yes"]) + +dnl XXX: GStreamer 1.2.x APIs don't have their own namespace yet +GST_API_VERSION_ORIG=$GST_API_VERSION +if test "$USE_GST_API_1_2p" = "yes"; then + GST_API_VERSION="1.0" +fi dnl GStreamer Core PKG_CHECK_MODULES([GST], @@ -288,9 +306,11 @@ AC_CACHE_CHECK([for GstVideoDecoder], AM_CONDITIONAL([USE_LOCAL_GST_VIDEO_DECODER], [test "$ac_cv_have_gst_video_decoder" != "yes"]) -dnl GStreamer -bad plugins +dnl GStreamer -bad plugins (deprecated in GStreamer v1.2) +if test "$USE_GST_API_1_2p" != "yes"; then PKG_CHECK_MODULES([GST_BASEVIDEO], [gstreamer-basevideo-$GST_API_VERSION >= $GST_PLUGINS_BAD_VERSION_REQUIRED]) +fi dnl ... bitstream parsers if test "$enable_builtin_codecparsers" = "yes"; then @@ -759,7 +779,7 @@ AS_IF([test $USE_WAYLAND -eq 1], [VIDEO_OUTPUTS="$VIDEO_OUTPUTS wayland"]) echo echo $PACKAGE configuration summary: echo -echo GStreamer API version ............ : $GST_API_VERSION +echo GStreamer API version ............ : $GST_API_VERSION_ORIG echo VA-API version ................... : $VA_VERSION_STR echo Video outputs .................... : $VIDEO_OUTPUTS echo diff --git a/gst/vaapi/Makefile.am b/gst/vaapi/Makefile.am index 1b89467..f6fc130 100644 --- a/gst/vaapi/Makefile.am +++ b/gst/vaapi/Makefile.am @@ -33,7 +33,6 @@ libgstvaapi_source_c = \ gstvaapi.c \ gstvaapidecode.c \ gstvaapipluginutil.c \ - gstvaapipostproc.c \ gstvaapisink.c \ gstvaapiuploader.c \ gstvaapivideobuffer.c \ @@ -43,28 +42,36 @@ libgstvaapi_source_c = \ libgstvaapi_source_h = \ gstvaapidecode.h \ gstvaapipluginutil.h \ - gstvaapipostproc.h \ gstvaapisink.h \ gstvaapiuploader.h \ gstvaapivideobuffer.h \ gstvaapivideometa.h \ $(NULL) +if !USE_GST_API_1_2p +libgstvaapi_source_c += gstvaapipostproc.c +libgstvaapi_source_h += gstvaapipostproc.h +endif + libgstvaapi_x11_source_c = gstvaapivideoconverter_x11.c libgstvaapi_x11_source_h = gstvaapivideoconverter_x11.h if USE_X11 +if !USE_GST_API_1_2p libgstvaapi_source_c += $(libgstvaapi_x11_source_c) libgstvaapi_source_h += $(libgstvaapi_x11_source_h) endif +endif libgstvaapi_glx_source_c = gstvaapivideoconverter_glx.c libgstvaapi_glx_source_h = gstvaapivideoconverter_glx.h if USE_GLX +if !USE_GST_API_1_2p libgstvaapi_source_c += $(libgstvaapi_glx_source_c) libgstvaapi_source_h += $(libgstvaapi_glx_source_h) endif +endif libgstvaapi_1_0p_source_c = \ gstvaapivideobufferpool.c \ diff --git a/gst/vaapi/gstvaapi.c b/gst/vaapi/gstvaapi.c index 3000b22..7d12a66 100644 --- a/gst/vaapi/gstvaapi.c +++ b/gst/vaapi/gstvaapi.c @@ -47,9 +47,11 @@ plugin_init (GstPlugin *plugin) gst_element_register(plugin, "vaapidecode", GST_RANK_PRIMARY, GST_TYPE_VAAPIDECODE); +#if !GST_CHECK_VERSION(1,1,0) gst_element_register(plugin, "vaapipostproc", GST_RANK_PRIMARY, GST_TYPE_VAAPIPOSTPROC); +#endif gst_element_register(plugin, "vaapisink", GST_RANK_PRIMARY, GST_TYPE_VAAPISINK); diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 68cc58f..c35af82 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -30,7 +30,9 @@ #include "gst/vaapi/sysdeps.h" #include +#if !GST_CHECK_VERSION(1,1,0) #include +#endif #include "gstvaapidecode.h" #include "gstvaapipluginutil.h" @@ -102,6 +104,7 @@ gst_vaapidecode_implements_iface_init(GstImplementsInterfaceClass *iface) #endif /* GstVideoContext interface */ +#if !GST_CHECK_VERSION(1,1,0) static void gst_vaapidecode_set_video_context(GstVideoContext *context, const gchar *type, const GValue *value) @@ -117,6 +120,8 @@ gst_video_context_interface_init(GstVideoContextInterface *iface) } #define GstVideoContextClass GstVideoContextInterface +#endif + G_DEFINE_TYPE_WITH_CODE( GstVaapiDecode, gst_vaapidecode, @@ -125,8 +130,11 @@ G_DEFINE_TYPE_WITH_CODE( G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE, gst_vaapidecode_implements_iface_init); #endif +#if !GST_CHECK_VERSION(1,1,0) G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT, - gst_video_context_interface_init)) + gst_video_context_interface_init) +#endif + ) static gboolean gst_vaapidecode_update_src_caps(GstVaapiDecode *decode, diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index ac48d01..75210d5 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -22,7 +22,9 @@ */ #include "gst/vaapi/sysdeps.h" +#if !GST_CHECK_VERSION(1,1,0) #include +#endif #if USE_DRM # include #endif @@ -117,9 +119,11 @@ gst_vaapi_ensure_display( ) { GstVaapiDisplay *display; +#if !GST_CHECK_VERSION(1,1,0) GstVideoContext *context; g_return_val_if_fail(GST_IS_VIDEO_CONTEXT(element), FALSE); +#endif g_return_val_if_fail(display_ptr != NULL, FALSE); /* Already exist ? */ @@ -127,10 +131,12 @@ gst_vaapi_ensure_display( if (display) return TRUE; +#if !GST_CHECK_VERSION(1,1,0) context = GST_VIDEO_CONTEXT(element); g_return_val_if_fail(context != NULL, FALSE); gst_video_context_prepare(context, display_types); +#endif /* Neighbour found and it updated the display */ if (*display_ptr) @@ -217,6 +223,9 @@ gst_vaapi_set_display( gboolean gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display) { +#if GST_CHECK_VERSION(1,1,0) + return FALSE; +#else GstVaapiDisplayType display_type; const gchar **types; const gchar *type; @@ -305,6 +314,7 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display) } } return res; +#endif /* !GST_CHECK_VERSION(1,1,0) */ } gboolean diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index ae39a51..6b40552 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -32,7 +32,10 @@ #include "gst/vaapi/sysdeps.h" #include #include +#if !GST_CHECK_VERSION(1,1,0) #include +#endif + #include #if USE_DRM # include @@ -119,6 +122,7 @@ gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface) #endif /* GstVideoContext interface */ +#if !GST_CHECK_VERSION(1,1,0) static void gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type, const GValue *value) @@ -132,6 +136,7 @@ gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface) { iface->set_context = gst_vaapisink_set_video_context; } +#endif static void gst_vaapisink_video_overlay_iface_init(GstVideoOverlayInterface *iface); @@ -144,8 +149,10 @@ G_DEFINE_TYPE_WITH_CODE( G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE, gst_vaapisink_implements_iface_init); #endif +#if !GST_CHECK_VERSION(1,1,0) G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT, gst_vaapisink_video_context_iface_init); +#endif G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_OVERLAY, gst_vaapisink_video_overlay_iface_init)) diff --git a/gst/vaapi/gstvaapivideobuffer.c b/gst/vaapi/gstvaapivideobuffer.c index 19926d3..40c11e8 100644 --- a/gst/vaapi/gstvaapivideobuffer.c +++ b/gst/vaapi/gstvaapivideobuffer.c @@ -27,14 +27,20 @@ #include "gst/vaapi/sysdeps.h" #include "gstvaapivideobuffer.h" -#if USE_X11 +#if USE_X11 && !GST_CHECK_VERSION(1,1,0) # include "gstvaapivideoconverter_x11.h" #endif -#if USE_GLX +#if USE_GLX && !GST_CHECK_VERSION(1,1,0) # include "gstvaapivideoconverter_glx.h" #endif -#if GST_CHECK_VERSION(1,0,0) +#if GST_CHECK_VERSION(1,1,0) +static inline GstBuffer * +gst_surface_buffer_new(void) +{ + return gst_buffer_new(); +} +#elif GST_CHECK_VERSION(1,0,0) #include #define GST_VAAPI_SURFACE_META_CAST(obj) \ @@ -263,12 +269,12 @@ get_surface_converter(GstVaapiDisplay *display) GFunc func; switch (gst_vaapi_display_get_display_type(display)) { -#if USE_X11 +#if USE_X11 && !GST_CHECK_VERSION(1,1,0) case GST_VAAPI_DISPLAY_TYPE_X11: func = (GFunc)gst_vaapi_video_converter_x11_new; break; #endif -#if USE_GLX +#if USE_GLX && !GST_CHECK_VERSION(1,1,0) case GST_VAAPI_DISPLAY_TYPE_GLX: func = (GFunc)gst_vaapi_video_converter_glx_new; break;