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 <gstfakesrc.h>
24 GstElementDetails gst_fakesrc_details = {
27 "Push empty (no data) buffers around",
29 "Erik Walthinsen <omega@cse.ogi.edu>",
34 /* FakeSrc signals and args */
46 static void gst_fakesrc_class_init(GstFakeSrcClass *klass);
47 static void gst_fakesrc_init(GstFakeSrc *fakesrc);
49 void gst_fakesrc_push(GstSrc *src);
51 static GstSrcClass *parent_class = NULL;
52 //static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
55 gst_fakesrc_get_type(void) {
56 static GtkType fakesrc_type = 0;
59 static const GtkTypeInfo fakesrc_info = {
62 sizeof(GstFakeSrcClass),
63 (GtkClassInitFunc)gst_fakesrc_class_init,
64 (GtkObjectInitFunc)gst_fakesrc_init,
67 (GtkClassInitFunc)NULL,
69 fakesrc_type = gtk_type_unique(GST_TYPE_SRC,&fakesrc_info);
75 gst_fakesrc_class_init(GstFakeSrcClass *klass) {
76 GstSrcClass *gstsrc_class;
78 gstsrc_class = (GstSrcClass*)klass;
80 parent_class = gtk_type_class(GST_TYPE_SRC);
82 gstsrc_class->push = gst_fakesrc_push;
83 gstsrc_class->push_region = NULL;
86 static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
87 fakesrc->srcpad = gst_pad_new("src",GST_PAD_SRC);
88 gst_element_add_pad(GST_ELEMENT(fakesrc),fakesrc->srcpad);
90 // we're already complete, since we don't have any args...
91 gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_COMPLETE);
96 * @name: then name of the fakse source
98 * create a new fakesrc
100 * Returns: The new element.
102 GstElement *gst_fakesrc_new(gchar *name) {
103 GstElement *fakesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESRC));
104 gst_element_set_name(GST_ELEMENT(fakesrc),name);
110 * @src: the faksesrc to push
112 * generate an empty buffer and push it to the next element.
114 void gst_fakesrc_push(GstSrc *src) {
118 g_return_if_fail(src != NULL);
119 g_return_if_fail(GST_IS_FAKESRC(src));
120 fakesrc = GST_FAKESRC(src);
122 // g_print("gst_fakesrc_push(): pushing fake buffer from '%s'\n",
123 // gst_element_get_name(GST_ELEMENT(fakesrc)));
125 buf = gst_buffer_new();
126 gst_pad_push(fakesrc->srcpad,buf);