2 * Copyright (C) 2007 David Schleef <ds@schleef.org>
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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
25 #include <gst/base/gstpushsrc.h>
29 #include "gstappbuffer.h"
31 static void gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class);
32 static void gst_app_buffer_class_init (gpointer g_class, gpointer class_data);
33 static void gst_app_buffer_finalize (GstAppBuffer * buffer);
35 static GstBufferClass *parent_class;
38 gst_app_buffer_get_type (void)
40 static volatile gsize app_buffer_type = 0;
42 if (g_once_init_enter (&app_buffer_type)) {
43 static const GTypeInfo app_buffer_info = {
44 sizeof (GstBufferClass),
47 gst_app_buffer_class_init,
50 sizeof (GstAppBuffer),
52 (GInstanceInitFunc) gst_app_buffer_init,
55 GType tmp = g_type_register_static (GST_TYPE_BUFFER, "GstAppBuffer",
57 g_once_init_leave (&app_buffer_type, tmp);
60 return (GType) app_buffer_type;
64 gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class)
70 gst_app_buffer_class_init (gpointer g_class, gpointer class_data)
72 GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
74 mini_object_class->finalize =
75 (GstMiniObjectFinalizeFunction) gst_app_buffer_finalize;
77 parent_class = g_type_class_peek_parent (g_class);
81 gst_app_buffer_finalize (GstAppBuffer * buffer)
83 g_return_if_fail (buffer != NULL);
84 g_return_if_fail (GST_IS_APP_BUFFER (buffer));
86 if (buffer->finalize) {
87 buffer->finalize (buffer->priv);
90 GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (buffer));
94 gst_app_buffer_new (void *data, int length,
95 GstAppBufferFinalizeFunc finalize, void *priv)
99 buffer = (GstAppBuffer *) gst_mini_object_new (GST_TYPE_APP_BUFFER);
101 GST_BUFFER_DATA (buffer) = data;
102 GST_BUFFER_SIZE (buffer) = length;
104 buffer->finalize = finalize;
107 return GST_BUFFER (buffer);