From 6720c5beb8038b47f9125576238b54b870314a4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 14 May 2008 10:58:52 +0000 Subject: [PATCH] gst/adder/gstadder.c: Correctly declare the supported endianness on the pad templates and check for correct endiannes... Original commit message from CVS: * gst/adder/gstadder.c: (gst_adder_setcaps), (gst_adder_class_init): Correctly declare the supported endianness on the pad templates and check for correct endianness in the set caps function. Adder only supports native endianness. Also use gst_element_class_set_details_simple(). --- ChangeLog | 9 +++++++++ gst/adder/gstadder.c | 36 +++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 057c840..ea71240 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-05-14 Sebastian Dröge + + * gst/adder/gstadder.c: (gst_adder_setcaps), + (gst_adder_class_init): + Correctly declare the supported endianness on the pad templates + and check for correct endianness in the set caps function. Adder + only supports native endianness. + Also use gst_element_class_set_details_simple(). + 2008-05-14 Stefan Kost * sys/xvimage/xvimagesink.c: diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index f7ee290..d9c5b22 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -71,25 +71,33 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); /* elementfactory information */ -static const GstElementDetails adder_details = GST_ELEMENT_DETAILS ("Adder", - "Generic/Audio", - "Add N audio channels together", - "Thomas "); + +#define CAPS \ + "audio/x-raw-int, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, MAX ], " \ + "endianness = (int) BYTE_ORDER, " \ + "width = (int) { 8, 16, 24, 32 }, " \ + "depth = (int) [ 1, 32 ], " \ + "signed = (boolean) { true, false } ;" \ + "audio/x-raw-float, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, MAX ], " \ + "endianness = (int) BYTE_ORDER, " \ + "width = (int) { 32, 64 }" static GstStaticPadTemplate gst_adder_src_template = - GST_STATIC_PAD_TEMPLATE ("src", +GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) + GST_STATIC_CAPS (CAPS) ); static GstStaticPadTemplate gst_adder_sink_template = - GST_STATIC_PAD_TEMPLATE ("sink%d", +GST_STATIC_PAD_TEMPLATE ("sink%d", GST_PAD_SINK, GST_PAD_REQUEST, - GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) + GST_STATIC_CAPS (CAPS) ); static void gst_adder_class_init (GstAdderClass * klass); @@ -257,6 +265,10 @@ gst_adder_setcaps (GstPad * pad, GstCaps * caps) GST_DEBUG_OBJECT (adder, "parse_caps sets adder to format float"); adder->format = GST_ADDER_FORMAT_FLOAT; gst_structure_get_int (structure, "width", &adder->width); + gst_structure_get_int (structure, "endianness", &adder->endianness); + + if (adder->endianness != G_BYTE_ORDER) + goto not_supported; switch (adder->width) { case 32: @@ -567,7 +579,9 @@ gst_adder_class_init (GstAdderClass * klass) gst_static_pad_template_get (&gst_adder_src_template)); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_adder_sink_template)); - gst_element_class_set_details (gstelement_class, &adder_details); + gst_element_class_set_details_simple (gstelement_class, "Adder", + "Generic/Audio", + "Add N audio channels together", "Thomas "); parent_class = g_type_class_peek_parent (klass); -- 2.7.4