diff --git a/configure.ac b/configure.ac index f78919c656..7aca8b5467 100644 --- a/configure.ac +++ b/configure.ac @@ -107,14 +107,9 @@ AC_ARG_ENABLE(x11, AC_ARG_ENABLE(glx, AS_HELP_STRING([--enable-glx], - [enable OpenGL/X11 @<:@default=yes@:>@]), + [enable OpenGL/X11 output @<:@default=yes@:>@]), [], [enable_glx="yes"]) -AC_ARG_ENABLE(vaapi-glx, - AS_HELP_STRING([--enable-vaapi-glx], - [enable VA/GLX extensions @<:@default=yes@:>@]), - [], [enable_vaapi_glx="yes"]) - AC_ARG_ENABLE(vaapisink-glx, AS_HELP_STRING([--enable-vaapisink-glx], [enable OpenGL/X11 to vaapisink @<:@default=yes@:>@]), @@ -358,10 +353,13 @@ HAVE_VA_GLX=0 LIBVA_GLX_PKGNAME="libva-glx" if test $USE_GLX -eq 1; then PKG_CHECK_MODULES(LIBVA_GLX, [$LIBVA_GLX_PKGNAME >= va_api_glx_version], - [HAVE_VA_GLX=1]) - if test "$enable_vaapi_glx" = "yes" -a $HAVE_VA_GLX -eq 0; then - AC_MSG_WARN([VA/GLX not found or disabled. Fallbacking to TFP+FBO]) - LIBVA_GLX_PKGNAME="$LIBVA_X11_PKGNAME" + [HAVE_VA_GLX=1], [LIBVA_GLX_PKGNAME="$LIBVA_X11_PKGNAME"]) + + if test $HAVE_VA_GLX -eq 1; then + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$LIBVA_GLX_CPPFLAGS" + AC_CHECK_HEADERS([va/va_glx.h], [:], [HAVE_VA_GLX=0]) + CPPFLAGS="$saved_CPPFLAGS" fi fi AC_SUBST(LIBVA_GLX_PKGNAME) @@ -420,10 +418,6 @@ AC_DEFINE_UNQUOTED(USE_GLX, $USE_GLX, [Defined to 1 if GLX is enabled]) AM_CONDITIONAL(USE_GLX, test $USE_GLX -eq 1) -AC_DEFINE_UNQUOTED([USE_VAAPI_GLX], [$HAVE_VA_GLX], - [Defined to 1 if VA/GLX is enabled]) -AM_CONDITIONAL([USE_VAAPI_GLX], [test $HAVE_VA_GLX -eq 1]) - AC_DEFINE_UNQUOTED(USE_VAAPISINK_GLX, $USE_VAAPISINK_GLX, [Defined to 1 to enable GLX support to vaapisink]) AM_CONDITIONAL(USE_VAAPISINK_GLX, test $USE_VAAPISINK_GLX -eq 1) diff --git a/gst-libs/gst/vaapi/gstvaapicompat.h b/gst-libs/gst/vaapi/gstvaapicompat.h index 766bbe60ac..47cd7a3b6e 100644 --- a/gst-libs/gst/vaapi/gstvaapicompat.h +++ b/gst-libs/gst/vaapi/gstvaapicompat.h @@ -24,6 +24,12 @@ #include +#ifdef HAVE_VA_VA_GLX_H +# define USE_VAAPI_GLX 1 +#else +# define USE_VAAPI_GLX 0 +#endif + #if USE_VAAPI_GLX # include #else diff --git a/gst/vaapi/Makefile.am b/gst/vaapi/Makefile.am index 3879fb626a..6a4175adc6 100644 --- a/gst/vaapi/Makefile.am +++ b/gst/vaapi/Makefile.am @@ -7,14 +7,18 @@ libgstvaapi_CFLAGS = \ -I$(top_builddir)/gst-libs \ $(NULL) -if USE_VAAPI_GLX -libgstvaapi_LIBS = \ - $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-glx-$(GST_MAJORMINOR).la -else -libgstvaapi_LIBS = \ +libgstvaapi_LIBS = + +if USE_X11 +libgstvaapi_LIBS += \ $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-x11-$(GST_MAJORMINOR).la endif +if USE_GLX +libgstvaapi_LIBS += \ + $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-glx-$(GST_MAJORMINOR).la +endif + libgstvaapi_la_SOURCES = \ gstvaapi.c \ gstvaapidecode.c \ diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index adafed1251..1680b007f2 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -35,7 +35,7 @@ #include #include -#if USE_VAAPI_GLX +#if USE_GLX #include #define gst_vaapi_video_buffer_new(display) \ gst_vaapi_video_buffer_glx_new(GST_VAAPI_DISPLAY_GLX(display)) @@ -169,7 +169,7 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode, GstCaps *caps) gst_structure_set_value(structure, "interlaced", v_interlaced); gst_structure_set(structure, "type", G_TYPE_STRING, "vaapi", NULL); - gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX, NULL); + gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_GLX, NULL); other_caps = gst_caps_copy(decode->srcpad_caps); success = gst_pad_set_caps(decode->srcpad, other_caps); diff --git a/gst/vaapi/gstvaapidownload.c b/gst/vaapi/gstvaapidownload.c index 2358b41f01..7fdcbe628d 100644 --- a/gst/vaapi/gstvaapidownload.c +++ b/gst/vaapi/gstvaapidownload.c @@ -35,7 +35,7 @@ #include #include -#if USE_VAAPI_GLX +#if USE_GLX #include #define gst_vaapi_video_buffer_new_from_pool(pool) \ gst_vaapi_video_buffer_glx_new_from_pool(pool) @@ -493,7 +493,7 @@ gst_vaapidownload_transform_caps( gst_structure_set( structure, "type", G_TYPE_STRING, "vaapi", - "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX, + "opengl", G_TYPE_BOOLEAN, USE_GLX, NULL ); } diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 168ae1ffe9..e026fa0665 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -22,19 +22,20 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" +#endif +#include +#if USE_X11 +# include +#endif +#if USE_GLX +# include #endif #include "gstvaapipluginutil.h" #include -#if USE_VAAPI_GLX -#include -#else -#include -#endif - /* Preferred first */ static const char *display_types[] = { "gst-vaapi-display", @@ -60,12 +61,12 @@ gst_vaapi_ensure_display (gpointer element, GstVaapiDisplay **display) gst_video_context_prepare (context, display_types); /* If no neighboor, or application not interested, use system default */ +#if USE_GLX if (!*display) -#if USE_VAAPI_GLX *display = gst_vaapi_display_glx_new (NULL); -#else - *display = gst_vaapi_display_x11_new (NULL); #endif + if (!*display) + *display = gst_vaapi_display_x11_new (NULL); /* FIXME allocator should return NULL in case of failure */ if (*display && !gst_vaapi_display_get_display(*display)) { @@ -85,18 +86,18 @@ gst_vaapi_set_display (const gchar *type, if (!strcmp (type, "x11-display-name")) { g_return_if_fail (G_VALUE_HOLDS_STRING (value)); -#if USE_VAAPI_GLX +#if USE_GLX dpy = gst_vaapi_display_glx_new (g_value_get_string (value)); -#else - dpy = gst_vaapi_display_x11_new (g_value_get_string (value)); #endif + if (!dpy) + dpy = gst_vaapi_display_x11_new (g_value_get_string (value)); } else if (!strcmp (type, "x11-display")) { g_return_if_fail (G_VALUE_HOLDS_POINTER (value)); -#if USE_VAAPI_GLX +#if USE_GLX dpy = gst_vaapi_display_glx_new_with_display (g_value_get_pointer (value)); -#else - dpy = gst_vaapi_display_x11_new_with_display (g_value_get_pointer (value)); #endif + if (!dpy) + dpy = gst_vaapi_display_x11_new_with_display (g_value_get_pointer (value)); } else if (!strcmp (type, "vaapi-display")) { g_return_if_fail (G_VALUE_HOLDS_POINTER (value)); dpy = gst_vaapi_display_new_with_display (g_value_get_pointer (value)); diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 0f8ebf59c3..3b81830da6 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -401,7 +401,7 @@ gst_vaapipostproc_update_src_caps(GstVaapiPostproc *postproc, GstCaps *caps) gst_structure_set_value(structure, "pixel-aspect-ratio", v_par); gst_structure_set(structure, "type", G_TYPE_STRING, "vaapi", NULL); - gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX, NULL); + gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_GLX, NULL); if (!postproc->deinterlace) gst_structure_remove_field(structure, "interlaced"); diff --git a/gst/vaapi/gstvaapiupload.c b/gst/vaapi/gstvaapiupload.c index 645756282f..9e5d513dcf 100644 --- a/gst/vaapi/gstvaapiupload.c +++ b/gst/vaapi/gstvaapiupload.c @@ -36,7 +36,7 @@ #include #include -#if USE_VAAPI_GLX +#if USE_GLX #include #define gst_vaapi_video_buffer_new_from_pool(pool) \ gst_vaapi_video_buffer_glx_new_from_pool(pool) @@ -471,7 +471,7 @@ gst_vaapiupload_transform_caps( gst_structure_set( structure, "type", G_TYPE_STRING, "vaapi", - "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX, + "opengl", G_TYPE_BOOLEAN, USE_GLX, NULL ); } diff --git a/tests/test-display.c b/tests/test-display.c index 12f7520522..47caa3d455 100644 --- a/tests/test-display.c +++ b/tests/test-display.c @@ -28,10 +28,8 @@ #include #endif -#if USE_VAAPI_GLX +#ifdef HAVE_VA_VA_GLX_H # include -#else -# define vaGetDisplayGLX(dpy) vaGetDisplay(dpy) #endif static void @@ -255,6 +253,7 @@ main(int argc, char *argv[]) } g_print("\n"); +#ifdef HAVE_VA_VA_GLX_H g_print("#\n"); g_print("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplayGLX()]\n"); g_print("#\n"); @@ -276,6 +275,7 @@ main(int argc, char *argv[]) XCloseDisplay(x11_display); } g_print("\n"); +#endif #endif gst_deinit();