Commit 725bc7a6 authored by gb's avatar gb

Add compatibility with the original VA-API 0.29.

parent afa9b9be
......@@ -3,6 +3,7 @@ Copyright (C) 2010 Splitted-Desktop Systems
Version 0.1.2 - DD.Mar.2010
* Add AYUV image format
* Add compatibility with the original VA-API 0.29
Version 0.1.1 - 23.Mar.2010
* Document public API for libgstvaapi-*.so.*
......
......@@ -147,43 +147,52 @@ AC_MSG_RESULT([$GST_PLUGINS_DIR])
plugindir="$GST_PLUGINS_DIR"
AC_SUBST(plugindir)
dnl Check for VA-API
PKG_CHECK_MODULES(LIBVA, [libva])
dnl Check for X11
PKG_CHECK_MODULES(X11, [x11])
PKG_CHECK_MODULES(LIBVA_X11, [libva-x11])
dnl Check for SDS extensions to VA-API
AC_CACHE_CHECK([for VA-API],
ac_cv_libva_sds_extensions, [
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBVA_DEPS_CFLAGS"
AC_TRY_COMPILE([
#include <va/va_version.h>
#if VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 29
# if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_SDS_VERSION_0_29)
# error "VA-API version >= 0.29.0-sds$LIBVA_SDS_VERSION_0_29 is required"
# endif
#elif VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 30
# if !defined(VA_SDS_VERSION) || (VA_SDS_VERSION < $LIBVA_SDS_VERSION_0_30)
# error "VA-API version >= 0.30.0-sds$LIBVA_SDS_VERSION_0_30 is required"
# endif
#elif !VA_CHECK_VERSION(0,31,0)
# error "VA-API version >= 0.31 is required"
#endif
], [],
[ac_cv_libva_sds_extensions="yes"],
[ac_cv_libva_sds_extensions="no"])
CFLAGS="$saved_CFLAGS"
dnl Check for VA-API
LIBVA_PKGNAME="libva"
PKG_CHECK_MODULES(LIBVA, [$LIBVA_PKGNAME])
AC_SUBST(LIBVA_PKGNAME)
AC_CACHE_CHECK([for old VA-API 0.29],
ac_cv_have_vaapi_old, [
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBVA_CFLAGS"
saved_LIBS="$LIBS"
LIBS="$LIBS $LIBVA_LIBS"
AC_TRY_LINK(
[#include <va_x11.h>],
[vaGetDisplay(NULL)],
[ac_cv_have_vaapi_old="yes"],
[ac_cv_have_vaapi_old="no"])
CFLAGS="$saved_CFLAGS"
LIBS="$saved_LIBS"
])
if test "$ac_cv_have_vaapi_old" = "yes"; then
LIBVA_EXTRA_CFLAGS="$LIBVA_CFLAGS -DGST_VAAPI_USE_OLD_VAAPI_0_29"
fi
LIBVA_X11_PKGNAME="libva-x11"
PKG_CHECK_MODULES(LIBVA_X11, [$LIBVA_X11_PKGNAME],
[ac_cv_have_vaapi_x11="yes"],
[ac_cv_have_vaapi_x11="no"]
)
if test "$ac_cv_have_vaapi_x11" = "no"; then
if test "$ac_cv_have_vaapi_old" = "yes"; then
LIBVA_X11_PKGNAME="libva"
else
AC_MSG_ERROR([could not find VA-API])
fi
fi
AC_SUBST(LIBVA_X11_PKGNAME)
AC_SUBST(LIBVA_EXTRA_CFLAGS)
AC_SUBST(LIBVA_EXTRA_LIBS)
VA_VERSION=`$PKG_CONFIG --modversion libva`
VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
VA_DRIVER_INIT_FUNC="__vaDriverInit_${VA_MAJOR_VERSION}_${VA_MINOR_VERSION}_sds"
if test "$ac_cv_libva_sds_extensions" = "yes"; then
AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC], [Define driver entry-point])
else
AC_MSG_ERROR([Your VA-API SDK does not include SDS extensions])
fi
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
......@@ -220,3 +229,10 @@ debian.upstream/libgstvaapi-x11.install.in
sys/vaapisink/Makefile
tests/Makefile
])
dnl Print summary
echo
echo gstreamer-vaapi configuration summary:
echo
echo VA-API version ................... : $VA_VERSION
echo
......@@ -26,6 +26,7 @@ libgstvaapi_source_c = \
$(NULL)
libgstvaapi_source_h = \
gstvaapicompat.h \
gstvaapidisplay.h \
gstvaapiimage.h \
gstvaapiimageformat.h \
......@@ -83,12 +84,14 @@ libgstvaapi_@GST_MAJORMINOR@_la_CFLAGS = \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(LIBVA_CFLAGS) \
$(LIBVA_EXTRA_CFLAGS) \
$(NULL)
libgstvaapi_@GST_MAJORMINOR@_la_LIBADD = \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
$(LIBVA_LIBS) \
$(LIBVA_EXTRA_LIBS) \
$(NULL)
libgstvaapi_x11_@GST_MAJORMINOR@_la_SOURCES = \
......@@ -108,11 +111,13 @@ libgstvaapi_x11_@GST_MAJORMINOR@_la_CFLAGS = \
$(GLIB_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(LIBVA_X11_CFLAGS) \
$(LIBVA_EXTRA_CFLAGS) \
$(NULL)
libgstvaapi_x11_@GST_MAJORMINOR@_la_LIBADD = \
$(GLIB_LIBS) \
$(LIBVA_X11_LIBS) \
$(LIBVA_EXTRA_LIBS) \
libgstvaapi-@GST_MAJORMINOR@.la \
$(NULL)
......
/*
* gstvapicompat.h - VA-API compatibility glue
*
* gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GST_VAAPI_COMPAT_H
#define GST_VAAPI_COMPAT_H
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
# include <va.h>
# include <va_x11.h>
#else
# include <va/va.h>
#endif
/* Check for VA version */
#ifndef VA_CHECK_VERSION
#define VA_MAJOR_VERSION 0
#define VA_MINOR_VERSION 29
#define VA_MICRO_VERSION 0
#define VA_SDS_VERSION 0
#define VA_CHECK_VERSION(major,minor,micro) \
(VA_MAJOR_VERSION > (major) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
#endif
/* Check for VA/SDS version */
#ifndef VA_CHECK_VERSION_SDS
#define VA_CHECK_VERSION_SDS(major, minor, micro, sds) \
(VA_CHECK_VERSION(major, minor, (micro)+1) || \
(VA_CHECK_VERSION(major, minor, micro) && VA_SDS_VERSION >= (sds)))
#endif
/* Compatibility glue with original VA-API 0.29 */
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
typedef struct _VASliceParameterBufferBase {
unsigned int slice_data_size;
unsigned int slice_data_offset;
unsigned int slice_data_flag;
} VASliceParameterBufferBase;
#endif
#ifndef VA_FOURCC
#define VA_FOURCC(ch0, ch1, ch2, ch3) \
((guint32)(guint8)(ch0) | \
((guint32)(guint8)(ch1) << 8) | \
((guint32)(guint8)(ch2) << 16) | \
((guint32)(guint8)(ch3) << 24 ))
#endif
#ifndef VA_INVALID_ID
#define VA_INVALID_ID 0xffffffff
#endif
#ifndef VA_INVALID_SURFACE
#define VA_INVALID_SURFACE VA_INVALID_ID
#endif
/* Compatibility glue with VA-API < 0.31 */
#if !VA_CHECK_VERSION(0,31,0)
#undef vaSyncSurface
#define vaSyncSurface(dpy, s) (vaSyncSurface)((dpy), VA_INVALID_ID, (s))
#undef vaPutImage
#define vaPutImage vaPutImage2
#undef vaAssociateSubpicture
#define vaAssociateSubpicture vaAssociateSubpicture2
#endif
#endif /* GST_VAAPI_COMPAT_H */
......@@ -21,7 +21,12 @@
#ifndef GST_VAAPI_DISPLAY_H
#define GST_VAAPI_DISPLAY_H
#include <va/va.h>
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
# include <va.h>
#else
# include <va/va.h>
#endif
#include <gst/gst.h>
#include <gst/vaapi/gstvaapiimageformat.h>
......
......@@ -21,8 +21,13 @@
#ifndef GST_VAAPI_DISPLAY_X11_H
#define GST_VAAPI_DISPLAY_X11_H
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
# include <va_x11.h>
#else
# include <va/va_x11.h>
#endif
#include <gst/vaapi/gstvaapidisplay.h>
#include <va/va_x11.h>
G_BEGIN_DECLS
......
......@@ -21,7 +21,13 @@
#ifndef GST_VAAPI_IMAGE_FORMAT_H
#define GST_VAAPI_IMAGE_FORMAT_H
#include <va/va.h>
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
# include <va.h>
# include <gst/vaapi/gstvaapicompat.h>
#else
# include <va/va.h>
#endif
#include <glib/gtypes.h>
G_BEGIN_DECLS
......
......@@ -24,9 +24,15 @@
*/
#include "config.h"
#include <va/va.h>
#include "gstvaapiparamspecs.h"
#include "gstvaapivalue.h"
#include "gstvaapicompat.h"
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
# include <va.h>
#else
# include <va/va.h>
#endif
/* --- GstVaapiParamSpecID --- */
......
......@@ -24,6 +24,7 @@
*/
#include "config.h"
#include "gstvaapicompat.h"
#include "gstvaapiutils.h"
#include "gstvaapisurface.h"
#include "gstvaapiimage.h"
......
......@@ -19,6 +19,7 @@
*/
#include "config.h"
#include "gstvaapicompat.h"
#include "gstvaapiutils.h"
#include "gstvaapisurface.h"
#include <stdio.h>
......@@ -107,22 +108,23 @@ const char *string_of_VAEntrypoint(VAEntrypoint entrypoint)
*/
guint get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(guint flags)
{
const guint va_top_bottom_fields = (VA_TOP_FIELD|VA_BOTTOM_FIELD);
guint va_flags = 0;
guint va_fields = 0, va_csc = 0;
if (flags & GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD)
va_flags |= VA_TOP_FIELD;
va_fields |= VA_TOP_FIELD;
if (flags & GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD)
va_flags |= VA_BOTTOM_FIELD;
if ((va_flags & va_top_bottom_fields) == va_top_bottom_fields) {
va_flags &= ~va_top_bottom_fields;
va_flags |= VA_FRAME_PICTURE;
}
va_fields |= VA_BOTTOM_FIELD;
if ((va_fields ^ (VA_TOP_FIELD|VA_BOTTOM_FIELD)) == 0)
va_fields = VA_FRAME_PICTURE;
#ifdef VA_SRC_BT601
if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_601)
va_csc = VA_SRC_BT601;
#endif
#ifdef VA_SRC_BT709
if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_709)
va_flags |= VA_SRC_BT709;
else if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_601)
va_flags |= VA_SRC_BT601;
va_csc = VA_SRC_BT709;
#endif
return va_flags;
return va_fields|va_csc;
}
......@@ -22,9 +22,14 @@
#define GST_VAAPI_UTILS_H
#include "config.h"
#include <va/va.h>
#include <glib/gtypes.h>
#ifdef GST_VAAPI_USE_OLD_VAAPI_0_29
# include <va.h>
#else
# include <va/va.h>
#endif
/** Debug output */
void vaapi_dprintf(const char *format, ...)
attribute_hidden;
......
......@@ -6,7 +6,7 @@ pluginsdir=@libdir@/gstreamer-@GST_MAJORMINOR@
Name: GStreamer VA-API (x11) Plugins Libraries
Description: Streaming media framework, VA-API (x11) plugins libraries
Requires: gstreamer-vaapi-@GST_MAJORMINOR@ libva-x11
Requires: gstreamer-vaapi-@GST_MAJORMINOR@ @LIBVA_X11_PKGNAME@
Version: @VERSION@
Libs: -L${libdir} -lgstvaapi-x11-@GST_MAJORMINOR@
Cflags: -I${includedir}
Libs: -L${libdir} -lgstvaapi-x11-@GST_MAJORMINOR@ @LIBVA_EXTRA_LIBS@
Cflags: -I${includedir} @LIBVA_EXTRA_CFLAGS@
......@@ -6,7 +6,7 @@ pluginsdir=@libdir@/gstreamer-@GST_MAJORMINOR@
Name: GStreamer VA-API Plugins Libraries
Description: Streaming media framework, VA-API plugins libraries
Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ libva
Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ @LIBVA_PKGNAME@
Version: @VERSION@
Libs: -L${libdir} -lgstvaapi-@GST_MAJORMINOR@
Cflags: -I${includedir}
Libs: -L${libdir} -lgstvaapi-@GST_MAJORMINOR@ @LIBVA_EXTRA_LIBS@
Cflags: -I${includedir} @LIBVA_EXTRA_CFLAGS@
plugin_LTLIBRARIES = libgstvaapiconvert.la
libgstvaapi_CFLAGS = \
$(LIBVA_EXTRA_CFLAGS) \
-I$(top_srcdir)/gst-libs
libgstvaapi_LIBS = \
$(LIBVA_EXTRA_LIBS) \
$(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-$(GST_MAJORMINOR).la
libgstvaapiconvert_la_SOURCES = \
......
plugin_LTLIBRARIES = libgstvaapisink.la
libgstvaapi_CFLAGS = \
$(LIBVA_EXTRA_CFLAGS) \
-I$(top_srcdir)/gst-libs
libgstvaapi_LIBS = \
$(LIBVA_EXTRA_LIBS) \
$(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-x11-$(GST_MAJORMINOR).la
libgstvaapisink_la_SOURCES = \
......
......@@ -5,11 +5,13 @@ noinst_PROGRAMS = \
$(NULL)
TEST_CFLAGS = \
$(LIBVA_EXTRA_CFLAGS) \
$(GST_CFLAGS) \
-I$(top_srcdir)/gst-libs \
$(X11_CFLAGS)
TEST_LIBS = \
$(LIBVA_EXTRA_LIBS) \
$(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-x11-@GST_MAJORMINOR@.la \
$(X11_LIBS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment