2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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.
21 #include <gstfakesink.h>
24 GstElementDetails gst_fakesink_details = {
27 "Black hole for data",
29 "Erik Walthinsen <omega@cse.ogi.edu>",
34 /* FakeSink signals and args */
46 static void gst_fakesink_class_init(GstFakeSinkClass *klass);
47 static void gst_fakesink_init(GstFakeSink *fakesink);
49 GstElement *gst_fakesink_new(gchar *name);
50 void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
52 static GstSinkClass *parent_class = NULL;
53 //static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
56 gst_fakesink_get_type(void) {
57 static GtkType fakesink_type = 0;
60 static const GtkTypeInfo fakesink_info = {
63 sizeof(GstFakeSinkClass),
64 (GtkClassInitFunc)gst_fakesink_class_init,
65 (GtkObjectInitFunc)gst_fakesink_init,
68 (GtkClassInitFunc)NULL,
70 fakesink_type = gtk_type_unique(GST_TYPE_SINK,&fakesink_info);
76 gst_fakesink_class_init(GstFakeSinkClass *klass) {
77 GstSinkClass *gstsink_class;
79 gstsink_class = (GstSinkClass*)klass;
81 parent_class = gtk_type_class(GST_TYPE_SINK);
84 static void gst_fakesink_init(GstFakeSink *fakesink) {
85 fakesink->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
86 gst_element_add_pad(GST_ELEMENT(fakesink),fakesink->sinkpad);
87 gst_pad_set_chain_function(fakesink->sinkpad,gst_fakesink_chain);
89 // we're ready right away, since we don't have any args...
90 // gst_element_set_state(GST_ELEMENT(fakesink),GST_STATE_READY);
95 * @name: the name of the new fakesrc
97 * create a new fakesink
99 * Returns: the new fakesink
101 GstElement *gst_fakesink_new(gchar *name) {
102 GstElement *fakesink = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESINK));
103 gst_element_set_name(GST_ELEMENT(fakesink),name);
108 * gst_fakesink_chain:
109 * @pad: the pad this faksink is connected to
110 * @buf: the buffer that has to be absorbed
112 * take the buffer from the pad and unref it without doing
115 void gst_fakesink_chain(GstPad *pad,GstBuffer *buf) {
116 GstFakeSink *fakesink;
118 g_return_if_fail(pad != NULL);
119 g_return_if_fail(GST_IS_PAD(pad));
120 g_return_if_fail(buf != NULL);
122 fakesink = GST_FAKESINK(pad->parent);
123 // g_print("gst_fakesink_chain: got buffer in '%s'\n",
124 // gst_element_get_name(GST_ELEMENT(fakesink)));
126 gst_buffer_unref(buf);