]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blob - src/gstducatibufferpriv.c
ducatih264enc is now using ih264enc.h from ducati side, rather than re-defining enums
[glsdk/gst-plugin-ducati.git] / src / gstducatibufferpriv.c
1 /*
2  * GStreamer
3  *
4  * Copyright (C) 2012 Texas Instruments
5  * Copyright (C) 2012 Collabora Ltd
6  *
7  * Authors:
8  *  Alessandro Decina <alessandro.decina@collabora.co.uk>
9  *  Rob Clark <rob.clark@linaro.org>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation
14  * version 2.1 of the License.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24  */
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
30 #include <stdint.h>
31 #include <gst/gst.h>
33 #include <omap_drm.h>
34 #include <omap_drmif.h>
35 #include <xf86drmMode.h>
37 #include "gstducatibufferpriv.h"
39 #define GST_DUCATI_BUFFER_PRIV_QUARK gst_ducati_buffer_priv_quark_get_type()
40 static GST_BOILERPLATE_QUARK (GstDucatiBufferPriv, gst_ducati_buffer_priv_quark);
42 #define DUCATI_BUFFER_PRIV_QUARK ducati_buffer_priv_quark_get_type()
43 static GST_BOILERPLATE_QUARK (DucatiBufferPriv, ducati_buffer_priv_quark);
45 void
46 gst_ducati_buffer_priv_set (GstBuffer * buf, GstDucatiBufferPriv * priv)
47 {
48   gst_buffer_set_qdata (buf, GST_DUCATI_BUFFER_PRIV_QUARK,
49       gst_structure_id_new (GST_DUCATI_BUFFER_PRIV_QUARK,
50           DUCATI_BUFFER_PRIV_QUARK, GST_TYPE_DUCATI_BUFFER_PRIV, priv, NULL));
51 }
53 GstDucatiBufferPriv *
54 gst_ducati_buffer_priv_get (GstBuffer * buf)
55 {
56   const GstStructure *s;
57   const GValue *val;
59   s = gst_buffer_get_qdata (buf, GST_DUCATI_BUFFER_PRIV_QUARK);
60   if (s == NULL)
61     return NULL;
63   val = gst_structure_id_get_value (s, DUCATI_BUFFER_PRIV_QUARK);
64   if (val == NULL)
65     return NULL;
67   return GST_DUCATI_BUFFER_PRIV (gst_value_get_mini_object (val));
68 }
70 GstDucatiBufferPriv *
71 gst_ducati_buffer_priv_new (void)
72 {
73   return (GstDucatiBufferPriv *) gst_mini_object_new (GST_TYPE_DUCATI_BUFFER_PRIV);
74 }
76 static void
77 gst_ducati_buffer_priv_finalize (GstMiniObject * mini_obj)
78 {
79   GstDucatiBufferPriv *priv = (GstDucatiBufferPriv *) mini_obj;
81   omap_bo_del (priv->bo);
83   /* not chaining up to GstMiniObject's finalize for now, we know it's empty */
84 }
86 GST_BOILERPLATE_MINI_OBJECT(GstDucatiBufferPriv, gst_ducati_buffer_priv);
88 static void
89 gst_ducati_buffer_priv_class_init (GstDucatiBufferPrivClass * klass)
90 {
91   GST_MINI_OBJECT_CLASS (klass)->finalize = gst_ducati_buffer_priv_finalize;
92 }