summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2013-02-06 12:35:36 -0800
committerDavid Schleef <ds@schleef.org>2013-02-06 12:43:45 -0800
commitf790fcbfa68e103406381a2f2eb1c2445055d08d (patch)
tree039a162c43f031f4d226bdd9c564d4670c1078c3 /tools
parent250555a7dec8f1a396a20994d28395249eb406d7 (diff)
downloadgstreamer-plugins-bad-f790fcbfa68e103406381a2f2eb1c2445055d08d.tar.gz
element-maker: Update somewhat for 1.0
Only converted basetransform for the moment. It's probably easier to write templates from scratch from the documentation.
Diffstat (limited to 'tools')
-rw-r--r--tools/element-templates/basetransform170
-rw-r--r--tools/element-templates/gobject4
-rw-r--r--tools/element-templates/sinkpad-simple2
-rw-r--r--tools/element-templates/srcpad-simple2
-rwxr-xr-xtools/gst-element-maker40
5 files changed, 143 insertions, 75 deletions
diff --git a/tools/element-templates/basetransform b/tools/element-templates/basetransform
index e5fd24cf3..51633e56a 100644
--- a/tools/element-templates/basetransform
+++ b/tools/element-templates/basetransform
@@ -6,95 +6,152 @@ GST_TYPE_BASE_TRANSFORM
% pads
sinkpad-simple srcpad-simple
% pkg-config
-gstreamer-base-0.10
+gstreamer-base-1.0
% pads
sinkpad-simple srcpad-simple
% includes
#include <gst/base/gstbasetransform.h>
% prototypes
-static GstCaps *gst_replace_transform_caps (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * caps);
-static void
+static GstCaps *gst_replace_transform_caps (GstBaseTransform *trans,
+ GstPadDirection direction, GstCaps *caps, GstCaps *filter);
+static GstCaps *
gst_replace_fixate_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-static gboolean
-gst_replace_transform_size (GstBaseTransform * trans,
+static gboolean gst_replace_accept_caps (GstBaseTransform *trans,
+ GstPadDirection direction, GstCaps *caps);
+static gboolean gst_replace_set_caps (GstBaseTransform *trans, GstCaps *incaps,
+ GstCaps *outcaps);
+static gboolean gst_replace_query (GstBaseTransform *trans, GstPadDirection direction,
+ GstQuery *query);
+static gboolean gst_replace_decide_allocation (GstBaseTransform *trans,
+ GstQuery *query);
+static gboolean gst_replace_filter_meta (GstBaseTransform *trans, GstQuery *query,
+ GType api, const GstStructure *params);
+static gboolean gst_replace_propose_allocation (GstBaseTransform *trans,
+ GstQuery *decide_query, GstQuery *query);
+static gboolean gst_replace_transform_size (GstBaseTransform * trans,
GstPadDirection direction,
- GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize);
-static gboolean
-gst_replace_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- guint * size);
-static gboolean
-gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
- GstCaps * outcaps);
+ GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize);
+static gboolean gst_replace_get_unit_size (GstBaseTransform * trans,
+ GstCaps * caps, gsize * size);
static gboolean gst_replace_start (GstBaseTransform * trans);
static gboolean gst_replace_stop (GstBaseTransform * trans);
-static gboolean gst_replace_event (GstBaseTransform * trans, GstEvent * event);
+static gboolean gst_replace_sink_event (GstBaseTransform * trans,
+ GstEvent * event);
+static gboolean gst_replace_src_event (GstBaseTransform * trans,
+ GstEvent * event);
+static GstFlowReturn gst_replace_prepare_output_buffer (
+ GstBaseTransform * trans, GstBuffer *input, GstBuffer **outbuf);
+static gboolean gst_replace_copy_metadata (GstBaseTransform *trans,
+ GstBuffer *input, GstBuffer *outbuf);
+static gboolean gst_replace_transform_meta (GstBaseTransform *trans,
+ GstBuffer *outbuf, GstMeta *meta, GstBuffer *inbuf);
+static void
+gst_replace_before_transform (GstBaseTransform * trans, GstBuffer * buffer);
static GstFlowReturn
gst_replace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
GstBuffer * outbuf);
static GstFlowReturn
gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
-static GstFlowReturn
-gst_replace_prepare_output_buffer (GstBaseTransform * trans,
- GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
-static gboolean
-gst_replace_src_event (GstBaseTransform * trans, GstEvent * event);
-static void
-gst_replace_before_transform (GstBaseTransform * trans, GstBuffer * buffer);
% declare-class
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
% set-methods
base_transform_class->transform_caps = GST_DEBUG_FUNCPTR (gst_replace_transform_caps);
base_transform_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_replace_fixate_caps);
+ base_transform_class->accept_caps = GST_DEBUG_FUNCPTR (gst_replace_accept_caps);
+ base_transform_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
+ base_transform_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
+ base_transform_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
+ base_transform_class->filter_meta = GST_DEBUG_FUNCPTR (gst_replace_filter_meta);
+ base_transform_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
base_transform_class->transform_size = GST_DEBUG_FUNCPTR (gst_replace_transform_size);
base_transform_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_replace_get_unit_size);
- base_transform_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
- base_transform_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
- base_transform_class->transform = GST_DEBUG_FUNCPTR (gst_replace_transform);
- base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
- base_transform_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (gst_replace_prepare_output_buffer);
+ base_transform_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
base_transform_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
+ base_transform_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (gst_replace_prepare_output_buffer);
+ base_transform_class->copy_metadata = GST_DEBUG_FUNCPTR (gst_replace_copy_metadata);
+ base_transform_class->transform_meta = GST_DEBUG_FUNCPTR (gst_replace_transform_meta);
base_transform_class->before_transform = GST_DEBUG_FUNCPTR (gst_replace_before_transform);
+ base_transform_class->transform = GST_DEBUG_FUNCPTR (gst_replace_transform);
+ base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
% methods
static GstCaps *
-gst_replace_transform_caps (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * caps)
+gst_replace_transform_caps (GstBaseTransform *trans,
+ GstPadDirection direction, GstCaps *caps, GstCaps *filter)
{
return NULL;
}
-static void
+static GstCaps *
gst_replace_fixate_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
{
+ return NULL;
}
static gboolean
-gst_replace_transform_size (GstBaseTransform * trans,
- GstPadDirection direction,
- GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize)
+gst_replace_accept_caps (GstBaseTransform *trans,
+ GstPadDirection direction, GstCaps *caps)
+{
+ return TRUE;
+}
+
+static gboolean
+gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
+ GstCaps * outcaps)
{
return FALSE;
}
static gboolean
-gst_replace_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- guint * size)
+gst_replace_query (GstBaseTransform *trans, GstPadDirection direction,
+ GstQuery *query)
+{
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_decide_allocation (GstBaseTransform *trans, GstQuery *query)
+{
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_filter_meta (GstBaseTransform *trans, GstQuery *query,
+ GType api, const GstStructure *params)
+{
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_propose_allocation (GstBaseTransform *trans,
+ GstQuery *decide_query, GstQuery *query)
+{
+
+ return TRUE;
+}
+
+static gboolean
+gst_replace_transform_size (GstBaseTransform * trans,
+ GstPadDirection direction,
+ GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize)
{
return FALSE;
}
static gboolean
-gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
- GstCaps * outcaps)
+gst_replace_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
+ gsize * size)
{
return FALSE;
@@ -115,40 +172,41 @@ gst_replace_stop (GstBaseTransform * trans)
}
static gboolean
-gst_replace_event (GstBaseTransform * trans, GstEvent * event)
+gst_replace_sink_event (GstBaseTransform * trans, GstEvent * event)
{
return FALSE;
}
-static GstFlowReturn
-gst_replace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
- GstBuffer * outbuf)
+static gboolean
+gst_replace_src_event (GstBaseTransform * trans, GstEvent * event)
{
- return GST_FLOW_ERROR;
+ return FALSE;
}
static GstFlowReturn
-gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
+gst_replace_prepare_output_buffer (GstBaseTransform * trans,
+ GstBuffer * input, GstBuffer ** buf)
{
return GST_FLOW_ERROR;
}
-static GstFlowReturn
-gst_replace_prepare_output_buffer (GstBaseTransform * trans,
- GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf)
+static gboolean
+gst_replace_copy_metadata (GstBaseTransform *trans,
+ GstBuffer *input, GstBuffer *outbuf)
{
- return GST_FLOW_ERROR;
+ return TRUE;
}
static gboolean
-gst_replace_src_event (GstBaseTransform * trans, GstEvent * event)
+gst_replace_transform_meta (GstBaseTransform *trans,
+ GstBuffer *outbuf, GstMeta *meta, GstBuffer *inbuf)
{
- return FALSE;
+ return TRUE;
}
static void
@@ -156,4 +214,20 @@ gst_replace_before_transform (GstBaseTransform * trans, GstBuffer * buffer)
{
}
+
+static GstFlowReturn
+gst_replace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
+ GstBuffer * outbuf)
+{
+
+ return GST_FLOW_ERROR;
+}
+
+static GstFlowReturn
+gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
+{
+
+ return GST_FLOW_ERROR;
+}
+
% end
diff --git a/tools/element-templates/gobject b/tools/element-templates/gobject
index 85d7d3714..1522aa47b 100644
--- a/tools/element-templates/gobject
+++ b/tools/element-templates/gobject
@@ -55,7 +55,7 @@ gst_replace_dispose (GObject * object)
/* clean up as possible. may be called multiple times */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (gst_replace_parent_class)->dispose (object);
}
void
@@ -65,7 +65,7 @@ gst_replace_finalize (GObject * object)
/* clean up object here */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gst_replace_parent_class)->finalize (object);
}
% end
diff --git a/tools/element-templates/sinkpad-simple b/tools/element-templates/sinkpad-simple
index e8538b6ec..e6cd684be 100644
--- a/tools/element-templates/sinkpad-simple
+++ b/tools/element-templates/sinkpad-simple
@@ -12,7 +12,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
);
% base-init
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (GST_ELEMENT_CLASS(klass),
gst_static_pad_template_get (&gst_replace_sink_template));
% instance-init
diff --git a/tools/element-templates/srcpad-simple b/tools/element-templates/srcpad-simple
index 0fca9157e..732dc5da2 100644
--- a/tools/element-templates/srcpad-simple
+++ b/tools/element-templates/srcpad-simple
@@ -12,7 +12,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
% base-init
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (GST_ELEMENT_CLASS(klass),
gst_static_pad_template_get (&gst_replace_src_template));
% instance-init
diff --git a/tools/gst-element-maker b/tools/gst-element-maker
index 172cef161..4a09c9fc8 100755
--- a/tools/gst-element-maker
+++ b/tools/gst-element-maker
@@ -168,39 +168,33 @@ cat <<EOF
/* class initialization */
-#define DEBUG_INIT(bla) \\
- GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "replace", 0, \\
- "debug category for replace element");
-
-GST_BOILERPLATE_FULL (GstReplace, gst_replace, GstBaseReplace,
- GST_TYPE_BASE_REPLACE, DEBUG_INIT);
+G_DEFINE_TYPE_WITH_CODE (GstReplace, gst_replace, GST_TYPE_BASE_REPLACE,
+ GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "replace", 0,
+ "debug category for replace element"));
static void
-gst_replace_base_init (gpointer g_class)
+gst_replace_class_init (GstReplaceClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
EOF
+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
+
+cat <<EOF
+ /* Setting up pads and setting metadata should be moved to
+ base_class_init if you intend to subclass this class. */
+EOF
for each in $pads
do
grep -A 10000 '^% base-init' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
done
-
cat <<EOF
- gst_element_class_set_static_metadata (element_class, "FIXME Long name",
- "Generic", "FIXME Description", "$REAL_NAME <$EMAIL_ADDRESS>");
-}
+ gst_element_class_set_static_metadata (GST_ELEMENT_CLASS(klass),
+ "FIXME Long name", "Generic", "FIXME Description",
+ "$REAL_NAME <$EMAIL_ADDRESS>");
-static void
-gst_replace_class_init (GstReplaceClass * klass)
-{
EOF
-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/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
@@ -210,7 +204,7 @@ cat <<EOF
}
static void
-gst_replace_init (GstReplace * replace, GstReplaceClass * replace_class)
+gst_replace_init (GstReplace *replace)
{
EOF
@@ -377,12 +371,12 @@ gst-indent $gstreplace.c
echo pkg is $pkg
-gcc -Wall -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o $gstreplace.o $gstreplace.c
+gcc -Wall -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-1.0 $pkg) -c -o $gstreplace.o $gstreplace.c
if test $? -ne 0; then
exit 1
fi
-gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-0.10 $pkg)
+gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-1.0 $pkg)
if test $? -ne 0; then
exit 1
fi