From 907c09a4ff03f46a562c620062a5390ee4674516 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 19 May 2010 13:02:36 -0500 Subject: [PATCH] add patches to vaapi support. --- configure.ac | 4 ++-- gui/Makefile.am | 2 +- gui/gtk.cpp | 24 +++--------------------- gui/gtk_canvas.cpp | 2 +- libvaapi/VaapiContext.cpp | 15 +++++++++++++++ macros/ffmpeg.m4 | 40 +++++++++++++++------------------------- 6 files changed, 37 insertions(+), 50 deletions(-) diff --git a/configure.ac b/configure.ac index b15eaeeeb..d25e09a94 100644 --- a/configure.ac +++ b/configure.ac @@ -2030,8 +2030,8 @@ fi AM_CONDITIONAL(HAVE_GLIB, [ test x"${has_glib}" = xyes ]) -if test x$build_gtk = xno -o x$build_kde4 = xno; then - if test x$npapi = xyes; then +if test x$npapi = xyes; then + if ! test x$build_gtk = xyes -o x$build_kde4 = xyes; then AC_MSG_WARN(["Enabled NPAPI plugin, but it's not supported by the selected GUI"]) fi fi diff --git a/gui/Makefile.am b/gui/Makefile.am index a5ef16a04..678fba0bd 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -102,8 +102,8 @@ AM_LDFLAGS = \ $(JPEG_LIBS) \ $(PNG_LIBS) \ $(LIRC_LIBS) \ - $(INTLLIB) \ $(MYSQL_LIBS) \ + $(INTLLIB) \ $(BOOST_LIBS) \ $(PTHREAD_LIBS) \ $(NULL) diff --git a/gui/gtk.cpp b/gui/gtk.cpp index 75640cfac..e6bb6ba6f 100644 --- a/gui/gtk.cpp +++ b/gui/gtk.cpp @@ -37,14 +37,13 @@ #include "gnash.h" // Quality #include + #ifdef HAVE_VA_VA_H -#include "va/va.h" -#include "va/va_backend.h" +#include #include "vaapi_utils.h" #endif - #ifdef HAVE_VA_VA_X11_H -#include "va/va_x11.h" +#include #endif #ifdef HAVE_X11 @@ -259,23 +258,6 @@ GtkGui::init(int argc, char **argv[]) } } -#ifdef HAVE_VA_VA_X11_H - if (hwaccel == "vaapi") { - char *driver_name; - struct VADisplayContext *pDisplayContext = (struct VADisplayContext *)vaGetDisplay(GDK_DISPLAY()); - - if (pDisplayContext->vaGetDriverName(pDisplayContext, &driver_name) == 0) { - if ((strcmp(driver_name, "nvidia" ) == 0) || (strcmp(driver_name, "vdpau" ) == 0) || (strcmp(driver_name, "s3g" ) == 0)) { - log_debug("Found supported vaapi driver for %s", driver_name); - } else { - log_error("No vaapi driver found for %s!", driver_name); - } - } else { - log_error("Couldn't get the VAAPI driver name!"); - } - } -#endif - #ifdef BUILD_CANVAS _canvas = gnash_canvas_new(); gnash_canvas_setup(GNASH_CANVAS(_canvas), hwaccel, renderer, argc, argv); diff --git a/gui/gtk_canvas.cpp b/gui/gtk_canvas.cpp index 3d9efa37d..42a57df9d 100644 --- a/gui/gtk_canvas.cpp +++ b/gui/gtk_canvas.cpp @@ -271,7 +271,7 @@ gnash_canvas_setup(GnashCanvas *canvas, std::string& hwaccel, // Set the hardware acclerator to the next one to try // if initializing fails. next_hwaccel = "xv"; - } + } else #endif #ifdef RENDERER_AGG #ifdef HAVE_XV diff --git a/libvaapi/VaapiContext.cpp b/libvaapi/VaapiContext.cpp index 8256b7a89..f8aedd988 100644 --- a/libvaapi/VaapiContext.cpp +++ b/libvaapi/VaapiContext.cpp @@ -33,6 +33,21 @@ namespace gnash { static VaapiCodec get_codec(VAProfile profile) { GNASH_REPORT_FUNCTION; + const char *debug[] = { + "VAProfileMPEG2Simple", + "VAProfileMPEG2Main" + "VAProfileMPEG4Simple", + "VAProfileMPEG4AdvancedSimple", + "VAProfileMPEG4Main", + "VAProfileH264Baseline", + "VAProfileH264Main", + "VAProfileH264High", + "VAProfileVC1Simple", + "VAProfileVC1Main", + "VAProfileVC1Advanced", + "VAProfileUnknown" + }; + log_debug("Video contains %s codec.", debug[profile]); switch (profile) { case VAProfileMPEG2Simple: diff --git a/macros/ffmpeg.m4 b/macros/ffmpeg.m4 index 25f453a05..f65e3c152 100644 --- a/macros/ffmpeg.m4 +++ b/macros/ffmpeg.m4 @@ -22,7 +22,6 @@ AC_DEFUN([GNASH_PATH_FFMPEG], backupCFLAGS="$CFLAGS" avcodec_h="" ffmpeg_top_incl="" - have_ffmpeg_vaapi="no" dnl If the user specify an path to include headers from, we assume it's the full dnl path to the header file, and not the top level path without the 'ffmpeg' node @@ -222,20 +221,10 @@ AC_DEFUN([GNASH_PATH_FFMPEG], dnl AC_EGREP_HEADER(avcodec_decode_audio2, ${avcodec_h}, [avfound=yes], [avfound=no]) - dnl This makes sure the version of ffmpeg is new enough to contain - dnl the libva support. - if test x"${enable_vaapi}" = x"yes"; then - if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 52480; then - AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 52.48.0 or greater required to use libVA, $ffmpeg_version detected.]) - else - ffmpeg_version_check=ok - fi + if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 511100; then + AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 51.11.0 or greater required, $ffmpeg_version detected.]) else - if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 511100; then - AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 51.11.0 or greater required, $ffmpeg_version detected.]) - else - ffmpeg_version_check=ok - fi + ffmpeg_version_check=ok fi if test ! -z "$ffmpeg_num_version" -a "$ffmpeg_num_version" -gt 512800; then @@ -263,17 +252,6 @@ dnl AC_EGREP_HEADER(avcodec_decode_audio2, ${avcodec_h}, [avfound=yes], [avfou else AC_DEFINE(FFMPEG_NELLYMOSER, 1, [Define if ffmpeg can decode NELLYMOSER audio]) fi - if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -gt 524800; then - dnl 52.48.0 (r21285) or higher required for VAAPI support - have_ffmpeg_vaapi=yes - AC_DEFINE(FFMPEG_VAAPI, 1, [Define if ffmpeg supports VAAPI]) - else - have_ffmpeg_vaapi=no - fi - if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -gt 52450; then - dnl 52.45.0 (r20957) or higher required for VAAPI support - AC_DEFINE(FFMPEG_VAAPI, 1, [Define if ffmpeg supports VAAPI.]) - fi else AC_MSG_WARN([Could not check ffmpeg version (can't find avcodec.h file)]) # ffmpeg_version_check=ok # this is NOT ok, why would it be ?! @@ -311,6 +289,18 @@ dnl AC_EGREP_HEADER(avcodec_decode_audio2, ${avcodec_h}, [avfound=yes], [avfou ffmpeg_version_check= fi + AC_MSG_CHECKING([for libavcodec/vaapi.h]) + have_ffmpeg_vaapi="no" + if test -f "${ffmpeg_top_incl}/ffmpeg/vaapi.h"; then + have_ffmpeg_vaapi="yes" + AC_DEFINE(HAVE_FFMPEG_VAAPI_H, 1, [Defined if ffmpeg/vaapi.h is found]) + fi + if test -f "${ffmpeg_top_incl}/libavcodec/vaapi.h"; then + have_ffmpeg_vaapi="yes" + AC_DEFINE(HAVE_LIBAVCODEC_VAAPI_H, 1, [Defined if libavcodec/vaapi.h is found]) + fi + AC_MSG_RESULT($have_ffmpeg_vaapi) + dnl --------------------------------- dnl dnl FFMPEG libs checking -- 2.11.4.GIT