element-maker: improve generation of several classes
authorDavid Schleef <ds@schleef.org>
Wed, 15 Dec 2010 03:03:09 +0000 (19:03 -0800)
committerDavid Schleef <ds@schleef.org>
Wed, 15 Dec 2010 03:04:45 +0000 (19:04 -0800)
Better creation of pads, test and fix many other classes.  Most
classes work now, although might not create functional elements.

21 files changed:
tools/Makefile.am
tools/element-maker
tools/gstaudiofilter.c
tools/gstaudiosink.c
tools/gstaudiosrc.c
tools/gstbaseaudiosink.c
tools/gstbaseaudiosrc.c
tools/gstbasertpdepayload.c
tools/gstbasertppayload.c
tools/gstbasesink.c
tools/gstbasesrc.c
tools/gstbasetransform.c
tools/gstcddabasesrc.c
tools/gstelement.c
tools/gstpushsrc.c
tools/gsttagdemux.c
tools/gstvideosink.c
tools/sinkpad-simple.c [new file with mode: 0644]
tools/sinkpad.c [new file with mode: 0644]
tools/srcpad-simple.c [new file with mode: 0644]
tools/srcpad.c [new file with mode: 0644]

index 54cdae1..f501ef3 100644 (file)
@@ -17,4 +17,8 @@ EXTRA_DIST = \
        gstelement.c \
        gstpushsrc.c \
        gsttagdemux.c \
-       gstvideosink.c
+       gstvideosink.c \
+       sinkpad.c \
+       sinkpad-simple.c \
+       srcpad.c \
+       srcpad-simple.c
index 02127a9..60dc35d 100755 (executable)
@@ -73,6 +73,7 @@ source=gst$class.c
 pkg=`grep -A 10000 '^% pkg-config' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
 GST_TYPE_BASE_REPLACE=`grep -A 10000 '^% TYPE_CLASS_NAME' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
 GstBaseReplace=`grep -A 10000 '^% ClassName' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
+pads=`grep -A 10000 '^% pads' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
 
 generate ()
 {
@@ -102,12 +103,12 @@ cat <<-EOF
 /**
  * SECTION:element-$gstreplace
  *
- * The $gstreplace element does FIXME stuff.
+ * The $replace element does FIXME stuff.
  *
  * <refsect2>
  * <title>Example launch line</title>
  * |[
- * gst-launch -v fakesrc ! $gstreplace ! FIXME ! fakesink
+ * gst-launch -v fakesrc ! $replace ! FIXME ! fakesink
  * ]|
  * FIXME Describe what the pipeline does.
  * </refsect2>
@@ -138,6 +139,10 @@ EOF
 grep -A 10000 '^% prototypes' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
 grep -A 10000 '^% prototypes' gobject.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
 grep -A 10000 '^% prototypes' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+for each in $pads
+do
+  grep -A 10000 '^% prototypes' $each.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+done
 
 cat <<EOF
 
@@ -148,19 +153,14 @@ enum
 
 /* pad templates */
 
-static GstStaticPadTemplate gst_replace_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("application/unknown")
-    );
+EOF
 
-static GstStaticPadTemplate gst_replace_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("application/unknown")
-    );
+for each in $pads
+do
+  grep -A 10000 '^% pad-template' $each.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+done
+
+cat <<EOF
 
 /* class initialization */
 
@@ -172,13 +172,17 @@ gst_replace_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_replace_src_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_replace_sink_template));
+EOF
 
-  gst_element_class_set_details_simple (element_class, "FIXME",
-      "Generic", "FIXME", "$REAL_NAME <$EMAIL_ADDRESS>");
+for each in $pads
+do
+  grep -A 10000 '^% base-init' $each.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+done
+
+cat <<EOF
+
+  gst_element_class_set_details_simple (element_class, "FIXME Long name",
+      "Generic", "FIXME Description", "$REAL_NAME <$EMAIL_ADDRESS>");
 }
 
 static void
@@ -202,7 +206,15 @@ cat <<EOF
 static void
 gst_replace_init (GstReplace * replace, GstReplaceClass * replace_class)
 {
+EOF
+
+for each in $pads
+do
+  grep -A 10000 '^% instance-init' $each.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+done
 
+
+cat <<EOF
 }
 EOF
 
@@ -210,6 +222,10 @@ EOF
 grep -A 10000 '^% methods' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
 grep -A 10000 '^% methods' gobject.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
 grep -A 10000 '^% methods' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+for each in $pads
+do
+  grep -A 10000 '^% methods' $each.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+done
 
 
 cat <<EOF
@@ -224,16 +240,24 @@ plugin_init (GstPlugin * plugin)
   return TRUE;
 }
 
+#ifndef VERSION
 #define VERSION "0.0.FIXME"
+#endif
+#ifndef PACKAGE
 #define PACKAGE "FIXME_package"
+#endif
+#ifndef PACKAGE_NAME
 #define PACKAGE_NAME "FIXME_package_name"
-#define PACKAGE_ORIGIN "http://FIXME.org/"
+#endif
+#ifndef GST_PACKAGE_ORIGIN
+#define GST_PACKAGE_ORIGIN "http://FIXME.org/"
+#endif
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
     GST_VERSION_MINOR,
     "replace",
-    "FIXME",
-    plugin_init, VERSION, "LGPL", PACKAGE_NAME, PACKAGE_ORIGIN)
+    "FIXME plugin description",
+    plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
 
 EOF
 
@@ -277,6 +301,14 @@ struct _GstReplace
 {
   GstBaseReplace base_replace;
 
+EOF
+
+for each in $pads
+do
+  grep -A 10000 '^% instance-members' $each.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
+done
+
+cat <<EOF
 };
 
 struct _GstReplaceClass
index 0181281..698e756 100644 (file)
@@ -2,6 +2,8 @@
 GstAudioFilter
 % TYPE_CLASS_NAME
 GST_TYPE_AUDIO_FILTER
+% pads
+sinkpad-simple srcpad-simple
 % pkg-config
 gstreamer-audio-0.10
 % includes
index 9c2a58c..645993a 100644 (file)
@@ -2,57 +2,71 @@
 GstAudioSink
 % TYPE_CLASS_NAME
 GST_TYPE_AUDIO_SINK
+% pads
+sinkpad-simple
 % pkg-config
 gstreamer-audio-0.10
 % includes
 #include <gst/audio/gstaudiosink.h>
 % prototypes
-static gboolean gst_replace_open (GstAudioSrc * src);
+static gboolean gst_replace_open (GstAudioSink * sink);
 static gboolean
-gst_replace_prepare (GstAudioSrc * src, GstRingBufferSpec * spec);
-static gboolean gst_replace_unprepare (GstAudioSrc * src);
-static gboolean gst_replace_close (GstAudioSrc * src);
-static guint gst_replace_read (GstAudioSrc * src, gpointer data, guint length);
-static guint gst_replace_delay (GstAudioSrc * src);
-static void gst_replace_reset (GstAudioSrc * src);
+gst_replace_prepare (GstAudioSink * sink, GstRingBufferSpec * spec);
+static gboolean gst_replace_unprepare (GstAudioSink * sink);
+static gboolean gst_replace_close (GstAudioSink * sink);
+static guint gst_replace_write (GstAudioSink * sink, gpointer data, guint length);
+static guint gst_replace_delay (GstAudioSink * sink);
+static void gst_replace_reset (GstAudioSink * sink);
 % declare-class
-  GstAudioSink *audio_sink_class = GST_AUDIO_SINK (klass);
+  GstAudioSinkClass *audio_sink_class = GST_AUDIO_SINK_CLASS (klass);
 % set-methods
-  audio_sink_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
+  audio_sink_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
+  audio_sink_class->prepare = GST_DEBUG_FUNCPTR (gst_replace_prepare);
+  audio_sink_class->unprepare = GST_DEBUG_FUNCPTR (gst_replace_unprepare);
+  audio_sink_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
+  audio_sink_class->write = GST_DEBUG_FUNCPTR (gst_replace_write);
+  audio_sink_class->delay = GST_DEBUG_FUNCPTR (gst_replace_delay);
+  audio_sink_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
 % methods
 
 static gboolean
-gst_replace_open (GstAudioSrc * src)
+gst_replace_open (GstAudioSink * sink)
 {
+  return FALSE;
 }
 
 static gboolean
-gst_replace_prepare (GstAudioSrc * src, GstRingBufferSpec * spec)
+gst_replace_prepare (GstAudioSink * sink, GstRingBufferSpec * spec)
 {
+  return FALSE;
 }
 
 static gboolean
-gst_replace_unprepare (GstAudioSrc * src)
+gst_replace_unprepare (GstAudioSink * sink)
 {
+  return FALSE;
 }
 
 static gboolean
-gst_replace_close (GstAudioSrc * src)
+gst_replace_close (GstAudioSink * sink)
 {
+  return FALSE;
 }
 
 static guint
-gst_replace_read (GstAudioSrc * src, gpointer data, guint length)
+gst_replace_write (GstAudioSink * sink, gpointer data, guint length)
 {
+  return 0;
 }
 
 static guint
-gst_replace_delay (GstAudioSrc * src)
+gst_replace_delay (GstAudioSink * sink)
 {
+  return 0;
 }
 
 static void
-gst_replace_reset (GstAudioSrc * src)
+gst_replace_reset (GstAudioSink * sink)
 {
 }
 % end
index 95f20e7..051211e 100644 (file)
@@ -2,58 +2,72 @@
 GstAudioSrc
 % TYPE_CLASS_NAME
 GST_TYPE_AUDIO_SRC
+% pads
+srcpad-simple
 % pkg-config
 gstreamer-audio-0.10
 % includes
 #include <gst/audio/gstaudiosrc.h>
 % prototypes
-static gboolean gst_replace_open (GstAudioSink * sink);
+static gboolean gst_replace_open (GstAudioSrc * src);
 static gboolean
-gst_replace_prepare (GstAudioSink * sink, GstRingBufferSpec * spec);
-static gboolean gst_replace_unprepare (GstAudioSink * sink);
-static gboolean gst_replace_close (GstAudioSink * sink);
+gst_replace_prepare (GstAudioSrc * src, GstRingBufferSpec * spec);
+static gboolean gst_replace_unprepare (GstAudioSrc * src);
+static gboolean gst_replace_close (GstAudioSrc * src);
 static guint
-gst_replace_write (GstAudioSink * sink, gpointer data, guint length);
-static guint gst_replace_delay (GstAudioSink * sink);
-static void gst_replace_reset (GstAudioSink * sink);
+gst_replace_read (GstAudioSrc * src, gpointer data, guint length);
+static guint gst_replace_delay (GstAudioSrc * src);
+static void gst_replace_reset (GstAudioSrc * src);
 % declare-class
-  GstAudioSrc *audio_src_class = GST_AUDIO_SRC (klass);
+  GstAudioSrcClass *audio_src_class = GST_AUDIO_SRC_CLASS (klass);
 % set-methods
-  audio_src_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
+  audio_src_class->open = GST_DEBUG_FUNCPTR (gst_replace_open);
+  audio_src_class->prepare = GST_DEBUG_FUNCPTR (gst_replace_prepare);
+  audio_src_class->unprepare = GST_DEBUG_FUNCPTR (gst_replace_unprepare);
+  audio_src_class->close = GST_DEBUG_FUNCPTR (gst_replace_close);
+  audio_src_class->read = GST_DEBUG_FUNCPTR (gst_replace_read);
+  audio_src_class->delay = GST_DEBUG_FUNCPTR (gst_replace_delay);
+  audio_src_class->reset = GST_DEBUG_FUNCPTR (gst_replace_reset);
 % methods
 
 static gboolean
-gst_replace_open (GstAudioSink * sink)
+gst_replace_open (GstAudioSrc * src)
 {
+  return FALSE;
 }
 
 static gboolean
-gst_replace_prepare (GstAudioSink * sink, GstRingBufferSpec * spec)
+gst_replace_prepare (GstAudioSrc * src, GstRingBufferSpec * spec)
 {
+  return FALSE;
 }
 
 static gboolean
-gst_replace_unprepare (GstAudioSink * sink)
+gst_replace_unprepare (GstAudioSrc * src)
 {
+  return FALSE;
 }
 
 static gboolean
-gst_replace_close (GstAudioSink * sink)
+gst_replace_close (GstAudioSrc * src)
 {
+  return FALSE;
 }
 
 static guint
-gst_replace_write (GstAudioSink * sink, gpointer data, guint length)
+gst_replace_read (GstAudioSrc * src, gpointer data, guint length)
 {
+  return 0;
 }
 
 static guint
-gst_replace_delay (GstAudioSink * sink)
+gst_replace_delay (GstAudioSrc * src)
 {
+  return 0;
 }
 
 static void
-gst_replace_reset (GstAudioSink * sink)
+gst_replace_reset (GstAudioSrc * src)
 {
 }
 % end
index 2f36e84..695b685 100644 (file)
@@ -2,6 +2,8 @@
 GstBaseAudioSink
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_AUDIO_SINK
+% pads
+sinkpad-simple
 % pkg-config
 gstreamer-audio-0.10
 % includes
@@ -9,14 +11,14 @@ gstreamer-audio-0.10
 % prototypes
 static GstRingBuffer *gst_replace_create_ringbuffer (GstBaseAudioSink * sink);
 % declare-class
-  GstBaseAudioSink *base_audio_sink_class = GST_BASE_AUDIO_SINK (klass);
+  GstBaseAudioSinkClass *base_audio_sink_class = GST_BASE_AUDIO_SINK_CLASS (klass);
 % set-methods
-  base_audio_sink_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
+  base_audio_sink_class->create_ringbuffer = GST_DEBUG_FUNCPTR (gst_replace_create_ringbuffer);
 % methods
 
 static GstRingBuffer *
 gst_replace_create_ringbuffer (GstBaseAudioSink * sink)
 {
-
+  return NULL;
 }
 % end
index c87bb32..6ef302b 100644 (file)
@@ -2,6 +2,8 @@
 GstBaseAudioSrc
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_AUDIO_SRC
+% pads
+srcpad-simple
 % pkg-config
 gstreamer-audio-0.10
 % includes
@@ -9,14 +11,15 @@ gstreamer-audio-0.10
 % prototypes
 static GstRingBuffer *gst_replace_create_ringbuffer (GstBaseAudioSrc * src);
 % declare-class
-  GstBaseAudioSrc *base_audio_src_class = GST_BASE_AUDIO_SRC (klass);
+  GstBaseAudioSrcClass *base_audio_src_class = GST_BASE_AUDIO_SRC_CLASS (klass);
 % set-methods
-  base_audio_src_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
+  base_audio_src_class->create_ringbuffer = GST_DEBUG_FUNCPTR (gst_replace_create_ringbuffer);
 % methods
 
 static GstRingBuffer *
 gst_replace_create_ringbuffer (GstBaseAudioSrc * src)
 {
 
+  return NULL;
 }
 % end
index b0810be..8257a32 100644 (file)
@@ -2,6 +2,8 @@
 GstBaseRTPDepayload
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_RTP_DEPAYLOAD
+% pads
+sinkpad-simple srcpad-simple
 % pkg-config
 gstreamer-rtp-0.10
 % includes
index a871e90..65d216f 100644 (file)
@@ -2,6 +2,8 @@
 GstBaseRTPPayload
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_RTP_PAYLOAD
+% pads
+sinkpad-simple srcpad-simple
 % pkg-config
 gstreamer-rtp-0.10
 % includes
index 6646dd9..26ad3f9 100644 (file)
@@ -2,6 +2,8 @@
 GstBaseSink
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_SINK
+% pads
+sinkpad-simple
 % pkg-config
 gstreamer-base-0.10
 % includes
index 240a16d..048e274 100644 (file)
@@ -2,6 +2,8 @@
 GstBaseSrc
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_SRC
+% pads
+srcpad-simple
 % pkg-config
 gstreamer-base-0.10
 % includes
index 47d42d3..7dcbc85 100644 (file)
@@ -2,8 +2,12 @@
 GstBaseTransform
 % TYPE_CLASS_NAME
 GST_TYPE_BASE_TRANSFORM
+% pads
+sinkpad-simple srcpad-simple
 % pkg-config
 gstreamer-base-0.10
+% pads
+sinkpad-simple srcpad-simple
 % includes
 #include <gst/base/gstbasetransform.h>
 % prototypes
index d0e0a80..201a843 100644 (file)
@@ -2,6 +2,8 @@
 GstCddaBaseSrc
 % TYPE_CLASS_NAME
 GST_TYPE_CDDA_BASE_SRC
+% pads
+srcpad-simple
 % pkg-config
 gstreamer-cdda-0.10
 % includes
index 293341c..c9e05c6 100644 (file)
@@ -2,6 +2,8 @@
 GstElement
 % TYPE_CLASS_NAME
 GST_TYPE_ELEMENT
+% pads
+sinkpad srcpad
 % pkg-config
 gstreamer-0.10
 % includes
@@ -11,35 +13,24 @@ static GstPad *gst_replace_request_new_pad (GstElement * element,
     GstPadTemplate * templ, const gchar * name);
 static void gst_replace_release_pad (GstElement * element, GstPad * pad);
 static GstStateChangeReturn
-gst_replace_get_state (GstElement * element, GstState * state,
-    GstState * pending, GstClockTime timeout);
-static GstStateChangeReturn
-gst_replace_set_state (GstElement * element, GstState state);
-static GstStateChangeReturn
 gst_replace_change_state (GstElement * element, GstStateChange transition);
-static void gst_replace_set_bus (GstElement * element, GstBus * bus);
 static GstClock *gst_replace_provide_clock (GstElement * element);
 static gboolean gst_replace_set_clock (GstElement * element, GstClock * clock);
 static GstIndex *gst_replace_get_index (GstElement * element);
 static void gst_replace_set_index (GstElement * element, GstIndex * index);
 static gboolean gst_replace_send_event (GstElement * element, GstEvent * event);
-static const GstQueryType *gst_replace_get_query_types (GstElement * element);
 static gboolean gst_replace_query (GstElement * element, GstQuery * query);
 % declare-class
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 % set-methods
   element_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_replace_request_new_pad);
   element_class->release_pad = GST_DEBUG_FUNCPTR (gst_replace_release_pad);
-  element_class->get_state = GST_DEBUG_FUNCPTR (gst_replace_get_state);
-  element_class->set_state = GST_DEBUG_FUNCPTR (gst_replace_set_state);
   element_class->change_state = GST_DEBUG_FUNCPTR (gst_replace_change_state);
-  element_class->set_bus = GST_DEBUG_FUNCPTR (gst_replace_set_bus);
   element_class->provide_clock = GST_DEBUG_FUNCPTR (gst_replace_provide_clock);
   element_class->set_clock = GST_DEBUG_FUNCPTR (gst_replace_set_clock);
   element_class->get_index = GST_DEBUG_FUNCPTR (gst_replace_get_index);
   element_class->set_index = GST_DEBUG_FUNCPTR (gst_replace_set_index);
   element_class->send_event = GST_DEBUG_FUNCPTR (gst_replace_send_event);
-  element_class->get_query_types = GST_DEBUG_FUNCPTR (gst_replace_get_query_types);
   element_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
 % methods
 
@@ -59,31 +50,39 @@ gst_replace_release_pad (GstElement * element, GstPad * pad)
 }
 
 static GstStateChangeReturn
-gst_replace_get_state (GstElement * element, GstState * state,
-    GstState * pending, GstClockTime timeout)
-{
-
-  return GST_STATE_CHANGE_SUCCESS;
-}
-
-static GstStateChangeReturn
-gst_replace_set_state (GstElement * element, GstState state)
-{
-
-  return GST_STATE_CHANGE_SUCCESS;
-}
-
-static GstStateChangeReturn
 gst_replace_change_state (GstElement * element, GstStateChange transition)
 {
-
-  return GST_STATE_CHANGE_SUCCESS;
-}
-
-static void
-gst_replace_set_bus (GstElement * element, GstBus * bus)
-{
-
+  GstReplace *replace;
+  GstStateChangeReturn ret;
+
+  g_return_val_if_fail (GST_IS_REPLACE (element), GST_STATE_CHANGE_FAILURE);
+  replace = GST_REPLACE (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      break;
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      break;
+    default:
+      break;
+  }
+
+  return ret;
 }
 
 static GstClock *
@@ -120,13 +119,6 @@ gst_replace_send_event (GstElement * element, GstEvent * event)
   return TRUE;
 }
 
-static const GstQueryType *
-gst_replace_get_query_types (GstElement * element)
-{
-
-  return NULL;
-}
-
 static gboolean
 gst_replace_query (GstElement * element, GstQuery * query)
 {
index 5db8e76..a355950 100644 (file)
@@ -2,6 +2,8 @@
 GstPushSrc
 % TYPE_CLASS_NAME
 GST_TYPE_PUSH_SRC
+% pads
+srcpad-simple
 % pkg-config
 gstreamer-base-0.10
 % includes
@@ -9,14 +11,15 @@ gstreamer-base-0.10
 % prototypes
 static GstFlowReturn gst_replace_create (GstPushSrc * src, GstBuffer ** buf);
 % declare-class
-  GstPushSrc *pushsrc_class = GST_PUSHSRC (klass);
+  GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
 % set-methods
-  pushsrc_class-> = GST_DEBUG_FUNCPTR (gst_replace_);
+  pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_replace_create);
 % methods
 
 static GstFlowReturn
 gst_replace_create (GstPushSrc * src, GstBuffer ** buf)
 {
 
+  return GST_FLOW_OK;
 }
 % end
index 7ddec9d..6cdfb58 100644 (file)
@@ -2,6 +2,8 @@
 GstTagDemux
 % TYPE_CLASS_NAME
 GST_TYPE_TAG_DEMUX
+% pads
+sinkpad-simple srcpad-simple
 % pkg-config
 gstreamer-tag-0.10
 % includes
index ce12a07..72a9e88 100644 (file)
@@ -2,6 +2,8 @@
 GstVideoSink
 % TYPE_CLASS_NAME
 GST_TYPE_VIDEO_SINK
+% pads
+sinkpad-simple
 % pkg-config
 gstreamer-video-0.10
 % includes
diff --git a/tools/sinkpad-simple.c b/tools/sinkpad-simple.c
new file mode 100644 (file)
index 0000000..9a031fc
--- /dev/null
@@ -0,0 +1,23 @@
+
+% instance-members
+  GstPad *sinkpad;
+% prototypes
+% pad-template
+static GstStaticPadTemplate gst_replace_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/unknown")
+    );
+
+% base-init
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_replace_sink_template));
+% instance-init
+
+  replace->sinkpad = gst_pad_new_from_static_template (&gst_replace_sink_template
+      ,     
+            "sink");
+% methods
+% end
+
diff --git a/tools/sinkpad.c b/tools/sinkpad.c
new file mode 100644 (file)
index 0000000..87babbc
--- /dev/null
@@ -0,0 +1,311 @@
+
+% instance-members
+  GstPad *sinkpad;
+% prototypes
+
+static GstCaps* gst_replace_sink_getcaps (GstPad *pad);
+static gboolean gst_replace_sink_setcaps (GstPad *pad, GstCaps *caps);
+static gboolean gst_replace_sink_acceptcaps (GstPad *pad, GstCaps *caps);
+static void gst_replace_sink_fixatecaps (GstPad *pad, GstCaps *caps);
+static gboolean gst_replace_sink_activate (GstPad *pad);
+static gboolean gst_replace_sink_activatepush (GstPad *pad, gboolean active);
+static gboolean gst_replace_sink_activatepull (GstPad *pad, gboolean active);
+static GstPadLinkReturn gst_replace_sink_link (GstPad *pad, GstPad *peer);
+static void gst_replace_sink_unlink (GstPad *pad);
+static GstFlowReturn gst_replace_sink_chain (GstPad *pad, GstBuffer *buffer);
+static GstFlowReturn gst_replace_sink_chainlist (GstPad *pad, GstBufferList *bufferlist);
+static gboolean gst_replace_sink_event (GstPad *pad, GstEvent *event);
+static gboolean gst_replace_sink_query (GstPad *pad, GstQuery *query);
+static GstFlowReturn gst_replace_sink_bufferalloc (GstPad *pad, guint64 offset, guint size,
+    GstCaps *caps, GstBuffer **buf);
+static GstIterator * gst_replace_sink_iterintlink (GstPad *pad);
+
+% pad-template
+static GstStaticPadTemplate gst_replace_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/unknown")
+    );
+
+% base-init
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_replace_sink_template));
+% instance-init
+
+  replace->sinkpad = gst_pad_new_from_static_template (&gst_replace_sink_template
+      ,     
+            "sink");
+  gst_pad_set_getcaps_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_getcaps));
+  gst_pad_set_setcaps_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_setcaps));
+  gst_pad_set_acceptcaps_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_acceptcaps));
+  gst_pad_set_fixatecaps_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_fixatecaps));
+  gst_pad_set_activate_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_activate));
+  gst_pad_set_activatepush_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_activatepush));
+  gst_pad_set_activatepull_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_activatepull));
+  gst_pad_set_link_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_link));
+  gst_pad_set_unlink_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_unlink));
+  gst_pad_set_chain_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_chain));
+  gst_pad_set_chain_list_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_chainlist));
+  gst_pad_set_event_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_event));
+  gst_pad_set_query_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_query));
+  gst_pad_set_bufferalloc_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_bufferalloc));
+  gst_pad_set_iterate_internal_links_function (replace->sinkpad,
+            GST_DEBUG_FUNCPTR(gst_replace_sink_iterintlink));
+  gst_element_add_pad (GST_ELEMENT(replace), replace->sinkpad);
+
+
+% methods
+
+static GstCaps*
+gst_replace_sink_getcaps (GstPad *pad)
+{
+  GstReplace *replace;
+  GstCaps *caps;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "getcaps");
+
+  caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+
+  gst_object_unref (replace);
+  return caps;
+}
+
+static gboolean
+gst_replace_sink_setcaps (GstPad *pad, GstCaps *caps)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "setcaps");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static gboolean
+gst_replace_sink_acceptcaps (GstPad *pad, GstCaps *caps)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "acceptcaps");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static void
+gst_replace_sink_fixatecaps (GstPad *pad, GstCaps *caps)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "fixatecaps");
+
+
+  gst_object_unref (replace);
+}
+
+static gboolean
+gst_replace_sink_activate (GstPad *pad)
+{
+  GstReplace *replace;
+  gboolean ret;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "activate");
+
+  if (gst_pad_check_pull_range (pad)) {
+    GST_DEBUG_OBJECT (pad, "activating pull");
+    ret = gst_pad_activate_pull (pad, TRUE);
+  } else {
+    GST_DEBUG_OBJECT (pad, "activating push");
+    ret = gst_pad_activate_push (pad, TRUE);
+  }
+
+  gst_object_unref (replace);
+  return ret;
+}
+
+static gboolean
+gst_replace_sink_activatepush (GstPad *pad, gboolean active)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "activatepush");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static gboolean
+gst_replace_sink_activatepull (GstPad *pad, gboolean active)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "activatepull");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static GstPadLinkReturn
+gst_replace_sink_link (GstPad *pad, GstPad *peer)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "link");
+
+
+  gst_object_unref (replace);
+  return GST_PAD_LINK_OK;
+}
+
+static void
+gst_replace_sink_unlink (GstPad *pad)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "unlink");
+
+
+  gst_object_unref (replace);
+}
+
+static GstFlowReturn
+gst_replace_sink_chain (GstPad *pad, GstBuffer *buffer)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "chain");
+
+
+  gst_object_unref (replace);
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_replace_sink_chainlist (GstPad *pad, GstBufferList *bufferlist)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "chainlist");
+
+
+  gst_object_unref (replace);
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_replace_sink_event (GstPad *pad, GstEvent *event)
+{
+  gboolean res;
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "event");
+
+  switch (GST_EVENT_TYPE (event)) {
+    default:
+      res = gst_pad_event_default (pad, event);
+      break;
+  }
+
+  gst_object_unref (replace);
+  return res;
+}
+
+static gboolean
+gst_replace_sink_query (GstPad *pad, GstQuery *query)
+{
+  gboolean res;
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "query");
+
+  switch (GST_QUERY_TYPE(query)) {
+    default:
+      res = gst_pad_query_default (pad, query);
+      break;
+  }
+
+  gst_object_unref (replace);
+  return res;
+}
+
+static GstFlowReturn
+gst_replace_sink_bufferalloc (GstPad *pad, guint64 offset, guint size,
+    GstCaps *caps, GstBuffer **buf)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "bufferalloc");
+
+
+  *buf = gst_buffer_new_and_alloc (size);
+  gst_buffer_set_caps (*buf, caps);
+
+  gst_object_unref (replace);
+  return GST_FLOW_OK;
+}
+
+static GstIterator *
+gst_replace_sink_iterintlink (GstPad *pad)
+{
+  GstReplace *replace;
+  GstIterator *iter;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "iterintlink");
+
+  iter = gst_pad_iterate_internal_links_default (pad);
+
+  gst_object_unref (replace);
+  return iter;
+}
+
+% end
+
diff --git a/tools/srcpad-simple.c b/tools/srcpad-simple.c
new file mode 100644 (file)
index 0000000..42db8d3
--- /dev/null
@@ -0,0 +1,23 @@
+
+% instance-members
+  GstPad *srcpad;
+% prototypes
+% pad-template
+static GstStaticPadTemplate gst_replace_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/unknown")
+    );
+
+% base-init
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_replace_src_template));
+% instance-init
+
+  replace->srcpad = gst_pad_new_from_static_template (&gst_replace_src_template
+      ,     
+            "src");
+% methods
+% end
+
diff --git a/tools/srcpad.c b/tools/srcpad.c
new file mode 100644 (file)
index 0000000..61cbd21
--- /dev/null
@@ -0,0 +1,274 @@
+
+% instance-members
+  GstPad *srcpad;
+% prototypes
+
+static GstCaps* gst_replace_src_getcaps (GstPad *pad);
+static gboolean gst_replace_src_setcaps (GstPad *pad, GstCaps *caps);
+static gboolean gst_replace_src_acceptcaps (GstPad *pad, GstCaps *caps);
+static void gst_replace_src_fixatecaps (GstPad *pad, GstCaps *caps);
+static gboolean gst_replace_src_activate (GstPad *pad);
+static gboolean gst_replace_src_activatepush (GstPad *pad, gboolean active);
+static gboolean gst_replace_src_activatepull (GstPad *pad, gboolean active);
+static GstPadLinkReturn gst_replace_src_link (GstPad *pad, GstPad *peer);
+static void gst_replace_src_unlink (GstPad *pad);
+static GstFlowReturn gst_replace_src_getrange (GstPad *pad, guint64 offset, guint length,
+    GstBuffer **buffer);
+static gboolean gst_replace_src_event (GstPad *pad, GstEvent *event);
+static gboolean gst_replace_src_query (GstPad *pad, GstQuery *query);
+static GstIterator * gst_replace_src_iterintlink (GstPad *pad);
+
+% pad-template
+static GstStaticPadTemplate gst_replace_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/unknown")
+    );
+
+% base-init
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_replace_src_template));
+% instance-init
+
+  replace->srcpad = gst_pad_new_from_static_template (&gst_replace_src_template
+      ,     
+            "src");
+  gst_pad_set_getcaps_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_getcaps));
+  gst_pad_set_setcaps_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_setcaps));
+  gst_pad_set_acceptcaps_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_acceptcaps));
+  gst_pad_set_fixatecaps_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_fixatecaps));
+  gst_pad_set_activate_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_activate));
+  gst_pad_set_activatepush_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_activatepush));
+  gst_pad_set_activatepull_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_activatepull));
+  gst_pad_set_link_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_link));
+  gst_pad_set_unlink_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_unlink));
+  gst_pad_set_getrange_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_getrange));
+  gst_pad_set_event_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_event));
+  gst_pad_set_query_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_query));
+  gst_pad_set_iterate_internal_links_function (replace->srcpad,
+            GST_DEBUG_FUNCPTR(gst_replace_src_iterintlink));
+  gst_element_add_pad (GST_ELEMENT(replace), replace->srcpad);
+
+
+% methods
+
+static GstCaps*
+gst_replace_src_getcaps (GstPad *pad)
+{
+  GstReplace *replace;
+  GstCaps *caps;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "getcaps");
+
+  caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+
+  gst_object_unref (replace);
+  return caps;
+}
+
+static gboolean
+gst_replace_src_setcaps (GstPad *pad, GstCaps *caps)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "setcaps");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static gboolean
+gst_replace_src_acceptcaps (GstPad *pad, GstCaps *caps)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "acceptcaps");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static void
+gst_replace_src_fixatecaps (GstPad *pad, GstCaps *caps)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "fixatecaps");
+
+
+  gst_object_unref (replace);
+}
+
+static gboolean
+gst_replace_src_activate (GstPad *pad)
+{
+  GstReplace *replace;
+  gboolean ret;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "activate");
+
+  if (gst_pad_check_pull_range (pad)) {
+    GST_DEBUG_OBJECT (pad, "activating pull");
+    ret = gst_pad_activate_pull (pad, TRUE);
+  } else {
+    GST_DEBUG_OBJECT (pad, "activating push");
+    ret = gst_pad_activate_push (pad, TRUE);
+  }
+
+  gst_object_unref (replace);
+  return ret;
+}
+
+static gboolean
+gst_replace_src_activatepush (GstPad *pad, gboolean active)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "activatepush");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static gboolean
+gst_replace_src_activatepull (GstPad *pad, gboolean active)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "activatepull");
+
+
+  gst_object_unref (replace);
+  return TRUE;
+}
+
+static GstPadLinkReturn
+gst_replace_src_link (GstPad *pad, GstPad *peer)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "link");
+
+
+  gst_object_unref (replace);
+  return GST_PAD_LINK_OK;
+}
+
+static void
+gst_replace_src_unlink (GstPad *pad)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "unlink");
+
+
+  gst_object_unref (replace);
+}
+
+static GstFlowReturn
+gst_replace_src_getrange (GstPad *pad, guint64 offset, guint length,
+    GstBuffer **buffer)
+{
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "getrange");
+
+
+  gst_object_unref (replace);
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_replace_src_event (GstPad *pad, GstEvent *event)
+{
+  gboolean res;
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "event");
+
+  switch (GST_EVENT_TYPE (event)) {
+    default:
+      res = gst_pad_event_default (pad, event);
+      break;
+  }
+
+  gst_object_unref (replace);
+  return res;
+}
+
+static gboolean
+gst_replace_src_query (GstPad *pad, GstQuery *query)
+{
+  gboolean res;
+  GstReplace *replace;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "query");
+
+  switch (GST_QUERY_TYPE(query)) {
+    default:
+      res = gst_pad_query_default (pad, query);
+      break;
+  }
+
+  gst_object_unref (replace);
+  return res;
+}
+
+static GstIterator *
+gst_replace_src_iterintlink (GstPad *pad)
+{
+  GstReplace *replace;
+  GstIterator *iter;
+
+  replace = GST_REPLACE (gst_pad_get_parent (pad));
+
+  GST_DEBUG_OBJECT(replace, "iterintlink");
+
+  iter = gst_pad_iterate_internal_links_default (pad);
+
+  gst_object_unref (replace);
+  return iter;
+}
+
+% end
+