1 /* Gnome-Streamer
2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 *
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.
8 *
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.
13 *
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.
18 */
21 #include <gstfakesrc.h>
24 GstElementDetails gst_fakesrc_details = {
25 "Fake Source",
26 "Source",
27 "Push empty (no data) buffers around",
28 VERSION,
29 "Erik Walthinsen <omega@cse.ogi.edu>",
30 "(C) 1999",
31 };
34 /* FakeSrc signals and args */
35 enum {
36 /* FILL ME */
37 LAST_SIGNAL
38 };
40 enum {
41 ARG_0,
42 /* FILL ME */
43 };
46 static void gst_fakesrc_class_init(GstFakeSrcClass *klass);
47 static void gst_fakesrc_init(GstFakeSrc *fakesrc);
50 static GstSrcClass *parent_class = NULL;
51 static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
53 GtkType
54 gst_fakesrc_get_type(void) {
55 static GtkType fakesrc_type = 0;
57 if (!fakesrc_type) {
58 static const GtkTypeInfo fakesrc_info = {
59 "GstFakeSrc",
60 sizeof(GstFakeSrc),
61 sizeof(GstFakeSrcClass),
62 (GtkClassInitFunc)gst_fakesrc_class_init,
63 (GtkObjectInitFunc)gst_fakesrc_init,
64 (GtkArgSetFunc)NULL,
65 (GtkArgGetFunc)NULL,
66 (GtkClassInitFunc)NULL,
67 };
68 fakesrc_type = gtk_type_unique(GST_TYPE_SRC,&fakesrc_info);
69 }
70 return fakesrc_type;
71 }
73 static void
74 gst_fakesrc_class_init(GstFakeSrcClass *klass) {
75 GstSrcClass *gstsrc_class;
77 gstsrc_class = (GstSrcClass*)klass;
79 parent_class = gtk_type_class(GST_TYPE_SRC);
81 gstsrc_class->push = gst_fakesrc_push;
82 gstsrc_class->push_region = NULL;
83 }
85 static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
86 fakesrc->srcpad = gst_pad_new("src",GST_PAD_SRC);
87 gst_element_add_pad(GST_ELEMENT(fakesrc),fakesrc->srcpad);
89 // we're already complete, since we don't have any args...
90 gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_COMPLETE);
91 }
93 GstElement *gst_fakesrc_new(gchar *name) {
94 GstElement *fakesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESRC));
95 gst_element_set_name(GST_ELEMENT(fakesrc),name);
96 return fakesrc;
97 }
99 void gst_fakesrc_push(GstSrc *src) {
100 GstFakeSrc *fakesrc;
101 GstBuffer *buf;
103 g_return_if_fail(src != NULL);
104 g_return_if_fail(GST_IS_FAKESRC(src));
105 fakesrc = GST_FAKESRC(src);
107 // g_print("gst_fakesrc_push(): pushing fake buffer from '%s'\n",
108 // gst_element_get_name(GST_ELEMENT(fakesrc)));
109 g_print(">");
110 buf = gst_buffer_new();
111 gst_pad_push(fakesrc->srcpad,buf);
112 }