From 9d440fafb3146b0090e75a9ad03f1795e12443db Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Thu, 19 Jul 2012 17:16:28 +0200 Subject: [PATCH] Drop all references to USE_CODEC_PARSERS. --- configure.ac | 51 ++++++++++--------------------- gst-libs/gst/vaapi/Makefile.am | 41 ++++++++++--------------- gst/vaapi/gstvaapidecode.c | 55 ++++++++++++++++------------------ tests/test-decode.c | 47 +++++++++++++---------------- tests/test-subpicture.c | 7 +---- 5 files changed, 79 insertions(+), 122 deletions(-) diff --git a/configure.ac b/configure.ac index 9fc8a51361..ccca88c63f 100644 --- a/configure.ac +++ b/configure.ac @@ -34,10 +34,6 @@ m4_define([gst_plugins_base_micro_version], [31]) m4_define([gst_plugins_base_version], [gst_plugins_base_major_version.gst_plugins_base_minor_version.gst_plugins_base_micro_version]) -# VA-API minimum version number -m4_define([va_api_x11_version], [0.31.0]) -m4_define([va_api_glx_version], [0.32.0]) - # gst plugins-bad version number m4_define([gst_plugins_bad_major_version], [0]) m4_define([gst_plugins_bad_minor_version], [10]) @@ -45,6 +41,10 @@ m4_define([gst_plugins_bad_micro_version], [22]) m4_define([gst_plugins_bad_version], [gst_plugins_bad_major_version.gst_plugins_bad_minor_version.gst_plugins_bad_micro_version]) +# VA-API minimum version number +m4_define([va_api_x11_version], [0.31.0]) +m4_define([va_api_glx_version], [0.32.0]) + # libva package version number m4_define([libva_x11_package_version], [1.0.3]) m4_define([libva_glx_package_version], [1.0.9]) @@ -113,11 +113,6 @@ AC_ARG_ENABLE(vaapisink-glx, [enable OpenGL/X11 to vaapisink @<:@default=yes@:>@]), [], [enable_vaapisink_glx="no"]) -AC_ARG_ENABLE(codecparsers, - AS_HELP_STRING([--enable-codecparsers], - [enable adhoc bitstream parsers from GStreamer @<:@default=yes@:>@]), - [], [enable_codecparsers="yes"]) - dnl Check for __attribute__((visibility())) AC_CACHE_CHECK([whether __attribute__((visibility())) is supported], vaapi_cv_visibility_attribute, @@ -233,21 +228,13 @@ PKG_CHECK_MODULES([GST_BASEVIDEO], ) dnl Check for GStreamer codec parsers -USE_CODEC_PARSERS=0 -if test "$enable_codecparsers" = "yes"; then -PKG_CHECK_MODULES([GST_CODEC_PARSERS], - [gstreamer-codecparsers-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED], - [enable_codecparsers="yes" USE_CODEC_PARSERS=1], - [enable_codecparsers="no" USE_CODEC_PARSERS=0] -) -fi - -AC_DEFINE_UNQUOTED(USE_CODEC_PARSERS, $USE_CODEC_PARSERS, - [Defined to 1 if GStreamer codec parsers are used]) -AM_CONDITIONAL(USE_CODEC_PARSERS, test $USE_CODEC_PARSERS -eq 1) - +USE_CODEC_PARSERS=1 USE_LOCAL_CODEC_PARSERS=0 -if test "$enable_codecparsers" = "yes"; then + +PKG_CHECK_MODULES([GST_CODEC_PARSERS], + [gstreamer-codecparsers-$GST_MAJORMINOR >= $GST_PLUGINS_BAD_VERSION_REQUIRED] +) + AC_CACHE_CHECK([for GstH264SliceHdr::n_emulation_prevention_bytes], ac_cv_have_gst_h264_slice_hdr_epb_count, [ saved_CFLAGS="$CFLAGS" @@ -266,6 +253,11 @@ AC_CACHE_CHECK([for GstH264SliceHdr::n_emulation_prevention_bytes], LIBS="$saved_LIBS" ]) +if test "$ac_cv_have_gst_h264_slice_hdr_epb_count" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_GST_H264_SLICE_HDR_EPB_COUNT, 1, + [Defined to 1 if GstH264SliceHdr::n_emulation_prevention_bytes exists.]) +fi + AC_CACHE_CHECK([for JPEG parser], ac_cv_have_gst_jpeg_parser, [ saved_CFLAGS="$CFLAGS" @@ -282,12 +274,6 @@ AC_CACHE_CHECK([for JPEG parser], CFLAGS="$saved_CFLAGS" LIBS="$saved_LIBS" ]) -fi - -if test "$ac_cv_have_gst_h264_slice_hdr_epb_count" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_GST_H264_SLICE_HDR_EPB_COUNT, 1, - [Defined to 1 if GstH264SliceHdr::n_emulation_prevention_bytes exists.]) -fi if test "$ac_cv_have_gst_jpeg_parser" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_GST_JPEG_PARSER, 1, @@ -407,7 +393,6 @@ AC_SUBST(LIBVA_EXTRA_LIBS) dnl Check for JPEG decoding API (0.33+) USE_JPEG_DECODER=0 -if test "$enable_codecparsers" = "yes"; then AC_CACHE_CHECK([for JPEG decoding API], ac_cv_have_jpeg_decoding_api, [ saved_CFLAGS="$CFLAGS" @@ -428,7 +413,6 @@ AC_CACHE_CHECK([for JPEG decoding API], CFLAGS="$saved_CFLAGS" LIBS="$saved_LIBS" ]) -fi AC_DEFINE_UNQUOTED(USE_JPEG_DECODER, $USE_JPEG_DECODER, [Defined to 1 if JPEG decoder is used]) @@ -441,10 +425,6 @@ else USE_VAAPISINK_GLX=0 fi -if test "$enable_codecparsers" = "no"; then - AC_MSG_ERROR([Found no suitable GStreamer bitstream parsers]) -fi - AC_DEFINE_UNQUOTED(USE_GLX, $USE_GLX, [Defined to 1 if GLX is enabled]) AM_CONDITIONAL(USE_GLX, test $USE_GLX -eq 1) @@ -518,5 +498,4 @@ echo VA-API version ................... : $VA_VERSION_STR echo GLX support ...................... : $(yesno $USE_GLX) echo VA/GLX support ................... : $(yesno $USE_VAAPI_GLX) echo VaapiSink/GL ..................... : $(yesno $USE_VAAPISINK_GLX) -echo GStreamer bitstream parsers ...... : $(yesno $USE_CODEC_PARSERS) echo diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am index acced92ee8..27145b0ff8 100644 --- a/gst-libs/gst/vaapi/Makefile.am +++ b/gst-libs/gst/vaapi/Makefile.am @@ -17,6 +17,7 @@ libgstvaapi_cflags = \ $(GST_BASEVIDEO_CFLAGS) \ $(GST_VIDEO_CFLAGS) \ $(GST_CFLAGS) \ + $(GST_CODEC_PARSERS_CFLAGS) \ $(LIBVA_CFLAGS) \ $(NULL) @@ -25,12 +26,20 @@ libgstvaapi_libs = \ $(GST_BASEVIDEO_LIBS) \ $(GST_LIBS) \ $(GST_VIDEO_LIBS) \ + $(GST_CODEC_PARSERS_LIBS) \ $(LIBVA_LIBS) \ $(NULL) libgstvaapi_source_c = \ + gstvaapicodec_objects.c \ gstvaapicontext.c \ gstvaapidecoder.c \ + gstvaapidecoder_dpb.c \ + gstvaapidecoder_h264.c \ + gstvaapidecoder_mpeg2.c \ + gstvaapidecoder_mpeg4.c \ + gstvaapidecoder_objects.c \ + gstvaapidecoder_vc1.c \ gstvaapidisplay.c \ gstvaapidisplaycache.c \ gstvaapiimage.c \ @@ -55,6 +64,10 @@ libgstvaapi_source_c = \ libgstvaapi_source_h = \ gstvaapicontext.h \ gstvaapidecoder.h \ + gstvaapidecoder_h264.h \ + gstvaapidecoder_mpeg2.h \ + gstvaapidecoder_mpeg4.h \ + gstvaapidecoder_vc1.h \ gstvaapidisplay.h \ gstvaapidisplaycache.h \ gstvaapiimage.h \ @@ -78,8 +91,11 @@ libgstvaapi_source_h = \ libgstvaapi_source_priv_h = \ glibcompat.h \ gstvaapi_priv.h \ + gstvaapicodec_objects.h \ gstvaapicompat.h \ gstvaapidebug.h \ + gstvaapidecoder_dpb.h \ + gstvaapidecoder_objects.h \ gstvaapidecoder_priv.h \ gstvaapidisplay_priv.h \ gstvaapiobject_priv.h \ @@ -137,35 +153,10 @@ libgstvaapi_glx_source_priv_h = \ gstvaapiutils_x11.h \ $(NULL) -if USE_CODEC_PARSERS -libgstvaapi_source_c += \ - gstvaapicodec_objects.c \ - gstvaapidecoder_dpb.c \ - gstvaapidecoder_h264.c \ - gstvaapidecoder_mpeg2.c \ - gstvaapidecoder_mpeg4.c \ - gstvaapidecoder_objects.c \ - gstvaapidecoder_vc1.c \ - $(NULL) -libgstvaapi_source_h += \ - gstvaapidecoder_h264.h \ - gstvaapidecoder_mpeg2.h \ - gstvaapidecoder_mpeg4.h \ - gstvaapidecoder_vc1.h \ - $(NULL) -libgstvaapi_source_priv_h += \ - gstvaapicodec_objects.h \ - gstvaapidecoder_dpb.h \ - gstvaapidecoder_objects.h \ - $(NULL) -libgstvaapi_cflags += $(GST_CODEC_PARSERS_CFLAGS) -libgstvaapi_libs += $(GST_CODEC_PARSERS_LIBS) - if USE_JPEG_DECODER libgstvaapi_source_c += gstvaapidecoder_jpeg.c libgstvaapi_source_h += gstvaapidecoder_jpeg.h endif -endif if USE_LOCAL_CODEC_PARSERS libgstvaapi_libs += \ diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 9572f23f06..adafed1251 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -44,13 +44,11 @@ #include "gstvaapidecode.h" #include "gstvaapipluginutil.h" -#if USE_CODEC_PARSERS -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include #define GST_PLUGIN_NAME "vaapidecode" #define GST_PLUGIN_DESC "A VA-API based video decoder" @@ -302,6 +300,7 @@ gst_vaapidecode_create(GstVaapiDecode *decode, GstCaps *caps) if (!gst_vaapi_ensure_display(decode, &decode->display)) return FALSE; + dpy = decode->display; decode->decoder_mutex = g_mutex_new(); if (!decode->decoder_mutex) @@ -311,31 +310,29 @@ gst_vaapidecode_create(GstVaapiDecode *decode, GstCaps *caps) if (!decode->decoder_ready) return FALSE; - dpy = decode->display; -#if USE_CODEC_PARSERS - structure = gst_caps_get_structure(caps, 0); - if (!structure) + structure = gst_caps_get_structure(caps, 0); + if (!structure) + return FALSE; + + if (gst_structure_has_name(structure, "video/x-h264")) + decode->decoder = gst_vaapi_decoder_h264_new(dpy, caps); + else if (gst_structure_has_name(structure, "video/mpeg")) { + if (!gst_structure_get_int(structure, "mpegversion", &version)) return FALSE; - if (gst_structure_has_name(structure, "video/x-h264")) - decode->decoder = gst_vaapi_decoder_h264_new(dpy, caps); - else if (gst_structure_has_name(structure, "video/mpeg")) { - if (!gst_structure_get_int(structure, "mpegversion", &version)) - return FALSE; - if (version == 2) - decode->decoder = gst_vaapi_decoder_mpeg2_new(dpy, caps); - else if (version == 4) - decode->decoder = gst_vaapi_decoder_mpeg4_new(dpy, caps); - } - else if (gst_structure_has_name(structure, "video/x-wmv")) - decode->decoder = gst_vaapi_decoder_vc1_new(dpy, caps); - else if (gst_structure_has_name(structure, "video/x-h263") || - gst_structure_has_name(structure, "video/x-divx") || - gst_structure_has_name(structure, "video/x-xvid")) + if (version == 2) + decode->decoder = gst_vaapi_decoder_mpeg2_new(dpy, caps); + else if (version == 4) decode->decoder = gst_vaapi_decoder_mpeg4_new(dpy, caps); + } + else if (gst_structure_has_name(structure, "video/x-wmv")) + decode->decoder = gst_vaapi_decoder_vc1_new(dpy, caps); + else if (gst_structure_has_name(structure, "video/x-h263") || + gst_structure_has_name(structure, "video/x-divx") || + gst_structure_has_name(structure, "video/x-xvid")) + decode->decoder = gst_vaapi_decoder_mpeg4_new(dpy, caps); #if USE_JPEG_DECODER - else if (gst_structure_has_name(structure, "image/jpeg")) - decode->decoder = gst_vaapi_decoder_jpeg_new(dpy, caps); -#endif + else if (gst_structure_has_name(structure, "image/jpeg")) + decode->decoder = gst_vaapi_decoder_jpeg_new(dpy, caps); #endif if (!decode->decoder) return FALSE; diff --git a/tests/test-decode.c b/tests/test-decode.c index 561162d32a..ef1f36efa4 100644 --- a/tests/test-decode.c +++ b/tests/test-decode.c @@ -26,18 +26,15 @@ #include #include #include +#include +#include +#include +#include #include "test-jpeg.h" #include "test-mpeg2.h" #include "test-h264.h" #include "test-vc1.h" -#if USE_CODEC_PARSERS -# include -# include -# include -# include -#endif - /* Set to 1 to check display cache works (shared VA display) */ #define CHECK_DISPLAY_CACHE 1 @@ -147,27 +144,25 @@ main(int argc, char *argv[]) NULL ); -#if USE_CODEC_PARSERS - switch (gst_vaapi_profile_get_codec(info.profile)) { - case GST_VAAPI_CODEC_H264: - decoder = gst_vaapi_decoder_h264_new(display, decoder_caps); - break; + switch (gst_vaapi_profile_get_codec(info.profile)) { + case GST_VAAPI_CODEC_H264: + decoder = gst_vaapi_decoder_h264_new(display, decoder_caps); + break; #if USE_JPEG_DECODER - case GST_VAAPI_CODEC_JPEG: - decoder = gst_vaapi_decoder_jpeg_new(display, decoder_caps); - break; -#endif - case GST_VAAPI_CODEC_MPEG2: - decoder = gst_vaapi_decoder_mpeg2_new(display, decoder_caps); - break; - case GST_VAAPI_CODEC_VC1: - decoder = gst_vaapi_decoder_vc1_new(display, decoder_caps); - break; - default: - decoder = NULL; - break; - } + case GST_VAAPI_CODEC_JPEG: + decoder = gst_vaapi_decoder_jpeg_new(display, decoder_caps); + break; #endif + case GST_VAAPI_CODEC_MPEG2: + decoder = gst_vaapi_decoder_mpeg2_new(display, decoder_caps); + break; + case GST_VAAPI_CODEC_VC1: + decoder = gst_vaapi_decoder_vc1_new(display, decoder_caps); + break; + default: + decoder = NULL; + break; + } if (!decoder) g_error("could not create decoder"); gst_caps_unref(decoder_caps); diff --git a/tests/test-subpicture.c b/tests/test-subpicture.c index a0e1b6fb50..b3d7c65f7a 100644 --- a/tests/test-subpicture.c +++ b/tests/test-subpicture.c @@ -25,14 +25,11 @@ #include #include #include +#include #include #include "test-mpeg2.h" #include "test-subpicture-data.h" -#if USE_CODEC_PARSERS -# include -#endif - typedef void (*GetVideoInfoFunc)(VideoDecodeInfo *info); typedef struct _CodecDefs CodecDefs; @@ -149,9 +146,7 @@ main(int argc, char *argv[]) NULL ); -#if USE_CODEC_PARSERS decoder = gst_vaapi_decoder_mpeg2_new(display, decoder_caps); -#endif if (!decoder) g_error("could not create video decoder"); gst_caps_unref(decoder_caps);