summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2010-12-17 14:50:50 -0800
committerDavid Schleef <ds@schleef.org>2011-01-05 18:27:04 -0800
commita09078db4a44d3726ecb19b3d2b3765ac68d5d6c (patch)
tree5ceb48c0db964d00b70cd89c2b0c73085502068d /tools
parentc627cd40e76f8927cdf046d039d5955916b11645 (diff)
downloadgstreamer-plugins-bad-a09078db4a44d3726ecb19b3d2b3765ac68d5d6c.tar.gz
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
% includes
#include <gst/base/gstpushsrc.h>
% prototypes
+static GstCaps *gst_replace_get_caps (GstBaseSrc * src);
+static gboolean gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps);
+static gboolean gst_replace_negotiate (GstBaseSrc * src);
+static gboolean gst_replace_newsegment (GstBaseSrc * src);
+static gboolean gst_replace_start (GstBaseSrc * src);
+static gboolean gst_replace_stop (GstBaseSrc * src);
+static void
+gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
+ GstClockTime * start, GstClockTime * end);
+static gboolean gst_replace_get_size (GstBaseSrc * src, guint64 * size);
+static gboolean gst_replace_is_seekable (GstBaseSrc * src);
+static gboolean gst_replace_unlock (GstBaseSrc * src);
+static gboolean gst_replace_event (GstBaseSrc * src, GstEvent * event);
+static gboolean gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment);
+static gboolean gst_replace_query (GstBaseSrc * src, GstQuery * query);
+static gboolean gst_replace_check_get_range (GstBaseSrc * src);
+static void gst_replace_fixate (GstBaseSrc * src, GstCaps * caps);
+static gboolean gst_replace_unlock_stop (GstBaseSrc * src);
+static gboolean
+gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
+ GstSegment * segment);
static GstFlowReturn gst_replace_create (GstPushSrc * src, GstBuffer ** buf);
% declare-class
- GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
+ GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
+ GstPushSrcClass *push_src_class = GST_PUSH_SRC_CLASS (klass);
% set-methods
- pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
+ base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
+ base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
+ base_src_class->negotiate = GST_DEBUG_FUNCPTR (gst_replace_negotiate);
+ base_src_class->newsegment = GST_DEBUG_FUNCPTR (gst_replace_newsegment);
+ base_src_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
+ base_src_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
+ base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
+ base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_replace_get_size);
+ base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_replace_is_seekable);
+ base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
+ base_src_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
+ base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_replace_do_seek);
+ base_src_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
+ base_src_class->check_get_range = GST_DEBUG_FUNCPTR (gst_replace_check_get_range);
+ base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
+ base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
+ base_src_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_replace_prepare_seek_segment);
+
+ push_src_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
% methods
+static GstCaps *
+gst_replace_get_caps (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "get_caps");
+
+ return NULL;
+}
+
+static gboolean
+gst_replace_set_caps (GstBaseSrc * src, GstCaps * caps)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "set_caps");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_negotiate (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "negotiate");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_newsegment (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "newsegment");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_start (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "start");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_stop (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "stop");
+
+ return TRUE;
+}
+
+static void
+gst_replace_get_times (GstBaseSrc * src, GstBuffer * buffer,
+ GstClockTime * start, GstClockTime * end)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "get_times");
+}
+
+static gboolean
+gst_replace_get_size (GstBaseSrc * src, guint64 * size)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "get_size");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_is_seekable (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "is_seekable");
+
+ return FALSE;
+}
+
+static gboolean
+gst_replace_unlock (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "unlock");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_event (GstBaseSrc * src, GstEvent * event)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "event");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_do_seek (GstBaseSrc * src, GstSegment * segment)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "do_seek");
+
+ return FALSE;
+}
+
+static gboolean
+gst_replace_query (GstBaseSrc * src, GstQuery * query)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "query");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_check_get_range (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "get_range");
+
+ return FALSE;
+}
+
+static void
+gst_replace_fixate (GstBaseSrc * src, GstCaps * caps)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "fixate");
+}
+
+static gboolean
+gst_replace_unlock_stop (GstBaseSrc * src)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "stop");
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
+ GstSegment * segment)
+{
+ GstReplace *replace = GST_REPLACE (src);
+
+ GST_DEBUG_OBJECT (replace, "seek_segment");
+
+ return FALSE;
+}
+
static GstFlowReturn
gst_replace_create (GstPushSrc * src, GstBuffer ** buf)
{
@@ -24,3 +232,4 @@ gst_replace_create (GstPushSrc * src, GstBuffer ** buf)
return GST_FLOW_OK;
}
% end
+
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
*/
EOF
-#grep -A 10000 '^% copyright' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
cat <<EOF
@@ -124,9 +123,9 @@ cat <<EOF
#include "config.h"
#endif
+#include <gst/gst.h>
EOF
-grep -A 10000 '^% includes' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
@@ -140,7 +139,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_replace_debug);
EOF
-grep -A 10000 '^% prototypes' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% prototypes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% prototypes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
for each in $pads
@@ -180,6 +178,9 @@ gst_replace_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+ GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "replace", 0,
+ "replace element");
+
EOF
for each in $pads
@@ -197,13 +198,11 @@ static void
gst_replace_class_init (GstReplaceClass * klass)
{
EOF
-grep -A 10000 '^% declare-class' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% declare-class' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% declare-class' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
echo
-grep -A 10000 '^% set-methods' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% set-methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% set-methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
@@ -227,7 +226,6 @@ cat <<EOF
EOF
-grep -A 10000 '^% methods' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
for each in $pads
@@ -275,7 +273,27 @@ EOF
generate_header ()
{
-grep -A 10000 '^% copyright' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+cat <<-EOF
+/* GStreamer
+ * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+EOF
cat <<EOF
#ifndef _GST_REPLACE_H_
@@ -283,7 +301,6 @@ cat <<EOF
EOF
-grep -A 10000 '^% includes' $templatedir/base | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1