2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
25 #include "gstshout2.h"
29 #include "gst/gst-i18n-plugin.h"
31 GST_DEBUG_CATEGORY_STATIC (shout2_debug);
32 #define GST_CAT_DEFAULT shout2_debug
34 static const GstElementDetails shout2send_details =
35 GST_ELEMENT_DETAILS ("Icecast network sink",
37 "Sends data to an icecast server",
38 "Wim Taymans <wim.taymans@chello.be>\n"
39 "Pedro Corte-Real <typo@netcabo.pt>\n"
40 "Zaheer Abbas Merali <zaheerabbas at merali dot org>");
45 SIGNAL_CONNECTION_PROBLEM, /* 0.11 FIXME: remove this */
52 ARG_IP, /* the ip of the server */
53 ARG_PORT, /* the encoder port number on the server */
54 ARG_PASSWORD, /* the encoder password on the server */
55 ARG_USERNAME, /* the encoder username on the server */
56 ARG_PUBLIC, /* is this stream public? */
57 ARG_STREAMNAME, /* Name of the stream */
58 ARG_DESCRIPTION, /* Description of the stream */
59 ARG_GENRE, /* Genre of the stream */
61 ARG_PROTOCOL, /* Protocol to connect with */
63 ARG_MOUNT, /* mountpoint of stream (icecast only) */
64 ARG_URL /* Url of stream (I'm guessing) */
67 #define DEFAULT_IP "127.0.0.1"
68 #define DEFAULT_PORT 8000
69 #define DEFAULT_PASSWORD "hackme"
70 #define DEFAULT_USERNAME "source"
71 #define DEFAULT_STREAMNAME ""
72 #define DEFAULT_DESCRIPTION ""
73 #define DEFAULT_GENRE ""
74 #define DEFAULT_MOUNT ""
75 #define DEFAULT_URL ""
76 #define DEFAULT_PROTOCOL SHOUT2SEND_PROTOCOL_HTTP
78 static GstElementClass *parent_class = NULL;
80 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
83 GST_STATIC_CAPS ("application/ogg; "
84 "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]")
86 static void gst_shout2send_class_init (GstShout2sendClass * klass);
87 static void gst_shout2send_base_init (GstShout2sendClass * klass);
88 static void gst_shout2send_init (GstShout2send * shout2send);
89 static void gst_shout2send_finalize (GstShout2send * shout2send);
91 static gboolean gst_shout2send_event (GstBaseSink * sink, GstEvent * event);
92 static GstFlowReturn gst_shout2send_render (GstBaseSink * sink,
94 static gboolean gst_shout2send_start (GstBaseSink * basesink);
95 static gboolean gst_shout2send_stop (GstBaseSink * basesink);
97 static void gst_shout2send_set_property (GObject * object, guint prop_id,
98 const GValue * value, GParamSpec * pspec);
99 static void gst_shout2send_get_property (GObject * object, guint prop_id,
100 GValue * value, GParamSpec * pspec);
102 static gboolean gst_shout2send_setcaps (GstPad * pad, GstCaps * caps);
104 static guint gst_shout2send_signals[LAST_SIGNAL] = { 0 };
106 #define GST_TYPE_SHOUT_PROTOCOL (gst_shout2send_protocol_get_type())
108 gst_shout2send_protocol_get_type (void)
110 static GType shout2send_protocol_type = 0;
111 static const GEnumValue shout2send_protocol[] = {
112 {SHOUT2SEND_PROTOCOL_XAUDIOCAST,
113 "Xaudiocast Protocol (icecast 1.3.x)", "xaudiocast"},
114 {SHOUT2SEND_PROTOCOL_ICY, "Icy Protocol (ShoutCast)", "icy"},
115 {SHOUT2SEND_PROTOCOL_HTTP, "Http Protocol (icecast 2.x)", "http"},
119 if (!shout2send_protocol_type) {
120 shout2send_protocol_type =
121 g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol);
125 return shout2send_protocol_type;
129 gst_shout2send_get_type (void)
131 static GType shout2send_type = 0;
133 if (!shout2send_type) {
134 static const GTypeInfo shout2send_info = {
135 sizeof (GstShout2sendClass),
136 (GBaseInitFunc) gst_shout2send_base_init,
138 (GClassInitFunc) gst_shout2send_class_init,
141 sizeof (GstShout2send),
143 (GInstanceInitFunc) gst_shout2send_init,
146 static const GInterfaceInfo tag_setter_info = {
153 g_type_register_static (GST_TYPE_BASE_SINK, "GstShout2send",
154 &shout2send_info, 0);
156 g_type_add_interface_static (shout2send_type, GST_TYPE_TAG_SETTER,
160 return shout2send_type;
164 gst_shout2send_base_init (GstShout2sendClass * klass)
166 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
168 gst_element_class_add_pad_template (element_class,
169 gst_static_pad_template_get (&sink_template));
170 gst_element_class_set_details (element_class, &shout2send_details);
172 GST_DEBUG_CATEGORY_INIT (shout2_debug, "shout2", 0, "shout2send element");
176 gst_shout2send_class_init (GstShout2sendClass * klass)
178 GObjectClass *gobject_class;
179 GstBaseSinkClass *gstbasesink_class;
181 gobject_class = (GObjectClass *) klass;
182 gstbasesink_class = (GstBaseSinkClass *) klass;
184 parent_class = g_type_class_peek_parent (klass);
186 gobject_class->set_property = gst_shout2send_set_property;
187 gobject_class->get_property = gst_shout2send_get_property;
188 gobject_class->finalize = (GObjectFinalizeFunc) gst_shout2send_finalize;
190 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP,
191 g_param_spec_string ("ip", "ip", "ip", DEFAULT_IP, G_PARAM_READWRITE));
192 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
193 g_param_spec_int ("port", "port", "port", 1, G_MAXUSHORT, DEFAULT_PORT,
196 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD,
197 g_param_spec_string ("password", "password", "password", DEFAULT_PASSWORD,
200 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_USERNAME,
201 g_param_spec_string ("username", "username", "username", DEFAULT_USERNAME,
205 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STREAMNAME,
206 g_param_spec_string ("streamname", "streamname", "name of the stream",
207 DEFAULT_STREAMNAME, G_PARAM_READWRITE));
209 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION,
210 g_param_spec_string ("description", "description", "description",
211 DEFAULT_DESCRIPTION, G_PARAM_READWRITE));
213 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE,
214 g_param_spec_string ("genre", "genre", "genre", DEFAULT_GENRE,
217 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PROTOCOL,
218 g_param_spec_enum ("protocol", "protocol", "Connection Protocol to use",
219 GST_TYPE_SHOUT_PROTOCOL, DEFAULT_PROTOCOL, G_PARAM_READWRITE));
223 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT,
224 g_param_spec_string ("mount", "mount", "mount", DEFAULT_MOUNT,
227 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL,
228 g_param_spec_string ("url", "url", "url", DEFAULT_URL,
232 gst_shout2send_signals[SIGNAL_CONNECTION_PROBLEM] =
233 g_signal_new ("connection-problem", G_TYPE_FROM_CLASS (klass),
234 G_SIGNAL_RUN_CLEANUP, G_STRUCT_OFFSET (GstShout2sendClass,
235 connection_problem), NULL, NULL, g_cclosure_marshal_VOID__INT,
236 G_TYPE_NONE, 1, G_TYPE_INT);
238 gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_shout2send_start);
239 gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_shout2send_stop);
240 gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_shout2send_render);
241 gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_shout2send_event);
245 gst_shout2send_init (GstShout2send * shout2send)
247 gst_base_sink_set_sync (GST_BASE_SINK (shout2send), FALSE);
249 gst_pad_set_setcaps_function (GST_BASE_SINK_PAD (shout2send),
250 GST_DEBUG_FUNCPTR (gst_shout2send_setcaps));
252 shout2send->ip = g_strdup (DEFAULT_IP);
253 shout2send->port = DEFAULT_PORT;
254 shout2send->password = g_strdup (DEFAULT_PASSWORD);
255 shout2send->username = g_strdup (DEFAULT_USERNAME);
256 shout2send->streamname = g_strdup (DEFAULT_STREAMNAME);
257 shout2send->description = g_strdup (DEFAULT_DESCRIPTION);
258 shout2send->genre = g_strdup (DEFAULT_GENRE);
259 shout2send->mount = g_strdup (DEFAULT_MOUNT);
260 shout2send->url = g_strdup (DEFAULT_URL);
261 shout2send->protocol = DEFAULT_PROTOCOL;
263 shout2send->tags = gst_tag_list_new ();
264 shout2send->conn = NULL;
265 shout2send->audio_format = SHOUT_FORMAT_VORBIS;
266 shout2send->connected = FALSE;
267 shout2send->songmetadata = NULL;
268 shout2send->songartist = NULL;
269 shout2send->songtitle = NULL;
273 gst_shout2send_finalize (GstShout2send * shout2send)
275 g_free (shout2send->ip);
276 g_free (shout2send->password);
277 g_free (shout2send->username);
278 g_free (shout2send->streamname);
279 g_free (shout2send->description);
280 g_free (shout2send->genre);
281 g_free (shout2send->mount);
282 g_free (shout2send->url);
284 gst_tag_list_free (shout2send->tags);
286 G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (shout2send));
290 set_shout_metadata (const GstTagList * list, const gchar * tag,
293 GstShout2send *shout2send = (GstShout2send *) user_data;
294 char **shout_metadata = &(shout2send->songmetadata);
295 char **song_artist = &(shout2send->songartist);
296 char **song_title = &(shout2send->songtitle);
300 GST_DEBUG ("tag: %s being added", tag);
301 if (strcmp (tag, GST_TAG_ARTIST) == 0) {
302 if (gst_tag_get_type (tag) == G_TYPE_STRING) {
303 if (!gst_tag_list_get_string (list, tag, &value)) {
304 GST_DEBUG ("Error reading \"%s\" tag value", tag);
308 if (*song_artist != NULL)
309 g_free (*song_artist);
311 *song_artist = g_strdup (value);
313 } else if (strcmp (tag, GST_TAG_TITLE) == 0) {
314 if (gst_tag_get_type (tag) == G_TYPE_STRING) {
315 if (!gst_tag_list_get_string (list, tag, &value)) {
316 GST_DEBUG ("Error reading \"%s\" tag value", tag);
320 if (*song_title != NULL)
321 g_free (*song_title);
323 *song_title = g_strdup (value);
327 if (*shout_metadata != NULL)
328 g_free (*shout_metadata);
331 if (*song_title && *song_artist) {
332 *shout_metadata = g_strdup_printf ("%s - %s", *song_artist, *song_title);
333 } else if (*song_title && *song_artist == NULL) {
334 *shout_metadata = g_strdup_printf ("Unknown - %s", *song_title);
335 } else if (*song_title == NULL && *song_artist) {
336 *shout_metadata = g_strdup_printf ("%s - Unknown", *song_artist);
338 *shout_metadata = g_strdup_printf ("Unknown - Unknown");
341 GST_LOG ("shout metadata is now: %s", *shout_metadata);
346 gst_shout2send_set_metadata (GstShout2send * shout2send)
348 const GstTagList *user_tags;
351 shout_metadata_t *pmetadata;
353 g_return_if_fail (shout2send != NULL);
354 user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (shout2send));
355 if ((shout2send->tags == NULL) && (user_tags == NULL)) {
358 copy = gst_tag_list_merge (user_tags, shout2send->tags,
359 gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
360 /* lets get the artist and song tags */
362 gst_tag_list_foreach ((GstTagList *) copy, set_shout_metadata,
363 (gpointer) & tempmetadata);
365 pmetadata = shout_metadata_new ();
366 shout_metadata_add (pmetadata, "song", tempmetadata);
367 shout_set_metadata (shout2send->conn, pmetadata);
368 shout_metadata_free (pmetadata);
371 gst_tag_list_free (copy);
377 gst_shout2send_event (GstBaseSink * sink, GstEvent * event)
379 GstShout2send *shout2send;
382 shout2send = GST_SHOUT2SEND (sink);
384 GST_LOG_OBJECT (shout2send, "got %s event", GST_EVENT_TYPE_NAME (event));
386 switch (GST_EVENT_TYPE (event)) {
388 /* vorbis audio doesnt need metadata setting on the icecast level, only mp3 */
389 if (shout2send->tags && shout2send->audio_format == SHOUT_FORMAT_MP3) {
392 gst_event_parse_tag (event, &list);
393 GST_DEBUG_OBJECT (shout2send, "tags=%" GST_PTR_FORMAT, list);
394 gst_tag_list_insert (shout2send->tags,
396 gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
397 /* lets get the artist and song tags */
398 gst_tag_list_foreach ((GstTagList *) list,
399 set_shout_metadata, shout2send);
400 if (shout2send->songmetadata && shout2send->connected) {
401 shout_metadata_t *pmetadata;
403 GST_DEBUG_OBJECT (shout2send, "metadata now: %s",
404 shout2send->songmetadata);
406 pmetadata = shout_metadata_new ();
407 shout_metadata_add (pmetadata, "song", shout2send->songmetadata);
408 shout_set_metadata (shout2send->conn, pmetadata);
409 shout_metadata_free (pmetadata);
415 GST_LOG_OBJECT (shout2send, "let base class handle event");
416 if (GST_BASE_SINK_CLASS (parent_class)->event) {
417 event = gst_event_ref (event);
418 ret = GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
428 gst_shout2send_start (GstBaseSink * basesink)
430 GstShout2send *sink = GST_SHOUT2SEND (basesink);
431 const gchar *cur_prop;
433 gchar *version_string;
435 GST_DEBUG_OBJECT (sink, "starting");
437 sink->conn = shout_new ();
439 switch (sink->protocol) {
440 case SHOUT2SEND_PROTOCOL_XAUDIOCAST:
441 proto = SHOUT_PROTOCOL_XAUDIOCAST;
443 case SHOUT2SEND_PROTOCOL_ICY:
444 proto = SHOUT_PROTOCOL_ICY;
446 case SHOUT2SEND_PROTOCOL_HTTP:
447 proto = SHOUT_PROTOCOL_HTTP;
451 cur_prop = "protocol";
452 GST_DEBUG_OBJECT (sink, "setting protocol: %d", sink->protocol);
453 if (shout_set_protocol (sink->conn, proto) != SHOUTERR_SUCCESS)
456 /* --- FIXME: shout requires an ip, and fails if it is given a host. */
457 /* may want to put convert_to_ip(shout2send->ip) here */
459 GST_DEBUG_OBJECT (sink, "setting ip: %s", sink->ip);
460 if (shout_set_host (sink->conn, sink->ip) != SHOUTERR_SUCCESS)
464 GST_DEBUG_OBJECT (sink, "setting port: %u", sink->port);
465 if (shout_set_port (sink->conn, sink->port) != SHOUTERR_SUCCESS)
468 cur_prop = "password";
469 GST_DEBUG_OBJECT (sink, "setting password: %s", sink->password);
470 if (shout_set_password (sink->conn, sink->password) != SHOUTERR_SUCCESS)
473 cur_prop = "streamname";
474 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->streamname);
475 if (shout_set_name (sink->conn, sink->streamname) != SHOUTERR_SUCCESS)
478 cur_prop = "description";
479 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->description);
480 if (shout_set_description (sink->conn, sink->description) != SHOUTERR_SUCCESS)
484 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->genre);
485 if (shout_set_genre (sink->conn, sink->genre) != SHOUTERR_SUCCESS)
489 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->mount);
490 if (shout_set_mount (sink->conn, sink->mount) != SHOUTERR_SUCCESS)
493 cur_prop = "username";
494 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, "source");
495 if (shout_set_user (sink->conn, sink->username) != SHOUTERR_SUCCESS)
498 version_string = gst_version_string ();
500 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, version_string);
501 if (shout_set_agent (sink->conn, version_string) != SHOUTERR_SUCCESS) {
502 g_free (version_string);
506 g_free (version_string);
512 GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
513 ("Error setting %s: %s", cur_prop, shout_get_error (sink->conn)));
519 gst_shout2send_connect (GstShout2send * sink)
521 GST_DEBUG_OBJECT (sink, "Connection format is: %s",
522 (sink->audio_format == SHOUT_FORMAT_VORBIS) ? "vorbis" :
523 ((sink->audio_format == SHOUT_FORMAT_MP3) ? "mp3" : "unknown"));
525 if (shout_set_format (sink->conn, sink->audio_format) != SHOUTERR_SUCCESS)
526 goto could_not_set_format;
528 if (shout_open (sink->conn) != SHOUTERR_SUCCESS)
529 goto could_not_connect;
531 GST_DEBUG_OBJECT (sink, "connected to server");
532 sink->connected = TRUE;
534 /* let's set metadata */
535 if (sink->songmetadata) {
536 shout_metadata_t *pmetadata;
538 GST_DEBUG_OBJECT (sink, "shout metadata now: %s", sink->songmetadata);
539 pmetadata = shout_metadata_new ();
540 shout_metadata_add (pmetadata, "song", sink->songmetadata);
541 shout_set_metadata (sink->conn, pmetadata);
542 shout_metadata_free (pmetadata);
548 could_not_set_format:
550 GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
551 ("Error setting connection format: %s", shout_get_error (sink->conn)));
557 GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
558 (_("Could not connect to server")),
559 ("shout_open() failed: err=%s", shout_get_error (sink->conn)));
560 g_signal_emit (sink, gst_shout2send_signals[SIGNAL_CONNECTION_PROBLEM], 0,
561 shout_get_errno (sink->conn));
567 gst_shout2send_stop (GstBaseSink * basesink)
569 GstShout2send *sink = GST_SHOUT2SEND (basesink);
573 shout_close (sink->conn);
574 shout_free (sink->conn);
578 if (sink->songmetadata) {
579 g_free (sink->songmetadata);
580 sink->songmetadata = NULL;
583 sink->connected = FALSE;
589 gst_shout2send_render (GstBaseSink * basesink, GstBuffer * buf)
594 sink = GST_SHOUT2SEND (basesink);
596 /* presumably we connect here because we need to know the format before
597 * we can set up the connection, which we don't know yet in _start() */
598 if (!sink->connected) {
599 if (!gst_shout2send_connect (sink))
600 return GST_FLOW_ERROR;
603 /* FIXME: do we want to do syncing here at all? (tpm) */
604 /* GST_LOG_OBJECT (sink, "using libshout to sync"); */
605 shout_sync (sink->conn);
607 GST_LOG_OBJECT (sink, "sending %u bytes of data", GST_BUFFER_SIZE (buf));
608 ret = shout_send (sink->conn, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
609 if (ret != SHOUTERR_SUCCESS)
617 GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL),
618 ("shout_send() failed: %s", shout_get_error (sink->conn)));
619 g_signal_emit (sink, gst_shout2send_signals[SIGNAL_CONNECTION_PROBLEM], 0,
620 shout_get_errno (sink->conn));
621 return GST_FLOW_ERROR;
626 gst_shout2send_set_property (GObject * object, guint prop_id,
627 const GValue * value, GParamSpec * pspec)
629 GstShout2send *shout2send;
631 shout2send = GST_SHOUT2SEND (object);
636 g_free (shout2send->ip);
637 shout2send->ip = g_strdup (g_value_get_string (value));
640 shout2send->port = g_value_get_int (value);
643 if (shout2send->password)
644 g_free (shout2send->password);
645 shout2send->password = g_strdup (g_value_get_string (value));
648 if (shout2send->username)
649 g_free (shout2send->username);
650 shout2send->username = g_strdup (g_value_get_string (value));
652 case ARG_STREAMNAME: /* Name of the stream */
653 if (shout2send->streamname)
654 g_free (shout2send->streamname);
655 shout2send->streamname = g_strdup (g_value_get_string (value));
657 case ARG_DESCRIPTION: /* Description of the stream */
658 if (shout2send->description)
659 g_free (shout2send->description);
660 shout2send->description = g_strdup (g_value_get_string (value));
662 case ARG_GENRE: /* Genre of the stream */
663 if (shout2send->genre)
664 g_free (shout2send->genre);
665 shout2send->genre = g_strdup (g_value_get_string (value));
667 case ARG_PROTOCOL: /* protocol to connect with */
668 shout2send->protocol = g_value_get_enum (value);
670 case ARG_MOUNT: /* mountpoint of stream (icecast only) */
671 if (shout2send->mount)
672 g_free (shout2send->mount);
673 shout2send->mount = g_strdup (g_value_get_string (value));
675 case ARG_URL: /* Url of the stream (I'm guessing) */
677 g_free (shout2send->url);
678 shout2send->url = g_strdup (g_value_get_string (value));
681 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
687 gst_shout2send_get_property (GObject * object, guint prop_id,
688 GValue * value, GParamSpec * pspec)
690 GstShout2send *shout2send;
692 shout2send = GST_SHOUT2SEND (object);
696 g_value_set_string (value, shout2send->ip);
699 g_value_set_int (value, shout2send->port);
702 g_value_set_string (value, shout2send->password);
705 g_value_set_string (value, shout2send->username);
707 case ARG_STREAMNAME: /* Name of the stream */
708 g_value_set_string (value, shout2send->streamname);
710 case ARG_DESCRIPTION: /* Description of the stream */
711 g_value_set_string (value, shout2send->description);
713 case ARG_GENRE: /* Genre of the stream */
714 g_value_set_string (value, shout2send->genre);
716 case ARG_PROTOCOL: /* protocol to connect with */
717 g_value_set_enum (value, shout2send->protocol);
719 case ARG_MOUNT: /* mountpoint of stream (icecast only) */
720 g_value_set_string (value, shout2send->mount);
722 case ARG_URL: /* Url of stream (I'm guessing) */
723 g_value_set_string (value, shout2send->url);
726 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
732 gst_shout2send_setcaps (GstPad * pad, GstCaps * caps)
734 const gchar *mimetype;
735 GstShout2send *shout2send;
738 shout2send = GST_SHOUT2SEND (GST_OBJECT_PARENT (pad));
740 mimetype = gst_structure_get_name (gst_caps_get_structure (caps, 0));
742 GST_DEBUG_OBJECT (shout2send, "mimetype of caps given is: %s", mimetype);
744 if (!strcmp (mimetype, "audio/mpeg")) {
745 shout2send->audio_format = SHOUT_FORMAT_MP3;
746 } else if (!strcmp (mimetype, "application/ogg")) {
747 shout2send->audio_format = SHOUT_FORMAT_VORBIS;
756 plugin_init (GstPlugin * plugin)
759 setlocale (LC_ALL, "");
760 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
761 #endif /* ENABLE_NLS */
763 return gst_element_register (plugin, "shout2send", GST_RANK_NONE,
764 GST_TYPE_SHOUT2SEND);
767 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
770 "Sends data to an icecast server using libshout2",
772 VERSION, "LGPL", "libshout2", "http://www.icecast.org/download.html")