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
|
/* GStreamer
* Copyright (C) 2011 Collabora Ltd.
* Copyright (C) 2011 Intel
*
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstsurfacemeta.h"
/**
* SECTION:gstsurfacemeta
* @short_description: Accelerated surface metadata
*
* This meta data is used to abstract hardware accelerated buffers and enable
* generic convertion to standard type such as GL textures. The media type for
* those buffers is defined by #GST_VIDEO_CAPS_SURFACE. An implementation
* specific type must be set using the "type" key (e.g. type="vaapi").
* Available convertion type are speficied using seperate boolean
* arguement (e.g. opengl=true). Having this information in the capabilities
* allow easy negotiating of such feature with other elements (e.g. a
* ClutterGstVideoSink can claim accpeting caps "video/x-surface,opengl=true").
* <note>
* The GstSurfaceMeta interface is unstable API and may change in future.
* One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning.
* </note>
*/
GType
gst_surface_meta_api_get_type (void)
{
static volatile GType type;
static const gchar *tags[] = { "memory", NULL };
if (g_once_init_enter (&type)) {
GType _type = gst_meta_api_type_register ("GstSurfaceMetaAPI", tags);
g_once_init_leave (&type, _type);
}
return type;
}
const GstMetaInfo *
gst_surface_meta_get_info (void)
{
static const GstMetaInfo *meta_info = NULL;
if (g_once_init_enter (&meta_info)) {
const GstMetaInfo *meta =
gst_meta_register (GST_SURFACE_META_API_TYPE, "GstSurfaceMeta",
sizeof (GstSurfaceMeta),
(GstMetaInitFunction) NULL,
(GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL);
g_once_init_leave (&meta_info, meta);
}
return meta_info;
}
/**
* gst_surface_meta_create_converter:
* @meta: a #GstSurfaceMeta
* @type: the type to convert to
* @dest: a #GValue containing the destination to upload
*
* This method is used to create a type specific converter. The converter will
* serve as context to accelerate the data convertion. This converter object
* shall be discarded when the pipeline state changes to NULL and renewed when
* caps are changed.
*
* Returns: newly allocated #GstSurfaceConverter
*/
GstSurfaceConverter *
gst_surface_meta_create_converter (GstSurfaceMeta * meta,
const gchar * type, GValue * dest)
{
g_return_val_if_fail (meta != NULL, FALSE);
return meta->create_converter (meta, type, dest);
}
|