mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
ext/shout2/gstshout2.*: Handle tags being received before the connection to the server is established properly (see #...
Original commit message from CVS: Patch by: Philippe Valembois * ext/shout2/gstshout2.c: (gst_shout2send_init), (gst_shout2send_set_metadata), (gst_shout2send_event), (gst_shout2send_render), (gst_shout2send_change_state): * ext/shout2/gstshout2.h: Handle tags being received before the connection to the server is established properly (see #338636).
This commit is contained in:
parent
3c4e9ffec1
commit
52563ea213
3 changed files with 33 additions and 11 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2006-04-17 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
Patch by: Philippe Valembois
|
||||||
|
|
||||||
|
* ext/shout2/gstshout2.c: (gst_shout2send_init),
|
||||||
|
(gst_shout2send_set_metadata), (gst_shout2send_event),
|
||||||
|
(gst_shout2send_render), (gst_shout2send_change_state):
|
||||||
|
* ext/shout2/gstshout2.h:
|
||||||
|
Handle tags being received before the connection to
|
||||||
|
the server is established properly (see #338636).
|
||||||
|
|
||||||
2006-04-17 Tim-Philipp Müller <tim at centricular dot net>
|
2006-04-17 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/shout2/gstshout2.c: (gst_shout2send_render):
|
* ext/shout2/gstshout2.c: (gst_shout2send_render):
|
||||||
|
|
|
@ -235,7 +235,7 @@ gst_shout2send_init (GstShout2send * shout2send)
|
||||||
shout2send->audio_format = SHOUT_FORMAT_VORBIS;
|
shout2send->audio_format = SHOUT_FORMAT_VORBIS;
|
||||||
shout2send->sync = FALSE;
|
shout2send->sync = FALSE;
|
||||||
shout2send->started = FALSE;
|
shout2send->started = FALSE;
|
||||||
|
shout2send->songmetadata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -281,10 +281,10 @@ set_shout_metadata (const GstTagList * list, const gchar * tag,
|
||||||
GST_DEBUG ("shout metadata is now: %s", *shout_metadata);
|
GST_DEBUG ("shout metadata is now: %s", *shout_metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
gst_shout2send_set_metadata (GstShout2send * shout2send)
|
gst_shout2send_set_metadata (GstShout2send * shout2send)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
const GstTagList *user_tags;
|
const GstTagList *user_tags;
|
||||||
GstTagList *copy;
|
GstTagList *copy;
|
||||||
char *tempmetadata;
|
char *tempmetadata;
|
||||||
|
@ -311,16 +311,14 @@ gst_shout2send_set_metadata (GstShout2send * shout2send)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_tag_list_free (copy);
|
gst_tag_list_free (copy);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_shout2send_event (GstBaseSink * sink, GstEvent * event)
|
gst_shout2send_event (GstBaseSink * sink, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstShout2send *shout2send;
|
GstShout2send *shout2send;
|
||||||
shout_metadata_t *pmetadata;
|
|
||||||
char *tempmetadata;
|
|
||||||
|
|
||||||
shout2send = GST_SHOUT2SEND (sink);
|
shout2send = GST_SHOUT2SEND (sink);
|
||||||
|
|
||||||
|
@ -337,13 +335,14 @@ gst_shout2send_event (GstBaseSink * sink, GstEvent * event)
|
||||||
list,
|
list,
|
||||||
gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
|
gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
|
||||||
/* lets get the artist and song tags */
|
/* lets get the artist and song tags */
|
||||||
tempmetadata = NULL;
|
|
||||||
gst_tag_list_foreach ((GstTagList *) shout2send->tags,
|
gst_tag_list_foreach ((GstTagList *) shout2send->tags,
|
||||||
set_shout_metadata, (gpointer) & tempmetadata);
|
set_shout_metadata, &shout2send->songmetadata);
|
||||||
if (tempmetadata) {
|
if (shout2send->songmetadata) {
|
||||||
GST_DEBUG ("shout metadata now: %s", tempmetadata);
|
shout_metadata_t *pmetadata;
|
||||||
|
|
||||||
|
GST_DEBUG ("shout metadata now: %s", shout2send->songmetadata);
|
||||||
pmetadata = shout_metadata_new ();
|
pmetadata = shout_metadata_new ();
|
||||||
shout_metadata_add (pmetadata, "song", tempmetadata);
|
shout_metadata_add (pmetadata, "song", shout2send->songmetadata);
|
||||||
shout_set_metadata (shout2send->conn, pmetadata);
|
shout_set_metadata (shout2send->conn, pmetadata);
|
||||||
shout_metadata_free (pmetadata);
|
shout_metadata_free (pmetadata);
|
||||||
}
|
}
|
||||||
|
@ -380,7 +379,16 @@ gst_shout2send_render (GstBaseSink * sink, GstBuffer * buf)
|
||||||
if (shout_open (shout2send->conn) == SHOUTERR_SUCCESS) {
|
if (shout_open (shout2send->conn) == SHOUTERR_SUCCESS) {
|
||||||
g_print ("connected to server...\n");
|
g_print ("connected to server...\n");
|
||||||
/* lets set metadata */
|
/* lets set metadata */
|
||||||
gst_shout2send_set_metadata (shout2send);
|
if (shout2send->songmetadata) {
|
||||||
|
shout_metadata_t *pmetadata;
|
||||||
|
|
||||||
|
GST_DEBUG ("shout metadata now: %s", shout2send->songmetadata);
|
||||||
|
pmetadata = shout_metadata_new ();
|
||||||
|
shout_metadata_add (pmetadata, "song", shout2send->songmetadata);
|
||||||
|
shout_set_metadata (shout2send->conn, pmetadata);
|
||||||
|
shout_metadata_free (pmetadata);
|
||||||
|
}
|
||||||
|
|
||||||
shout2send->started = TRUE;
|
shout2send->started = TRUE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -687,6 +695,8 @@ gst_shout2send_change_state (GstElement * element, GstStateChange transition)
|
||||||
shout_close (shout2send->conn);
|
shout_close (shout2send->conn);
|
||||||
shout_free (shout2send->conn);
|
shout_free (shout2send->conn);
|
||||||
shout2send->started = FALSE;
|
shout2send->started = FALSE;
|
||||||
|
g_free (shout2send->songmetadata);
|
||||||
|
shout2send->songmetadata = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct _GstShout2send {
|
||||||
gchar *url;
|
gchar *url;
|
||||||
gboolean sync;
|
gboolean sync;
|
||||||
gboolean started;
|
gboolean started;
|
||||||
|
gchar *songmetadata;
|
||||||
|
|
||||||
guint16 audio_format;
|
guint16 audio_format;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue