From a0de263f13dd71fdfb05415bba27e6b1a11aa0bc Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 12 May 2004 02:35:56 +0000 Subject: [PATCH] configure.ac: enable shout2 by default Original commit message from CVS: * configure.ac: enable shout2 by default * ext/shout2/gstshout2.c: (gst_shout2send_protocol_get_type), (gst_shout2send_base_init), (gst_shout2send_init), (gst_shout2send_connect), (gst_shout2send_change_state): * ext/shout2/gstshout2.h: make this work again. Based on a patch by Zaheer Merali (fixes #142262) * ext/theora/theora.c: (plugin_init): don't set rank on encoders --- ChangeLog | 13 +++++++++++++ configure.ac | 2 -- ext/shout2/gstshout2.c | 53 +++++++++++++++++++------------------------------- ext/shout2/gstshout2.h | 3 +-- 4 files changed, 34 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b0df44..dd08913 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-05-12 Benjamin Otte + + * configure.ac: + enable shout2 by default + * ext/shout2/gstshout2.c: (gst_shout2send_protocol_get_type), + (gst_shout2send_base_init), (gst_shout2send_init), + (gst_shout2send_connect), (gst_shout2send_change_state): + * ext/shout2/gstshout2.h: + make this work again. Based on a patch by Zaheer Merali (fixes + #142262) + * ext/theora/theora.c: (plugin_init): + don't set rank on encoders + 2004-05-11 Jeremy Simon * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_audio_caps): diff --git a/configure.ac b/configure.ac index d904f93..d2b7898 100644 --- a/configure.ac +++ b/configure.ac @@ -120,11 +120,9 @@ GST_CHECK_FEATURE(EXPERIMENTAL, [enable building of experimental plug-ins],, [ AC_MSG_WARN(building experimental plug-ins) USE_TARKIN="yes" - USE_SHOUT2="yes" ],[ AC_MSG_NOTICE(not building experimental plug-ins) USE_TARKIN="no" - USE_SHOUT2="no" ]) dnl broken plug-ins; stuff that doesn't seem to build at the moment diff --git a/ext/shout2/gstshout2.c b/ext/shout2/gstshout2.c index 9941676..1383df1 100644 --- a/ext/shout2/gstshout2.c +++ b/ext/shout2/gstshout2.c @@ -58,33 +58,20 @@ enum ARG_URL, /* Url of stream (I'm guessing) */ }; -static GstPadTemplate * -sink_template_factory (void) -{ - static GstPadTemplate *template = NULL; - - if (!template) { - template = gst_pad_template_new ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - gst_caps_new ("shout2send_sink", - "application/ogg", - NULL), - gst_caps_new ("shout2send_sink", - "audio/mpeg", - gst_props_new ("mpegversion", GST_PROPS_INT (1), - "layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL); - } - - return template; -} +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("application/x-ogg; " + "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]") + ); static void gst_shout2send_class_init (GstShout2sendClass * klass); static void gst_shout2send_base_init (GstShout2sendClass * klass); static void gst_shout2send_init (GstShout2send * shout2send); static void gst_shout2send_chain (GstPad * pad, GstData * _data); -static GstPadLinkReturn gst_shout2send_connect (GstPad * pad, GstCaps * caps); +static GstPadLinkReturn gst_shout2send_connect (GstPad * pad, + const GstCaps * caps); static void gst_shout2send_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -103,11 +90,10 @@ gst_shout2send_protocol_get_type (void) { static GType shout2send_protocol_type = 0; static GEnumValue shout2send_protocol[] = { - {SHOUT2SEND_PROTOCOL_ICE, "1", "Ice Protocol"}, - {SHOUT2SEND_PROTOCOL_XAUDIOCAST, "2", + {SHOUT2SEND_PROTOCOL_XAUDIOCAST, "1", "Xaudiocast Protocol (icecast 1.3.x)"}, - {SHOUT2SEND_PROTOCOL_ICY, "3", "Icy Protocol (ShoutCast)"}, - {SHOUT2SEND_PROTOCOL_HTTP, "4", "Http Protocol (icecast 2.x)"}, + {SHOUT2SEND_PROTOCOL_ICY, "2", "Icy Protocol (ShoutCast)"}, + {SHOUT2SEND_PROTOCOL_HTTP, "3", "Http Protocol (icecast 2.x)"}, {0, NULL, NULL}, }; @@ -148,7 +134,8 @@ gst_shout2send_base_init (GstShout2sendClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, sink_template_factory ()); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); gst_element_class_set_details (element_class, &shout2send_details); } @@ -198,7 +185,8 @@ static void gst_shout2send_init (GstShout2send * shout2send) { shout2send->sinkpad = - gst_pad_new_from_template (sink_template_factory (), "sink"); + gst_pad_new_from_template (gst_static_pad_template_get (&sink_template), + "sink"); gst_element_add_pad (GST_ELEMENT (shout2send), shout2send->sinkpad); gst_pad_set_chain_function (shout2send->sinkpad, gst_shout2send_chain); @@ -363,15 +351,17 @@ gst_shout2send_get_property (GObject * object, guint prop_id, GValue * value, } static GstPadLinkReturn -gst_shout2send_connect (GstPad * pad, GstCaps * caps) +gst_shout2send_connect (GstPad * pad, const GstCaps * caps) { + const gchar *mimetype; - if (!strcmp (gst_caps_get_mime (caps), "audio/mpeg")) { + mimetype = gst_structure_get_name (gst_caps_get_structure (caps, 0)); + if (!strcmp (mimetype, "audio/mpeg")) { audio_format = SHOUT_FORMAT_MP3; return GST_PAD_LINK_OK; } - if (!strcmp (gst_caps_get_mime (caps), "application/ogg")) { + if (!strcmp (mimetype, "application/ogg")) { audio_format = SHOUT_FORMAT_VORBIS; return GST_PAD_LINK_OK; } else { @@ -402,9 +392,6 @@ gst_shout2send_change_state (GstElement * element) shout2send->conn = shout_new (); switch (shout2send->protocol) { - case SHOUT2SEND_PROTOCOL_ICE: - proto = SHOUT_PROTOCOL_ICE; - break; case SHOUT2SEND_PROTOCOL_XAUDIOCAST: proto = SHOUT_PROTOCOL_XAUDIOCAST; break; diff --git a/ext/shout2/gstshout2.h b/ext/shout2/gstshout2.h index 7063129..81a2f91 100644 --- a/ext/shout2/gstshout2.h +++ b/ext/shout2/gstshout2.h @@ -30,8 +30,7 @@ extern "C" { /* Protocol type enum */ typedef enum { - SHOUT2SEND_PROTOCOL_ICE = 1, - SHOUT2SEND_PROTOCOL_XAUDIOCAST, + SHOUT2SEND_PROTOCOL_XAUDIOCAST = 1, SHOUT2SEND_PROTOCOL_ICY, SHOUT2SEND_PROTOCOL_HTTP } GstShout2SendProtocol; -- 2.7.4