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 <gwenole.beauchesne@intel.com>
This commit is contained in:
Víctor Manuel Jáquez Leal 2013-05-21 12:42:39 -04:00 committed by Gwenole Beauchesne
parent d262d36623
commit f75762d910
7 changed files with 70 additions and 10 deletions

View file

@ -27,6 +27,9 @@ m4_define([gst0_plugins_bad_version], [0.10.22])
m4_define([gst1_version], [1.0.0]) m4_define([gst1_version], [1.0.0])
m4_define([gst1_plugins_base_version], [1.0.0]) m4_define([gst1_plugins_base_version], [1.0.0])
m4_define([gst1_plugins_bad_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 # Wayland minimum version number
m4_define([wayland_api_version], [1.0.0]) 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_BASE_VERSION_REQUIRED=gst1_plugins_base_version
GST_PLUGINS_BAD_VERSION_REQUIRED=gst1_plugins_bad_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]) 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_0_10="no"
USE_GST_API_1_0p="no" USE_GST_API_1_0p="no"
USE_GST_API_1_2p="no"
AS_VERSION_COMPARE([$GST_API_VERSION], [0.10], AS_VERSION_COMPARE([$GST_API_VERSION], [0.10],
[], [USE_GST_API_0_10="yes"], []) [], [USE_GST_API_0_10="yes"], [])
AS_VERSION_COMPARE([$GST_API_VERSION], [1.0], AS_VERSION_COMPARE([$GST_API_VERSION], [1.0],
[], [USE_GST_API_1_0p="yes"], [USE_GST_API_1_0p="yes"]) [], [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_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_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 dnl GStreamer Core
PKG_CHECK_MODULES([GST], PKG_CHECK_MODULES([GST],
@ -288,9 +306,11 @@ AC_CACHE_CHECK([for GstVideoDecoder],
AM_CONDITIONAL([USE_LOCAL_GST_VIDEO_DECODER], AM_CONDITIONAL([USE_LOCAL_GST_VIDEO_DECODER],
[test "$ac_cv_have_gst_video_decoder" != "yes"]) [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], PKG_CHECK_MODULES([GST_BASEVIDEO],
[gstreamer-basevideo-$GST_API_VERSION >= $GST_PLUGINS_BAD_VERSION_REQUIRED]) [gstreamer-basevideo-$GST_API_VERSION >= $GST_PLUGINS_BAD_VERSION_REQUIRED])
fi
dnl ... bitstream parsers dnl ... bitstream parsers
if test "$enable_builtin_codecparsers" = "yes"; then 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
echo $PACKAGE configuration summary: echo $PACKAGE configuration summary:
echo echo
echo GStreamer API version ............ : $GST_API_VERSION echo GStreamer API version ............ : $GST_API_VERSION_ORIG
echo VA-API version ................... : $VA_VERSION_STR echo VA-API version ................... : $VA_VERSION_STR
echo Video outputs .................... : $VIDEO_OUTPUTS echo Video outputs .................... : $VIDEO_OUTPUTS
echo echo

View file

@ -33,7 +33,6 @@ libgstvaapi_source_c = \
gstvaapi.c \ gstvaapi.c \
gstvaapidecode.c \ gstvaapidecode.c \
gstvaapipluginutil.c \ gstvaapipluginutil.c \
gstvaapipostproc.c \
gstvaapisink.c \ gstvaapisink.c \
gstvaapiuploader.c \ gstvaapiuploader.c \
gstvaapivideobuffer.c \ gstvaapivideobuffer.c \
@ -43,28 +42,36 @@ libgstvaapi_source_c = \
libgstvaapi_source_h = \ libgstvaapi_source_h = \
gstvaapidecode.h \ gstvaapidecode.h \
gstvaapipluginutil.h \ gstvaapipluginutil.h \
gstvaapipostproc.h \
gstvaapisink.h \ gstvaapisink.h \
gstvaapiuploader.h \ gstvaapiuploader.h \
gstvaapivideobuffer.h \ gstvaapivideobuffer.h \
gstvaapivideometa.h \ gstvaapivideometa.h \
$(NULL) $(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_c = gstvaapivideoconverter_x11.c
libgstvaapi_x11_source_h = gstvaapivideoconverter_x11.h libgstvaapi_x11_source_h = gstvaapivideoconverter_x11.h
if USE_X11 if USE_X11
if !USE_GST_API_1_2p
libgstvaapi_source_c += $(libgstvaapi_x11_source_c) libgstvaapi_source_c += $(libgstvaapi_x11_source_c)
libgstvaapi_source_h += $(libgstvaapi_x11_source_h) libgstvaapi_source_h += $(libgstvaapi_x11_source_h)
endif endif
endif
libgstvaapi_glx_source_c = gstvaapivideoconverter_glx.c libgstvaapi_glx_source_c = gstvaapivideoconverter_glx.c
libgstvaapi_glx_source_h = gstvaapivideoconverter_glx.h libgstvaapi_glx_source_h = gstvaapivideoconverter_glx.h
if USE_GLX if USE_GLX
if !USE_GST_API_1_2p
libgstvaapi_source_c += $(libgstvaapi_glx_source_c) libgstvaapi_source_c += $(libgstvaapi_glx_source_c)
libgstvaapi_source_h += $(libgstvaapi_glx_source_h) libgstvaapi_source_h += $(libgstvaapi_glx_source_h)
endif endif
endif
libgstvaapi_1_0p_source_c = \ libgstvaapi_1_0p_source_c = \
gstvaapivideobufferpool.c \ gstvaapivideobufferpool.c \

View file

@ -47,9 +47,11 @@ plugin_init (GstPlugin *plugin)
gst_element_register(plugin, "vaapidecode", gst_element_register(plugin, "vaapidecode",
GST_RANK_PRIMARY, GST_RANK_PRIMARY,
GST_TYPE_VAAPIDECODE); GST_TYPE_VAAPIDECODE);
#if !GST_CHECK_VERSION(1,1,0)
gst_element_register(plugin, "vaapipostproc", gst_element_register(plugin, "vaapipostproc",
GST_RANK_PRIMARY, GST_RANK_PRIMARY,
GST_TYPE_VAAPIPOSTPROC); GST_TYPE_VAAPIPOSTPROC);
#endif
gst_element_register(plugin, "vaapisink", gst_element_register(plugin, "vaapisink",
GST_RANK_PRIMARY, GST_RANK_PRIMARY,
GST_TYPE_VAAPISINK); GST_TYPE_VAAPISINK);

View file

@ -30,7 +30,9 @@
#include "gst/vaapi/sysdeps.h" #include "gst/vaapi/sysdeps.h"
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#if !GST_CHECK_VERSION(1,1,0)
#include <gst/video/videocontext.h> #include <gst/video/videocontext.h>
#endif
#include "gstvaapidecode.h" #include "gstvaapidecode.h"
#include "gstvaapipluginutil.h" #include "gstvaapipluginutil.h"
@ -102,6 +104,7 @@ gst_vaapidecode_implements_iface_init(GstImplementsInterfaceClass *iface)
#endif #endif
/* GstVideoContext interface */ /* GstVideoContext interface */
#if !GST_CHECK_VERSION(1,1,0)
static void static void
gst_vaapidecode_set_video_context(GstVideoContext *context, const gchar *type, gst_vaapidecode_set_video_context(GstVideoContext *context, const gchar *type,
const GValue *value) const GValue *value)
@ -117,6 +120,8 @@ gst_video_context_interface_init(GstVideoContextInterface *iface)
} }
#define GstVideoContextClass GstVideoContextInterface #define GstVideoContextClass GstVideoContextInterface
#endif
G_DEFINE_TYPE_WITH_CODE( G_DEFINE_TYPE_WITH_CODE(
GstVaapiDecode, GstVaapiDecode,
gst_vaapidecode, gst_vaapidecode,
@ -125,8 +130,11 @@ G_DEFINE_TYPE_WITH_CODE(
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE, G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
gst_vaapidecode_implements_iface_init); gst_vaapidecode_implements_iface_init);
#endif #endif
#if !GST_CHECK_VERSION(1,1,0)
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT, G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init)) gst_video_context_interface_init)
#endif
)
static gboolean static gboolean
gst_vaapidecode_update_src_caps(GstVaapiDecode *decode, gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,

View file

@ -22,7 +22,9 @@
*/ */
#include "gst/vaapi/sysdeps.h" #include "gst/vaapi/sysdeps.h"
#if !GST_CHECK_VERSION(1,1,0)
#include <gst/video/videocontext.h> #include <gst/video/videocontext.h>
#endif
#if USE_DRM #if USE_DRM
# include <gst/vaapi/gstvaapidisplay_drm.h> # include <gst/vaapi/gstvaapidisplay_drm.h>
#endif #endif
@ -117,9 +119,11 @@ gst_vaapi_ensure_display(
) )
{ {
GstVaapiDisplay *display; GstVaapiDisplay *display;
#if !GST_CHECK_VERSION(1,1,0)
GstVideoContext *context; GstVideoContext *context;
g_return_val_if_fail(GST_IS_VIDEO_CONTEXT(element), FALSE); g_return_val_if_fail(GST_IS_VIDEO_CONTEXT(element), FALSE);
#endif
g_return_val_if_fail(display_ptr != NULL, FALSE); g_return_val_if_fail(display_ptr != NULL, FALSE);
/* Already exist ? */ /* Already exist ? */
@ -127,10 +131,12 @@ gst_vaapi_ensure_display(
if (display) if (display)
return TRUE; return TRUE;
#if !GST_CHECK_VERSION(1,1,0)
context = GST_VIDEO_CONTEXT(element); context = GST_VIDEO_CONTEXT(element);
g_return_val_if_fail(context != NULL, FALSE); g_return_val_if_fail(context != NULL, FALSE);
gst_video_context_prepare(context, display_types); gst_video_context_prepare(context, display_types);
#endif
/* Neighbour found and it updated the display */ /* Neighbour found and it updated the display */
if (*display_ptr) if (*display_ptr)
@ -217,6 +223,9 @@ gst_vaapi_set_display(
gboolean gboolean
gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display) gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
{ {
#if GST_CHECK_VERSION(1,1,0)
return FALSE;
#else
GstVaapiDisplayType display_type; GstVaapiDisplayType display_type;
const gchar **types; const gchar **types;
const gchar *type; const gchar *type;
@ -305,6 +314,7 @@ gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
} }
} }
return res; return res;
#endif /* !GST_CHECK_VERSION(1,1,0) */
} }
gboolean gboolean

View file

@ -32,7 +32,10 @@
#include "gst/vaapi/sysdeps.h" #include "gst/vaapi/sysdeps.h"
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#if !GST_CHECK_VERSION(1,1,0)
#include <gst/video/videocontext.h> #include <gst/video/videocontext.h>
#endif
#include <gst/vaapi/gstvaapivalue.h> #include <gst/vaapi/gstvaapivalue.h>
#if USE_DRM #if USE_DRM
# include <gst/vaapi/gstvaapidisplay_drm.h> # include <gst/vaapi/gstvaapidisplay_drm.h>
@ -119,6 +122,7 @@ gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface)
#endif #endif
/* GstVideoContext interface */ /* GstVideoContext interface */
#if !GST_CHECK_VERSION(1,1,0)
static void static void
gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type, gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type,
const GValue *value) const GValue *value)
@ -132,6 +136,7 @@ gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
{ {
iface->set_context = gst_vaapisink_set_video_context; iface->set_context = gst_vaapisink_set_video_context;
} }
#endif
static void static void
gst_vaapisink_video_overlay_iface_init(GstVideoOverlayInterface *iface); gst_vaapisink_video_overlay_iface_init(GstVideoOverlayInterface *iface);
@ -144,8 +149,10 @@ G_DEFINE_TYPE_WITH_CODE(
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE, G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
gst_vaapisink_implements_iface_init); gst_vaapisink_implements_iface_init);
#endif #endif
#if !GST_CHECK_VERSION(1,1,0)
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT, G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_vaapisink_video_context_iface_init); gst_vaapisink_video_context_iface_init);
#endif
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_OVERLAY, G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_OVERLAY,
gst_vaapisink_video_overlay_iface_init)) gst_vaapisink_video_overlay_iface_init))

View file

@ -27,14 +27,20 @@
#include "gst/vaapi/sysdeps.h" #include "gst/vaapi/sysdeps.h"
#include "gstvaapivideobuffer.h" #include "gstvaapivideobuffer.h"
#if USE_X11 #if USE_X11 && !GST_CHECK_VERSION(1,1,0)
# include "gstvaapivideoconverter_x11.h" # include "gstvaapivideoconverter_x11.h"
#endif #endif
#if USE_GLX #if USE_GLX && !GST_CHECK_VERSION(1,1,0)
# include "gstvaapivideoconverter_glx.h" # include "gstvaapivideoconverter_glx.h"
#endif #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 <gst/video/gstsurfacemeta.h> #include <gst/video/gstsurfacemeta.h>
#define GST_VAAPI_SURFACE_META_CAST(obj) \ #define GST_VAAPI_SURFACE_META_CAST(obj) \
@ -263,12 +269,12 @@ get_surface_converter(GstVaapiDisplay *display)
GFunc func; GFunc func;
switch (gst_vaapi_display_get_display_type(display)) { 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: case GST_VAAPI_DISPLAY_TYPE_X11:
func = (GFunc)gst_vaapi_video_converter_x11_new; func = (GFunc)gst_vaapi_video_converter_x11_new;
break; break;
#endif #endif
#if USE_GLX #if USE_GLX && !GST_CHECK_VERSION(1,1,0)
case GST_VAAPI_DISPLAY_TYPE_GLX: case GST_VAAPI_DISPLAY_TYPE_GLX:
func = (GFunc)gst_vaapi_video_converter_glx_new; func = (GFunc)gst_vaapi_video_converter_glx_new;
break; break;