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);
90 static gboolean gst_shout2send_event (GstBaseSink * sink, GstEvent * event);
91 static GstFlowReturn gst_shout2send_render (GstBaseSink * sink,
93 static gboolean gst_shout2send_start (GstBaseSink * basesink);
94 static gboolean gst_shout2send_stop (GstBaseSink * basesink);
96 static void gst_shout2send_set_property (GObject * object, guint prop_id,
97 const GValue * value, GParamSpec * pspec);
98 static void gst_shout2send_get_property (GObject * object, guint prop_id,
99 GValue * value, GParamSpec * pspec);
101 static gboolean gst_shout2send_setcaps (GstPad * pad, GstCaps * caps);
103 static guint gst_shout2send_signals[LAST_SIGNAL] = { 0 };
105 #define GST_TYPE_SHOUT_PROTOCOL (gst_shout2send_protocol_get_type())
107 gst_shout2send_protocol_get_type (void)
109 static GType shout2send_protocol_type = 0;
110 static const GEnumValue shout2send_protocol[] = {
111 {SHOUT2SEND_PROTOCOL_XAUDIOCAST,
112 "Xaudiocast Protocol (icecast 1.3.x)", "xaudiocast"},
113 {SHOUT2SEND_PROTOCOL_ICY, "Icy Protocol (ShoutCast)", "icy"},
114 {SHOUT2SEND_PROTOCOL_HTTP, "Http Protocol (icecast 2.x)", "http"},
118 if (!shout2send_protocol_type) {
119 shout2send_protocol_type =
120 g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol);
124 return shout2send_protocol_type;
128 gst_shout2send_get_type (void)
130 static GType shout2send_type = 0;
132 if (!shout2send_type) {
133 static const GTypeInfo shout2send_info = {
134 sizeof (GstShout2sendClass),
135 (GBaseInitFunc) gst_shout2send_base_init,
137 (GClassInitFunc) gst_shout2send_class_init,
140 sizeof (GstShout2send),
142 (GInstanceInitFunc) gst_shout2send_init,
145 static const GInterfaceInfo tag_setter_info = {
152 g_type_register_static (GST_TYPE_BASE_SINK, "GstShout2send",
153 &shout2send_info, 0);
155 g_type_add_interface_static (shout2send_type, GST_TYPE_TAG_SETTER,
159 return shout2send_type;
163 gst_shout2send_base_init (GstShout2sendClass * klass)
165 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
167 gst_element_class_add_pad_template (element_class,
168 gst_static_pad_template_get (&sink_template));
169 gst_element_class_set_details (element_class, &shout2send_details);
171 GST_DEBUG_CATEGORY_INIT (shout2_debug, "shout2", 0, "shout2send element");
175 gst_shout2send_class_init (GstShout2sendClass * klass)
177 GObjectClass *gobject_class;
178 GstBaseSinkClass *gstbasesink_class;
180 gobject_class = (GObjectClass *) klass;
181 gstbasesink_class = (GstBaseSinkClass *) klass;
183 parent_class = g_type_class_peek_parent (klass);
185 gobject_class->set_property = gst_shout2send_set_property;
186 gobject_class->get_property = gst_shout2send_get_property;
188 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP,
189 g_param_spec_string ("ip", "ip", "ip", DEFAULT_IP, G_PARAM_READWRITE));
190 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
191 g_param_spec_int ("port", "port", "port", 1, G_MAXUSHORT, DEFAULT_PORT,
194 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD,
195 g_param_spec_string ("password", "password", "password", DEFAULT_PASSWORD,
198 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_USERNAME,
199 g_param_spec_string ("username", "username", "username", DEFAULT_USERNAME,
203 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STREAMNAME,
204 g_param_spec_string ("streamname", "streamname", "name of the stream",
205 DEFAULT_STREAMNAME, G_PARAM_READWRITE));
207 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION,
208 g_param_spec_string ("description", "description", "description",
209 DEFAULT_DESCRIPTION, G_PARAM_READWRITE));
211 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE,
212 g_param_spec_string ("genre", "genre", "genre", DEFAULT_GENRE,
215 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PROTOCOL,
216 g_param_spec_enum ("protocol", "protocol", "Connection Protocol to use",
217 GST_TYPE_SHOUT_PROTOCOL, DEFAULT_PROTOCOL, G_PARAM_READWRITE));
221 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT,
222 g_param_spec_string ("mount", "mount", "mount", DEFAULT_MOUNT,
225 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL,
226 g_param_spec_string ("url", "url", "url", DEFAULT_URL,
230 gst_shout2send_signals[SIGNAL_CONNECTION_PROBLEM] =
231 g_signal_new ("connection-problem", G_TYPE_FROM_CLASS (klass),
232 G_SIGNAL_RUN_CLEANUP, G_STRUCT_OFFSET (GstShout2sendClass,
233 connection_problem), NULL, NULL, g_cclosure_marshal_VOID__INT,
234 G_TYPE_NONE, 1, G_TYPE_INT);
236 gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_shout2send_start);
237 gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_shout2send_stop);
238 gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_shout2send_render);
239 gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_shout2send_event);
243 gst_shout2send_init (GstShout2send * shout2send)
245 gst_base_sink_set_sync (GST_BASE_SINK (shout2send), FALSE);
247 gst_pad_set_setcaps_function (GST_BASE_SINK_PAD (shout2send),
248 GST_DEBUG_FUNCPTR (gst_shout2send_setcaps));
250 shout2send->ip = g_strdup (DEFAULT_IP);
251 shout2send->port = DEFAULT_PORT;
252 shout2send->password = g_strdup (DEFAULT_PASSWORD);
253 shout2send->username = g_strdup (DEFAULT_USERNAME);
254 shout2send->streamname = g_strdup (DEFAULT_STREAMNAME);
255 shout2send->description = g_strdup (DEFAULT_DESCRIPTION);
256 shout2send->genre = g_strdup (DEFAULT_GENRE);
257 shout2send->mount = g_strdup (DEFAULT_MOUNT);
258 shout2send->url = g_strdup (DEFAULT_URL);
259 shout2send->protocol = DEFAULT_PROTOCOL;
261 shout2send->tags = gst_tag_list_new ();
262 shout2send->conn = NULL;
263 shout2send->audio_format = SHOUT_FORMAT_VORBIS;
264 shout2send->connected = FALSE;
265 shout2send->songmetadata = NULL;
266 shout2send->songartist = NULL;
267 shout2send->songtitle = NULL;
272 set_shout_metadata (const GstTagList * list, const gchar * tag,
275 GstShout2send *shout2send = (GstShout2send *) user_data;
276 char **shout_metadata = &(shout2send->songmetadata);
277 char **song_artist = &(shout2send->songartist);
278 char **song_title = &(shout2send->songtitle);
282 GST_DEBUG ("tag: %s being added", tag);
283 if (strcmp (tag, GST_TAG_ARTIST) == 0) {
284 if (gst_tag_get_type (tag) == G_TYPE_STRING) {
285 if (!gst_tag_list_get_string (list, tag, &value)) {
286 GST_DEBUG ("Error reading \"%s\" tag value", tag);
290 if (*song_artist != NULL)
291 g_free (*song_artist);
293 *song_artist = g_strdup (value);
295 } else if (strcmp (tag, GST_TAG_TITLE) == 0) {
296 if (gst_tag_get_type (tag) == G_TYPE_STRING) {
297 if (!gst_tag_list_get_string (list, tag, &value)) {
298 GST_DEBUG ("Error reading \"%s\" tag value", tag);
302 if (*song_title != NULL)
303 g_free (*song_title);
305 *song_title = g_strdup (value);
309 if (*shout_metadata != NULL)
310 g_free (*shout_metadata);
313 if (*song_title && *song_artist) {
314 *shout_metadata = g_strdup_printf ("%s - %s", *song_artist, *song_title);
315 } else if (*song_title && *song_artist == NULL) {
316 *shout_metadata = g_strdup_printf ("Unknown - %s", *song_title);
317 } else if (*song_title == NULL && *song_artist) {
318 *shout_metadata = g_strdup_printf ("%s - Unknown", *song_artist);
320 *shout_metadata = g_strdup_printf ("Unknown - Unknown");
323 GST_LOG ("shout metadata is now: %s", *shout_metadata);
328 gst_shout2send_set_metadata (GstShout2send * shout2send)
330 const GstTagList *user_tags;
333 shout_metadata_t *pmetadata;
335 g_return_if_fail (shout2send != NULL);
336 user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (shout2send));
337 if ((shout2send->tags == NULL) && (user_tags == NULL)) {
340 copy = gst_tag_list_merge (user_tags, shout2send->tags,
341 gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
342 /* lets get the artist and song tags */
344 gst_tag_list_foreach ((GstTagList *) copy, set_shout_metadata,
345 (gpointer) & tempmetadata);
347 pmetadata = shout_metadata_new ();
348 shout_metadata_add (pmetadata, "song", tempmetadata);
349 shout_set_metadata (shout2send->conn, pmetadata);
350 shout_metadata_free (pmetadata);
353 gst_tag_list_free (copy);
359 gst_shout2send_event (GstBaseSink * sink, GstEvent * event)
361 GstShout2send *shout2send;
364 shout2send = GST_SHOUT2SEND (sink);
366 GST_LOG_OBJECT (shout2send, "got %s event", GST_EVENT_TYPE_NAME (event));
368 switch (GST_EVENT_TYPE (event)) {
370 /* vorbis audio doesnt need metadata setting on the icecast level, only mp3 */
371 if (shout2send->tags && shout2send->audio_format == SHOUT_FORMAT_MP3) {
374 gst_event_parse_tag (event, &list);
375 GST_DEBUG_OBJECT (shout2send, "tags=%" GST_PTR_FORMAT, list);
376 gst_tag_list_insert (shout2send->tags,
378 gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
379 /* lets get the artist and song tags */
380 gst_tag_list_foreach ((GstTagList *) list,
381 set_shout_metadata, shout2send);
382 if (shout2send->songmetadata && shout2send->connected) {
383 shout_metadata_t *pmetadata;
385 GST_DEBUG_OBJECT (shout2send, "metadata now: %s",
386 shout2send->songmetadata);
388 pmetadata = shout_metadata_new ();
389 shout_metadata_add (pmetadata, "song", shout2send->songmetadata);
390 shout_set_metadata (shout2send->conn, pmetadata);
391 shout_metadata_free (pmetadata);
397 GST_LOG_OBJECT (shout2send, "let base class handle event");
398 if (GST_BASE_SINK_CLASS (parent_class)->event) {
399 event = gst_event_ref (event);
400 ret = GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
410 gst_shout2send_start (GstBaseSink * basesink)
412 GstShout2send *sink = GST_SHOUT2SEND (basesink);
413 const gchar *cur_prop;
415 gchar *version_string;
417 GST_DEBUG_OBJECT (sink, "starting");
419 sink->conn = shout_new ();
421 switch (sink->protocol) {
422 case SHOUT2SEND_PROTOCOL_XAUDIOCAST:
423 proto = SHOUT_PROTOCOL_XAUDIOCAST;
425 case SHOUT2SEND_PROTOCOL_ICY:
426 proto = SHOUT_PROTOCOL_ICY;
428 case SHOUT2SEND_PROTOCOL_HTTP:
429 proto = SHOUT_PROTOCOL_HTTP;
433 cur_prop = "protocol";
434 GST_DEBUG_OBJECT (sink, "setting protocol: %d", sink->protocol);
435 if (shout_set_protocol (sink->conn, proto) != SHOUTERR_SUCCESS)
438 /* --- FIXME: shout requires an ip, and fails if it is given a host. */
439 /* may want to put convert_to_ip(shout2send->ip) here */
441 GST_DEBUG_OBJECT (sink, "setting ip: %s", sink->ip);
442 if (shout_set_host (sink->conn, sink->ip) != SHOUTERR_SUCCESS)
446 GST_DEBUG_OBJECT (sink, "setting port: %u", sink->port);
447 if (shout_set_port (sink->conn, sink->port) != SHOUTERR_SUCCESS)
450 cur_prop = "password";
451 GST_DEBUG_OBJECT (sink, "setting password: %s", sink->password);
452 if (shout_set_password (sink->conn, sink->password) != SHOUTERR_SUCCESS)
455 cur_prop = "streamname";
456 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->streamname);
457 if (shout_set_name (sink->conn, sink->streamname) != SHOUTERR_SUCCESS)
460 cur_prop = "description";
461 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->description);
462 if (shout_set_description (sink->conn, sink->description) != SHOUTERR_SUCCESS)
466 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->genre);
467 if (shout_set_genre (sink->conn, sink->genre) != SHOUTERR_SUCCESS)
471 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->mount);
472 if (shout_set_mount (sink->conn, sink->mount) != SHOUTERR_SUCCESS)
475 cur_prop = "username";
476 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, "source");
477 if (shout_set_user (sink->conn, sink->username) != SHOUTERR_SUCCESS)
480 version_string = gst_version_string ();
482 GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, version_string);
483 if (shout_set_agent (sink->conn, version_string) != SHOUTERR_SUCCESS) {
484 g_free (version_string);
488 g_free (version_string);
494 GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
495 ("Error setting %s: %s", cur_prop, shout_get_error (sink->conn)));
501 gst_shout2send_connect (GstShout2send * sink)
503 GST_DEBUG_OBJECT (sink, "Connection format is: %s",
504 (sink->audio_format == SHOUT_FORMAT_VORBIS) ? "vorbis" :
505 ((sink->audio_format == SHOUT_FORMAT_MP3) ? "mp3" : "unknown"));
507 if (shout_set_format (sink->conn, sink->audio_format) != SHOUTERR_SUCCESS)
508 goto could_not_set_format;
510 if (shout_open (sink->conn) != SHOUTERR_SUCCESS)
511 goto could_not_connect;
513 GST_DEBUG_OBJECT (sink, "connected to server");
514 sink->connected = TRUE;
516 /* let's set metadata */
517 if (sink->songmetadata) {
518 shout_metadata_t *pmetadata;
520 GST_DEBUG_OBJECT (sink, "shout metadata now: %s", sink->songmetadata);
521 pmetadata = shout_metadata_new ();
522 shout_metadata_add (pmetadata, "song", sink->songmetadata);
523 shout_set_metadata (sink->conn, pmetadata);
524 shout_metadata_free (pmetadata);
530 could_not_set_format:
532 GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
533 ("Error setting connection format: %s", shout_get_error (sink->conn)));
539 GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
540 (_("Could not connect to server")),
541 ("shout_open() failed: err=%s", shout_get_error (sink->conn)));
542 g_signal_emit (sink, gst_shout2send_signals[SIGNAL_CONNECTION_PROBLEM], 0,
543 shout_get_errno (sink->conn));
549 gst_shout2send_stop (GstBaseSink * basesink)
551 GstShout2send *sink = GST_SHOUT2SEND (basesink);
555 shout_close (sink->conn);
556 shout_free (sink->conn);
560 if (sink->songmetadata) {
561 g_free (sink->songmetadata);
562 sink->songmetadata = NULL;
565 sink->connected = FALSE;
571 gst_shout2send_render (GstBaseSink * basesink, GstBuffer * buf)
576 sink = GST_SHOUT2SEND (basesink);
578 /* presumably we connect here because we need to know the format before
579 * we can set up the connection, which we don't know yet in _start() */
580 if (!sink->connected) {
581 if (!gst_shout2send_connect (sink))
582 return GST_FLOW_ERROR;
585 /* FIXME: do we want to do syncing here at all? (tpm) */
586 /* GST_LOG_OBJECT (sink, "using libshout to sync"); */
587 shout_sync (sink->conn);
589 GST_LOG_OBJECT (sink, "sending %u bytes of data", GST_BUFFER_SIZE (buf));
590 ret = shout_send (sink->conn, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
591 if (ret != SHOUTERR_SUCCESS)
599 GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL),
600 ("shout_send() failed: %s", shout_get_error (sink->conn)));
601 g_signal_emit (sink, gst_shout2send_signals[SIGNAL_CONNECTION_PROBLEM], 0,
602 shout_get_errno (sink->conn));
603 return GST_FLOW_ERROR;
608 gst_shout2send_set_property (GObject * object, guint prop_id,
609 const GValue * value, GParamSpec * pspec)
611 GstShout2send *shout2send;
613 shout2send = GST_SHOUT2SEND (object);
618 g_free (shout2send->ip);
619 shout2send->ip = g_strdup (g_value_get_string (value));
622 shout2send->port = g_value_get_int (value);
625 if (shout2send->password)
626 g_free (shout2send->password);
627 shout2send->password = g_strdup (g_value_get_string (value));
630 if (shout2send->username)
631 g_free (shout2send->username);
632 shout2send->username = g_strdup (g_value_get_string (value));
634 case ARG_STREAMNAME: /* Name of the stream */
635 if (shout2send->streamname)
636 g_free (shout2send->streamname);
637 shout2send->streamname = g_strdup (g_value_get_string (value));
639 case ARG_DESCRIPTION: /* Description of the stream */
640 if (shout2send->description)
641 g_free (shout2send->description);
642 shout2send->description = g_strdup (g_value_get_string (value));
644 case ARG_GENRE: /* Genre of the stream */
645 if (shout2send->genre)
646 g_free (shout2send->genre);
647 shout2send->genre = g_strdup (g_value_get_string (value));
649 case ARG_PROTOCOL: /* protocol to connect with */
650 shout2send->protocol = g_value_get_enum (value);
652 case ARG_MOUNT: /* mountpoint of stream (icecast only) */
653 if (shout2send->mount)
654 g_free (shout2send->mount);
655 shout2send->mount = g_strdup (g_value_get_string (value));
657 case ARG_URL: /* Url of the stream (I'm guessing) */
659 g_free (shout2send->url);
660 shout2send->url = g_strdup (g_value_get_string (value));
663 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
669 gst_shout2send_get_property (GObject * object, guint prop_id,
670 GValue * value, GParamSpec * pspec)
672 GstShout2send *shout2send;
674 shout2send = GST_SHOUT2SEND (object);
678 g_value_set_string (value, shout2send->ip);
681 g_value_set_int (value, shout2send->port);
684 g_value_set_string (value, shout2send->password);
687 g_value_set_string (value, shout2send->username);
689 case ARG_STREAMNAME: /* Name of the stream */
690 g_value_set_string (value, shout2send->streamname);
692 case ARG_DESCRIPTION: /* Description of the stream */
693 g_value_set_string (value, shout2send->description);
695 case ARG_GENRE: /* Genre of the stream */
696 g_value_set_string (value, shout2send->genre);
698 case ARG_PROTOCOL: /* protocol to connect with */
699 g_value_set_enum (value, shout2send->protocol);
701 case ARG_MOUNT: /* mountpoint of stream (icecast only) */
702 g_value_set_string (value, shout2send->mount);
704 case ARG_URL: /* Url of stream (I'm guessing) */
705 g_value_set_string (value, shout2send->url);
708 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
714 gst_shout2send_setcaps (GstPad * pad, GstCaps * caps)
716 const gchar *mimetype;
717 GstShout2send *shout2send;
720 shout2send = GST_SHOUT2SEND (GST_OBJECT_PARENT (pad));
722 mimetype = gst_structure_get_name (gst_caps_get_structure (caps, 0));
724 GST_DEBUG_OBJECT (shout2send, "mimetype of caps given is: %s", mimetype);
726 if (!strcmp (mimetype, "audio/mpeg")) {
727 shout2send->audio_format = SHOUT_FORMAT_MP3;
728 } else if (!strcmp (mimetype, "application/ogg")) {
729 shout2send->audio_format = SHOUT_FORMAT_VORBIS;
738 plugin_init (GstPlugin * plugin)
741 setlocale (LC_ALL, "");
742 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
743 #endif /* ENABLE_NLS */
745 return gst_element_register (plugin, "shout2send", GST_RANK_NONE,
746 GST_TYPE_SHOUT2SEND);
749 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
752 "Sends data to an icecast server using libshout2",
754 VERSION, "LGPL", "libshout2", "http://www.icecast.org/download.html")