summaryrefslogtreecommitdiff
path: root/src/gstducatiprivmeta.c
blob: da64941039addefc1fdf0f0bd97dbc0b9fc114f5 (plain)
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
/*
 * GStreamer
 *
 * Copyright (C) 2012 Texas Instruments
 * Copyright (C) 2012 Collabora Ltd
 *
 * Authors:
 *  Alessandro Decina <alessandro.decina@collabora.co.uk>
 *  Rob Clark <rob.clark@linaro.org>
 *
 * 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
 * version 2.1 of the License.
 *
 * 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
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdint.h>
#include <gst/gst.h>

#include <omap_drm.h>
#include <omap_drmif.h>
#include <xf86drmMode.h>

#include "gstducatiprivmeta.h"

static void
gst_ducati_priv_meta_free (GstMeta * meta, GstBuffer * buffer)
{
  GstDucatiPrivMeta *smeta = (GstDucatiPrivMeta *) meta;

  /* FIXME : Shouldn't we check if the bo is valid ? */
  omap_bo_del (smeta->bo);
}

/**
 * gst_buffer_add_ducati_priv_meta:
 * @buffer: a #GstBuffer
 *
 * Returns: the #GstDucatiPrivMeta on @buffer.
 */
GstDucatiPrivMeta *
gst_buffer_add_ducati_priv_meta (GstBuffer * buffer)
{
  return (GstDucatiPrivMeta *) gst_buffer_add_meta (buffer,
      GST_DUCATI_PRIV_META_INFO, NULL);
}

GType
gst_ducati_priv_meta_api_get_type (void)
{
  static volatile GType type;
  static const gchar *tags[] = { NULL };

  if (g_once_init_enter (&type)) {
    GType _type = gst_meta_api_type_register ("GstDucatiPrivMetaAPI", tags);
    g_once_init_leave (&type, _type);
  }
  return type;
}

const GstMetaInfo *
gst_ducati_priv_meta_get_info (void)
{
  static const GstMetaInfo *ducati_priv_meta_info = NULL;

  if (ducati_priv_meta_info == NULL) {
    ducati_priv_meta_info = gst_meta_register (GST_DUCATI_PRIV_META_API_TYPE, "GstDucatiPrivMeta", sizeof (GstDucatiPrivMeta), NULL,    /* No init needed */
        gst_ducati_priv_meta_free, NULL /* FIXME : No transform needed ? */ );
  }
  return ducati_priv_meta_info;
}