update and move gstcompat.h

The purpose of gstcompat.h is to couple the API differences among
gstreamer-1.0 and gstreamer-0.10. Since gstreamer-0.10 is obsolete, the code
in this compatibility layer shall be removed.

Nevertheless, the gstcompat.h header should be kept, if new incompatibilites
appear in the future, but it shall live in gst/vaapi, not in gst-libs.

This patch removes the crumbs defined gstcompat.h and moves it to gst/vaapi.
In order to avoid layer violations, gstcompat.h includes sysdeps.h and all
the includes in gst/vaapi of sysdeps.h are replaced with gstcompat.h

https://bugzilla.gnome.org/show_bug.cgi?id=745728

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-04-03 17:08:30 +03:00 committed by Sreerenj Balachandran
parent 1256ce613a
commit c561b8da8a
28 changed files with 67 additions and 109 deletions

View file

@ -1,71 +0,0 @@
/*
* gstcompat.h - Compatibility glue for GStreamer
*
* Copyright (C) 2013 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef GST_COMPAT_H
#define GST_COMPAT_H
#include <gst/gst.h>
#include <gst/video/gstvideometa.h>
/* GstStructure */
#undef gst_structure_get_fourcc
#define gst_structure_get_fourcc(structure, fieldname, value) \
gst_compat_structure_get_fourcc(structure, fieldname, value)
static inline gboolean
gst_compat_structure_get_fourcc(const GstStructure *structure,
const gchar *fieldname, guint32 *value)
{
const gchar *s = gst_structure_get_string(structure, fieldname);
if (!s || strlen(s) != 4)
return FALSE;
*value = GST_MAKE_FOURCC(s[0], s[1], s[2], s[3]);
return TRUE;
}
/* GstTypeFind */
#undef GstTypeFindPeekFunction
#define GstTypeFindPeekFunction GstCompatTypeFindPeekFunction
#undef GstTypeFindSuggestFunction
#define GstTypeFindSuggestFunction GstCompatTypeFindSuggestFunction
typedef const guint8 *(*GstCompatTypeFindPeekFunction)(gpointer, gint64, guint);
typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, GstCaps *);
/* GstPad */
#define GST_PAD_CHAIN_FUNCTION_ARGS \
GstPad *pad, GstObject *parent, GstBuffer *buffer
#define GST_PAD_EVENT_FUNCTION_ARGS \
GstPad *pad, GstObject *parent, GstEvent *event
#define GST_PAD_QUERY_FUNCTION_ARGS \
GstPad *pad, GstObject *parent, GstQuery *query
#define GST_PAD_QUERY_FUNCTION_CALL(func, pad, parent, query) \
(func)(pad, parent, query)
/* Misc helpers */
#define GST_MAKE_FORMAT_STRING(FORMAT) \
"format=(string)" G_STRINGIFY(FORMAT)
#endif /* GST_COMPAT_H */

View file

@ -1124,6 +1124,7 @@ gst_vaapi_decoder_vc1_decode_codec_data(GstVaapiDecoder *base_decoder,
gint width, height; gint width, height;
guint32 format; guint32 format;
gint version; gint version;
const gchar *s;
priv->has_codec_data = TRUE; priv->has_codec_data = TRUE;
@ -1136,7 +1137,10 @@ gst_vaapi_decoder_vc1_decode_codec_data(GstVaapiDecoder *base_decoder,
caps = GST_VAAPI_DECODER_CODEC_STATE(decoder)->caps; caps = GST_VAAPI_DECODER_CODEC_STATE(decoder)->caps;
structure = gst_caps_get_structure(caps, 0); structure = gst_caps_get_structure(caps, 0);
if (!gst_structure_get_fourcc(structure, "format", &format)) { s = gst_structure_get_string(structure, "format");
if (s && strlen(s) == 4) {
format = GST_MAKE_FOURCC(s[0], s[1], s[2], s[3]);
} else {
/* Try to determine format from "wmvversion" property */ /* Try to determine format from "wmvversion" property */
if (gst_structure_get_int(structure, "wmvversion", &version)) if (gst_structure_get_int(structure, "wmvversion", &version))
format = (version >= 1 && version <= 3) ? format = (version >= 1 && version <= 3) ?

View file

@ -127,7 +127,7 @@ static const GstVaapiProfileMap gst_vaapi_profiles[] = {
"video/x-wmv, wmvversion=3", "main" "video/x-wmv, wmvversion=3", "main"
}, },
{ GST_VAAPI_PROFILE_VC1_ADVANCED, VAProfileVC1Advanced, { GST_VAAPI_PROFILE_VC1_ADVANCED, VAProfileVC1Advanced,
"video/x-wmv, wmvversion=3, " GST_MAKE_FORMAT_STRING(WVC1), "advanced" "video/x-wmv, wmvversion=3, format=(string)WVC1", "advanced"
}, },
#if VA_CHECK_VERSION(0,32,0) #if VA_CHECK_VERSION(0,32,0)
{ GST_VAAPI_PROFILE_JPEG_BASELINE, VAProfileJPEGBaseline, { GST_VAAPI_PROFILE_JPEG_BASELINE, VAProfileJPEGBaseline,

View file

@ -32,6 +32,7 @@
#include <string.h> #include <string.h>
#include "glibcompat.h" #include "glibcompat.h"
#include "gstcompat.h"
#include <gst/gst.h>
#endif /* SYSDEPS_H */ #endif /* SYSDEPS_H */

28
gst/vaapi/gstcompat.h Normal file
View file

@ -0,0 +1,28 @@
/*
* gstcompat.h - Compatibility glue for GStreamer
*
* Copyright (C) 2013 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef GST_COMPAT_H
#define GST_COMPAT_H
#include "gst/vaapi/sysdeps.h"
#endif /* GST_COMPAT_H */

View file

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/gst.h> #include <gst/gst.h>
#include "gstvaapidecode.h" #include "gstvaapidecode.h"
#include "gstvaapipostproc.h" #include "gstvaapipostproc.h"

View file

@ -30,7 +30,7 @@
* the vaapisink element. * the vaapisink element.
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include "gstvaapidecode.h" #include "gstvaapidecode.h"
@ -950,7 +950,7 @@ gst_vaapidecode_get_caps (GstPad * pad)
#if !GST_CHECK_VERSION(1,4,0) #if !GST_CHECK_VERSION(1,4,0)
static gboolean static gboolean
gst_vaapidecode_query (GST_PAD_QUERY_FUNCTION_ARGS) gst_vaapidecode_query (GstPad * pad, GstObject * parent, GstQuery * query)
{ {
GstVaapiDecode *const decode = GstVaapiDecode *const decode =
GST_VAAPIDECODE (gst_pad_get_parent_element (pad)); GST_VAAPIDECODE (gst_pad_get_parent_element (pad));
@ -1007,8 +1007,7 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query)
#else #else
GstPad *pad = GST_VIDEO_DECODER_SINK_PAD (vdec); GstPad *pad = GST_VIDEO_DECODER_SINK_PAD (vdec);
GstObject *parent = gst_pad_get_parent (pad); GstObject *parent = gst_pad_get_parent (pad);
ret = GST_PAD_QUERY_FUNCTION_CALL (plugin->sinkpad_query, pad, parent, ret = plugin->sinkpad_query (pad, parent, query);
query);
if (parent) if (parent)
gst_object_unref (parent); gst_object_unref (parent);
#endif #endif
@ -1056,8 +1055,7 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query)
#else #else
GstPad *pad = GST_VIDEO_DECODER_SRC_PAD (vdec); GstPad *pad = GST_VIDEO_DECODER_SRC_PAD (vdec);
GstObject *parent = gst_pad_get_parent (pad); GstObject *parent = gst_pad_get_parent (pad);
ret = GST_PAD_QUERY_FUNCTION_CALL (plugin->srcpad_query, pad, parent, ret = plugin->srcpad_query (pad, parent, query);
query);
if (parent) if (parent)
gst_object_unref (parent); gst_object_unref (parent);
#endif #endif

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <gst/gst.h> #include <gst/gst.h>

View file

@ -21,7 +21,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapivalue.h> #include <gst/vaapi/gstvaapivalue.h>
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include "gstvaapiencode.h" #include "gstvaapiencode.h"
@ -68,7 +68,7 @@ ensure_uploader (GstVaapiEncode * encode)
} }
static gboolean static gboolean
gst_vaapiencode_query (GST_PAD_QUERY_FUNCTION_ARGS) gst_vaapiencode_query (GstPad * pad, GstObject * parent, GstQuery * query)
{ {
GstVaapiPluginBase *const plugin = GstVaapiPluginBase *const plugin =
GST_VAAPI_PLUGIN_BASE (gst_pad_get_parent_element (pad)); GST_VAAPI_PLUGIN_BASE (gst_pad_get_parent_element (pad));
@ -79,11 +79,9 @@ gst_vaapiencode_query (GST_PAD_QUERY_FUNCTION_ARGS)
if (gst_vaapi_reply_to_query (query, plugin->display)) if (gst_vaapi_reply_to_query (query, plugin->display))
success = TRUE; success = TRUE;
else if (GST_PAD_IS_SINK (pad)) else if (GST_PAD_IS_SINK (pad))
success = GST_PAD_QUERY_FUNCTION_CALL (plugin->sinkpad_query, success = plugin->sinkpad_query (plugin->sinkpad, parent, query);
plugin->sinkpad, parent, query);
else else
success = GST_PAD_QUERY_FUNCTION_CALL (plugin->srcpad_query, success = plugin->srcpad_query (plugin->srcpad, parent, query);
plugin->srcpad, parent, query);
gst_object_unref (plugin); gst_object_unref (plugin);
return success; return success;

View file

@ -21,7 +21,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include <gst/vaapi/gstvaapiencoder_h264.h> #include <gst/vaapi/gstvaapiencoder_h264.h>
#include <gst/vaapi/gstvaapiutils_h264.h> #include <gst/vaapi/gstvaapiutils_h264.h>

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include <gst/vaapi/gstvaapiencoder_jpeg.h> #include <gst/vaapi/gstvaapiencoder_jpeg.h>
#include "gstvaapiencode_jpeg.h" #include "gstvaapiencode_jpeg.h"

View file

@ -21,7 +21,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include <gst/vaapi/gstvaapiencoder_mpeg2.h> #include <gst/vaapi/gstvaapiencoder_mpeg2.h>
#include "gstvaapiencode_mpeg2.h" #include "gstvaapiencode_mpeg2.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include <gst/vaapi/gstvaapiencoder_vp8.h> #include <gst/vaapi/gstvaapiencoder_vp8.h>
#include "gstvaapiencode_vp8.h" #include "gstvaapiencode_vp8.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/gst.h> #include <gst/gst.h>
#include "gstvaapiparse.h" #include "gstvaapiparse.h"
#include "gsth264parse.h" #include "gsth264parse.h"

View file

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapisurface_drm.h> #include <gst/vaapi/gstvaapisurface_drm.h>
#include <gst/base/gstpushsrc.h> #include <gst/base/gstpushsrc.h>
#include "gstvaapipluginbase.h" #include "gstvaapipluginbase.h"

View file

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include "gstvaapivideocontext.h" #include "gstvaapivideocontext.h"
#if USE_DRM #if USE_DRM
# include <gst/vaapi/gstvaapidisplay_drm.h> # include <gst/vaapi/gstvaapidisplay_drm.h>

View file

@ -29,7 +29,7 @@
* implemented. * implemented.
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/video/video.h> #include <gst/video/video.h>
#include "gstvaapipostproc.h" #include "gstvaapipostproc.h"

View file

@ -31,7 +31,7 @@
* create its own internal window and render into it. * create its own internal window and render into it.
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>

View file

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <string.h> #include <string.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/vaapi/gstvaapisurface.h> #include <gst/vaapi/gstvaapisurface.h>

View file

@ -27,7 +27,7 @@
* @short_description: VA video buffer for GStreamer * @short_description: VA video buffer for GStreamer
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include "gstvaapivideobuffer.h" #include "gstvaapivideobuffer.h"
#if USE_X11 && !GST_CHECK_VERSION(1,1,0) #if USE_X11 && !GST_CHECK_VERSION(1,1,0)
# include "gstvaapivideoconverter_x11.h" # include "gstvaapivideoconverter_x11.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include "gstvaapivideobufferpool.h" #include "gstvaapivideobufferpool.h"
#include "gstvaapivideobuffer.h" #include "gstvaapivideobuffer.h"
#include "gstvaapivideomemory.h" #include "gstvaapivideomemory.h"

View file

@ -23,7 +23,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include "gstvaapivideocontext.h" #include "gstvaapivideocontext.h"
#if GST_CHECK_VERSION(1,1,0) #if GST_CHECK_VERSION(1,1,0)

View file

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapitexture_glx.h> #include <gst/vaapi/gstvaapitexture_glx.h>
#include "gstvaapivideoconverter_glx.h" #include "gstvaapivideoconverter_glx.h"
#include "gstvaapivideoconverter_x11.h" #include "gstvaapivideoconverter_x11.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapipixmap_x11.h> #include <gst/vaapi/gstvaapipixmap_x11.h>
#include "gstvaapivideoconverter_x11.h" #include "gstvaapivideoconverter_x11.h"
#include "gstvaapipluginutil.h" #include "gstvaapipluginutil.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <unistd.h> #include <unistd.h>
#include <gst/vaapi/gstvaapisurface_drm.h> #include <gst/vaapi/gstvaapisurface_drm.h>
#include <gst/vaapi/gstvaapisurfacepool.h> #include <gst/vaapi/gstvaapisurfacepool.h>

View file

@ -27,7 +27,7 @@
* @short_description: VA video meta for GStreamer * @short_description: VA video meta for GStreamer
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include <gst/vaapi/gstvaapiimagepool.h> #include <gst/vaapi/gstvaapiimagepool.h>
#include <gst/vaapi/gstvaapisurfacepool.h> #include <gst/vaapi/gstvaapisurfacepool.h>
#include "gstvaapivideometa.h" #include "gstvaapivideometa.h"

View file

@ -24,7 +24,7 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#include "gst/vaapi/sysdeps.h" #include "gstcompat.h"
#include "gst/vaapi/ogl_compat.h" #include "gst/vaapi/ogl_compat.h"
#include "gstvaapivideometa.h" #include "gstvaapivideometa.h"
#include "gstvaapivideometa_texture.h" #include "gstvaapivideometa_texture.h"

View file

@ -42,7 +42,7 @@ static const CodecMap g_codec_map[] = {
{ "wmv3", GST_VAAPI_CODEC_VC1, { "wmv3", GST_VAAPI_CODEC_VC1,
"video/x-wmv, wmvversion=3" }, "video/x-wmv, wmvversion=3" },
{ "vc1", GST_VAAPI_CODEC_VC1, { "vc1", GST_VAAPI_CODEC_VC1,
"video/x-wmv, wmvversion=3, " GST_MAKE_FORMAT_STRING(WVC1) }, "video/x-wmv, wmvversion=3, format=(string)WVC1" },
{ NULL, } { NULL, }
}; };
@ -156,8 +156,8 @@ codec_identifier_new(const gchar *filename)
goto error; goto error;
tfp = &cip->type_find; tfp = &cip->type_find;
tfp->peek = (GstTypeFindPeekFunction)codec_identifier_peek; tfp->peek = codec_identifier_peek;
tfp->suggest = (GstTypeFindSuggestFunction)codec_identifier_suggest; tfp->suggest = codec_identifier_suggest;
tfp->data = cip; tfp->data = cip;
return cip; return cip;