1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
* gstcompat.h - Compatibility glue for GStreamer
*
* Copyright (C) 2013 Intel Corporation
*
* 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>
/* ------------------------------------------------------------------------ */
/* --- GStreamer >= 1.0 --- */
/* ------------------------------------------------------------------------ */
#if GST_CHECK_VERSION(1,0,0)
#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;
}
/* ------------------------------------------------------------------------ */
/* --- GStreamer = 0.10 --- */
/* ------------------------------------------------------------------------ */
#else
/* GstVideoOverlayComposition */
#include <gst/video/video-overlay-composition.h>
#undef gst_video_overlay_rectangle_get_pixels_unscaled_raw
#define gst_video_overlay_rectangle_get_pixels_unscaled_raw(rect, flags) \
gst_compat_video_overlay_rectangle_get_pixels_unscaled_raw(rect, flags)
#ifndef HAVE_GST_VIDEO_OVERLAY_HWCAPS
#define gst_video_overlay_rectangle_get_flags(rect) (0)
#define gst_video_overlay_rectangle_get_global_alpha(rect) (1.0f)
#endif
static inline GstBuffer *
gst_compat_video_overlay_rectangle_get_pixels_unscaled_raw(
GstVideoOverlayRectangle *rect, GstVideoOverlayFormatFlags flags)
{
guint width, height, stride;
/* Try to retrieve the original buffer that was passed to
gst_video_overlay_rectangle_new_argb(). This will only work if
there was no previous user that required pixels with non native
alpha type */
return gst_video_overlay_rectangle_get_pixels_unscaled_argb(rect,
&width, &height, &stride, flags);
}
/* GstElement */
#undef gst_element_class_set_static_metadata
#define gst_element_class_set_static_metadata(klass, name, path, desc, author) \
gst_compat_element_class_set_static_metadata(klass, name, path, desc, author)
static inline void
gst_compat_element_class_set_static_metadata(GstElementClass *klass,
const gchar *name, const char *path, const gchar *desc, const gchar *author)
{
gst_element_class_set_details_simple(klass, name, path, desc, author);
}
/* GstTypeFind */
#undef GstTypeFindPeekFunction
#define GstTypeFindPeekFunction GstCompatTypeFindPeekFunction
#undef GstTypeFindSuggestFunction
#define GstTypeFindSuggestFunction GstCompatTypeFindSuggestFunction
typedef guint8 *(*GstCompatTypeFindPeekFunction)(gpointer, gint64, guint);
typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, const GstCaps *);
#endif
#endif /* GST_COMPAT_H */
|