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;
guint32 format;
gint version;
const gchar *s;
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;
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 */
if (gst_structure_get_int(structure, "wmvversion", &version))
format = (version >= 1 && version <= 3) ?

View file

@ -127,7 +127,7 @@ static const GstVaapiProfileMap gst_vaapi_profiles[] = {
"video/x-wmv, wmvversion=3", "main"
},
{ 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)
{ GST_VAAPI_PROFILE_JPEG_BASELINE, VAProfileJPEGBaseline,

View file

@ -32,6 +32,7 @@
#include <string.h>
#include "glibcompat.h"
#include "gstcompat.h"
#include <gst/gst.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
*/
#include "gst/vaapi/sysdeps.h"
#include "gstcompat.h"
#include <gst/gst.h>
#include "gstvaapidecode.h"
#include "gstvaapipostproc.h"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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