aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Schleef2010-12-17 16:50:50 -0600
committerDavid Schleef2011-01-05 20:27:04 -0600
commita09078db4a44d3726ecb19b3d2b3765ac68d5d6c (patch)
tree5ceb48c0db964d00b70cd89c2b0c73085502068d /tools
parentc627cd40e76f8927cdf046d039d5955916b11645 (diff)
downloadgst-plugins-bad0-10-a09078db4a44d3726ecb19b3d2b3765ac68d5d6c.tar.gz
gst-plugins-bad0-10-a09078db4a44d3726ecb19b3d2b3765ac68d5d6c.tar.xz
gst-plugins-bad0-10-a09078db4a44d3726ecb19b3d2b3765ac68d5d6c.zip
element-maker: improve pushsrc
Diffstat (limited to 'tools')
-rw-r--r--tools/element-templates/pushsrc213
-rwxr-xr-xtools/gst-element-maker33
2 files changed, 236 insertions, 10 deletions
diff --git a/tools/element-templates/pushsrc b/tools/element-templates/pushsrc
index 4dfb67849..56cc7a6bf 100644
--- a/tools/element-templates/pushsrc
+++ b/tools/element-templates/pushsrc
@@ -10,13 +10,221 @@ gstreamer-base-0.10
10% includes 10% includes
11#include <gst/base/gstpushsrc.h> 11#include <gst/base/gstpushsrc.h>
12% prototypes 12% prototypes
13static GstCaps *gst_replace_get_caps (GstBaseSrc * src);
14static gboolean gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps);
15static gboolean gst_replace_negotiate (GstBaseSrc * src);
16static gboolean gst_replace_newsegment (GstBaseSrc * src);
17static gboolean gst_replace_start (GstBaseSrc * src);
18static gboolean gst_replace_stop (GstBaseSrc * src);
19static void
20gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
21 GstClockTime * start, GstClockTime * end);
22static gboolean gst_replace_get_size (GstBaseSrc * src, guint64 * size);
23static gboolean gst_replace_is_seekable (GstBaseSrc * src);
24static gboolean gst_replace_unlock (GstBaseSrc * src);
25static gboolean gst_replace_event (GstBaseSrc * src, GstEvent * event);
26static gboolean gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment);
27static gboolean gst_replace_query (GstBaseSrc * src, GstQuery * query);
28static gboolean gst_replace_check_get_range (GstBaseSrc * src);
29static void gst_replace_fixate (GstBaseSrc * src, GstCaps * caps);
30static gboolean gst_replace_unlock_stop (GstBaseSrc * src);
31static gboolean
32gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
33 GstSegment * segment);
13static GstFlowReturn gst_replace_create (GstPushSrc * src, GstBuffer ** buf); 34static GstFlowReturn gst_replace_create (GstPushSrc * src, GstBuffer ** buf);
14% declare-class 35% declare-class
15 GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass); 36 GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
37 GstPushSrcClass *push_src_class = GST_PUSH_SRC_CLASS (klass);
16% set-methods 38% set-methods
17 pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_replace_create); 39 base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
40 base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
41 base_src_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
42 base_src_class->newsegment = GST_DEBUG_FUNCPTR (gst_replace_newsegment);
43 base_src_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
44 base_src_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
45 base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
46 base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_replace_get_size);
47 base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_replace_is_seekable);
48 base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
49 base_src_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
50 base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_replace_do_seek);
51 base_src_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
52 base_src_class->check_get_range = GST_DEBUG_FUNCPTR (gst_replace_check_get_range);
53 base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
54 base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
55 base_src_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_replace_prepare_seek_segment);
56
57 push_src_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
18% methods 58% methods
19 59
60static GstCaps *
61gst_replace_get_caps (GstBaseSrc * src)
62{
63 GstReplace *replace = GST_REPLACE (src);
64
65 GST_DEBUG_OBJECT (replace, "get_caps");
66
67 return NULL;
68}
69
70static gboolean
71gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
72{
73 GstReplace *replace = GST_REPLACE (src);
74
75 GST_DEBUG_OBJECT (replace, "set_caps");
76
77 return TRUE;
78}
79
80static gboolean
81gst_replace_negotiate (GstBaseSrc * src)
82{
83 GstReplace *replace = GST_REPLACE (src);
84
85 GST_DEBUG_OBJECT (replace, "negotiate");
86
87 return TRUE;
88}
89
90static gboolean
91gst_replace_newsegment (GstBaseSrc * src)
92{
93 GstReplace *replace = GST_REPLACE (src);
94
95 GST_DEBUG_OBJECT (replace, "newsegment");
96
97 return TRUE;
98}
99
100static gboolean
101gst_replace_start (GstBaseSrc * src)
102{
103 GstReplace *replace = GST_REPLACE (src);
104
105 GST_DEBUG_OBJECT (replace, "start");
106
107 return TRUE;
108}
109
110static gboolean
111gst_replace_stop (GstBaseSrc * src)
112{
113 GstReplace *replace = GST_REPLACE (src);
114
115 GST_DEBUG_OBJECT (replace, "stop");
116
117 return TRUE;
118}
119
120static void
121gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
122 GstClockTime * start, GstClockTime * end)
123{
124 GstReplace *replace = GST_REPLACE (src);
125
126 GST_DEBUG_OBJECT (replace, "get_times");
127}
128
129static gboolean
130gst_replace_get_size (GstBaseSrc * src, guint64 * size)
131{
132 GstReplace *replace = GST_REPLACE (src);
133
134 GST_DEBUG_OBJECT (replace, "get_size");
135
136 return TRUE;
137}
138
139static gboolean
140gst_replace_is_seekable (GstBaseSrc * src)
141{
142 GstReplace *replace = GST_REPLACE (src);
143
144 GST_DEBUG_OBJECT (replace, "is_seekable");
145
146 return FALSE;
147}
148
149static gboolean
150gst_replace_unlock (GstBaseSrc * src)
151{
152 GstReplace *replace = GST_REPLACE (src);
153
154 GST_DEBUG_OBJECT (replace, "unlock");
155
156 return TRUE;
157}
158
159static gboolean
160gst_replace_event (GstBaseSrc * src, GstEvent * event)
161{
162 GstReplace *replace = GST_REPLACE (src);
163
164 GST_DEBUG_OBJECT (replace, "event");
165
166 return TRUE;
167}
168
169static gboolean
170gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
171{
172 GstReplace *replace = GST_REPLACE (src);
173
174 GST_DEBUG_OBJECT (replace, "do_seek");
175
176 return FALSE;
177}
178
179static gboolean
180gst_replace_query (GstBaseSrc * src, GstQuery * query)
181{
182 GstReplace *replace = GST_REPLACE (src);
183
184 GST_DEBUG_OBJECT (replace, "query");
185
186 return TRUE;
187}
188
189static gboolean
190gst_replace_check_get_range (GstBaseSrc * src)
191{
192 GstReplace *replace = GST_REPLACE (src);
193
194 GST_DEBUG_OBJECT (replace, "get_range");
195
196 return FALSE;
197}
198
199static void
200gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
201{
202 GstReplace *replace = GST_REPLACE (src);
203
204 GST_DEBUG_OBJECT (replace, "fixate");
205}
206
207static gboolean
208gst_replace_unlock_stop (GstBaseSrc * src)
209{
210 GstReplace *replace = GST_REPLACE (src);
211
212 GST_DEBUG_OBJECT (replace, "stop");
213
214 return TRUE;
215}
216
217static gboolean
218gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
219 GstSegment * segment)
220{
221 GstReplace *replace = GST_REPLACE (src);
222
223 GST_DEBUG_OBJECT (replace, "seek_segment");
224
225 return FALSE;
226}
227
20static GstFlowReturn 228static GstFlowReturn
21gst_replace_create (GstPushSrc * src, GstBuffer ** buf) 229gst_replace_create (GstPushSrc * src, GstBuffer ** buf)
22{ 230{
@@ -24,3 +232,4 @@ gst_replace_create (GstPushSrc * src, GstBuffer ** buf)
24 return GST_FLOW_OK; 232 return GST_FLOW_OK;
25} 233}
26% end 234% end
235
diff --git a/tools/gst-element-maker b/tools/gst-element-maker
index aa899b652..67525ef7f 100755
--- a/tools/gst-element-maker
+++ b/tools/gst-element-maker
@@ -116,7 +116,6 @@ cat <<-EOF
116 */ 116 */
117EOF 117EOF
118 118
119#grep -A 10000 '^% copyright' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
120 119
121cat <<EOF 120cat <<EOF
122 121
@@ -124,9 +123,9 @@ cat <<EOF
124#include "config.h" 123#include "config.h"
125#endif 124#endif
126 125
126#include <gst/gst.h>
127EOF 127EOF
128 128
129grep -A 10000 '^% includes' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
130grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 129grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
131grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 130grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
132 131
@@ -140,7 +139,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_replace_debug);
140 139
141EOF 140EOF
142 141
143grep -A 10000 '^% prototypes' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
144grep -A 10000 '^% prototypes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 142grep -A 10000 '^% prototypes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
145grep -A 10000 '^% prototypes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 143grep -A 10000 '^% prototypes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
146for each in $pads 144for each in $pads
@@ -180,6 +178,9 @@ gst_replace_base_init (gpointer g_class)
180{ 178{
181 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); 179 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
182 180
181 GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "replace", 0,
182 "replace element");
183
183EOF 184EOF
184 185
185for each in $pads 186for each in $pads
@@ -197,13 +198,11 @@ static void
197gst_replace_class_init (GstReplaceClass * klass) 198gst_replace_class_init (GstReplaceClass * klass)
198{ 199{
199EOF 200EOF
200grep -A 10000 '^% declare-class' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
201grep -A 10000 '^% declare-class' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 201grep -A 10000 '^% declare-class' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
202grep -A 10000 '^% declare-class' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 202grep -A 10000 '^% declare-class' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
203 203
204echo 204echo
205 205
206grep -A 10000 '^% set-methods' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
207grep -A 10000 '^% set-methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 206grep -A 10000 '^% set-methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
208grep -A 10000 '^% set-methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 207grep -A 10000 '^% set-methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
209 208
@@ -227,7 +226,6 @@ cat <<EOF
227EOF 226EOF
228 227
229 228
230grep -A 10000 '^% methods' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
231grep -A 10000 '^% methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 229grep -A 10000 '^% methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
232grep -A 10000 '^% methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 230grep -A 10000 '^% methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
233for each in $pads 231for each in $pads
@@ -275,7 +273,27 @@ EOF
275generate_header () 273generate_header ()
276{ 274{
277 275
278grep -A 10000 '^% copyright' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 276cat <<-EOF
277/* GStreamer
278 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
279 *
280 * This library is free software; you can redistribute it and/or
281 * modify it under the terms of the GNU Library General Public
282 * License as published by the Free Software Foundation; either
283 * version 2 of the License, or (at your option) any later version.
284 *
285 * This library is distributed in the hope that it will be useful,
286 * but WITHOUT ANY WARRANTY; without even the implied warranty of
287 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
288 * Library General Public License for more details.
289 *
290 * You should have received a copy of the GNU Library General Public
291 * License along with this library; if not, write to the
292 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
293 * Boston, MA 02111-1307, USA.
294 */
295
296EOF
279 297
280cat <<EOF 298cat <<EOF
281#ifndef _GST_REPLACE_H_ 299#ifndef _GST_REPLACE_H_
@@ -283,7 +301,6 @@ cat <<EOF
283 301
284EOF 302EOF
285 303
286grep -A 10000 '^% includes' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
287grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 304grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
288grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 305grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
289 306