2 * Copyright (C) 2016 Biela.Jo <doriya@nexell.co.kr>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include "gstmmvideobuffermeta.h"
23 gst_mmvideobuffer_meta_api_get_type (void)
25 static volatile GType type;
26 static const gchar *tags[] = { "MMVideoBuffer", NULL };
28 if (g_once_init_enter (&type)) {
29 GType _type = gst_meta_api_type_register ("GstMMVideoBufferMetaAPI", tags);
30 g_once_init_leave (&type, _type);
37 gst_mmvideobuffer_meta_init (GstMeta * meta, gpointer params,
40 GstMMVideoBufferMeta *emeta = (GstMMVideoBufferMeta *) meta;
42 emeta->memory_index = -1;
48 gst_mmvideobuffer_meta_transform (GstBuffer * transbuf, GstMeta * meta,
49 GstBuffer * buffer, GQuark type, gpointer data)
51 GstMMVideoBufferMeta *emeta = (GstMMVideoBufferMeta *) meta;
53 /* we always copy no matter what transform */
54 gst_buffer_add_mmvideobuffer_meta (transbuf, emeta->memory_index);
60 gst_mmvideobuffer_meta_free (GstMeta * meta, GstBuffer * buffer)
62 GstMMVideoBufferMeta *emeta = (GstMMVideoBufferMeta *) meta;
64 emeta->memory_index = -1;
68 gst_mmvideobuffer_meta_get_info (void)
70 static const GstMetaInfo *meta_info = NULL;
72 if (g_once_init_enter (&meta_info)) {
73 const GstMetaInfo *mi = gst_meta_register (GST_MMVIDEOBUFFER_META_API_TYPE,
74 "GstMMVideoBufferMeta",
75 sizeof (GstMMVideoBufferMeta),
76 gst_mmvideobuffer_meta_init,
77 gst_mmvideobuffer_meta_free,
78 gst_mmvideobuffer_meta_transform);
80 g_once_init_leave (&meta_info, mi);
85 GstMMVideoBufferMeta *
86 gst_buffer_add_mmvideobuffer_meta (GstBuffer * buffer, gint memory_index)
88 GstMMVideoBufferMeta *meta;
90 g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
93 (GstMMVideoBufferMeta *) gst_buffer_add_meta (buffer,
94 GST_MMVIDEOBUFFER_META_INFO, NULL);
95 meta->memory_index = memory_index;