[gstreamer-bugs] [Bug 399825] New: Tags don't work properly for shout2send plugin

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Tue Jan 23 08:01:01 PST 2007


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=399825

  GStreamer | gst-plugins-good | Ver: 0.10.11

           Summary: Tags don't work properly for shout2send plugin
           Product: GStreamer
           Version: 0.10.11
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: charlesg3 at gmail.com
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


When the shout2send plugin receives tags, it was previously appending the new
tags to a taglist, as such the tags were not getting updated properly. 

Additionally, while parsing the tags, the artist and title were getting
prepended and appended to a string which composed the "song name" for that
stream. As a result, the artist / title were getting repeated over and over.

Both of these issues have been fixed in the patches provided.

PATCH:

--- gstshout2.c 2006-05-10 04:29:53.000000000 -0600
+++ gstshout2.c.new     2007-01-23 08:58:49.000000000 -0700
@@ -256,14 +256,21 @@ gst_shout2send_init (GstShout2send * sho
   shout2send->audio_format = SHOUT_FORMAT_VORBIS;
   shout2send->connected = FALSE;
   shout2send->songmetadata = NULL;
+  shout2send->songartist = NULL;
+  shout2send->songtitle = NULL;
+
 }

 static void
 set_shout_metadata (const GstTagList * list, const gchar * tag,
     gpointer user_data)
 {
-  char **shout_metadata = (char **) user_data;
-  gchar *value, *temp;
+    GstShout2send *shout2send = (GstShout2send *)user_data;
+  char **shout_metadata = &(shout2send->songmetadata);
+  char **song_artist = &(shout2send->songartist);
+  char **song_title = &(shout2send->songtitle);
+
+  gchar *value;

   GST_DEBUG ("tag: %s being added", tag);
   if (strcmp (tag, GST_TAG_ARTIST) == 0) {
@@ -272,15 +279,11 @@ set_shout_metadata (const GstTagList * l
         GST_DEBUG ("Error reading \"%s\" tag value", tag);
         return;
       }
-      /* shout_metadata should be NULL if title is after artist in  list */
-      if (*shout_metadata == NULL) {
-        *shout_metadata = g_strdup (value);
-      } else {
-        temp = g_strdup_printf ("%s - %s", value, *shout_metadata);
-        g_free (*shout_metadata);
-        *shout_metadata = temp;
-      }

+      if(*song_artist != NULL)
+          g_free(*song_artist);
+
+      *song_artist = g_strdup(value);
     }
   } else if (strcmp (tag, GST_TAG_TITLE) == 0) {
     if (gst_tag_get_type (tag) == G_TYPE_STRING) {
@@ -288,16 +291,32 @@ set_shout_metadata (const GstTagList * l
         GST_DEBUG ("Error reading \"%s\" tag value", tag);
         return;
       }
-      /* shout_metadata should be NULL if title is before artist in  list */
-      if (*shout_metadata == NULL) {
-        *shout_metadata = g_strdup (value);
-      } else {
-        temp = g_strdup_printf ("%s - %s", *shout_metadata, value);
-        g_free (*shout_metadata);
-        *shout_metadata = temp;
-      }
+
+      if(*song_title != NULL)
+          g_free(*song_title);
+
+      *song_title = g_strdup(value);
     }
   }
+
+  if(*shout_metadata != NULL)
+      g_free(*shout_metadata);
+
+
+  if(*song_title && *song_artist)
+  {
+      *shout_metadata = g_strdup_printf("%s - %s", *song_artist, *song_title);
+  } else if(*song_title && *song_artist == NULL)
+  {
+      *shout_metadata = g_strdup_printf("Unknown - %s", *song_title);
+  } else if(*song_title == NULL && *song_artist)
+  {
+      *shout_metadata = g_strdup_printf("%s - Unknown", *song_artist);
+  } else
+  {
+      *shout_metadata = g_strdup_printf("Unknown - Unknown");
+  }
+
   GST_LOG ("shout metadata is now: %s", *shout_metadata);
 }

@@ -355,8 +374,8 @@ gst_shout2send_event (GstBaseSink * sink
             list,
             gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (shout2send)));
         /* lets get the artist and song tags */
-        gst_tag_list_foreach ((GstTagList *) shout2send->tags,
-            set_shout_metadata, &shout2send->songmetadata);
+        gst_tag_list_foreach ((GstTagList *) list,
+                set_shout_metadata, shout2send);
         if (shout2send->songmetadata && shout2send->connected) {
           shout_metadata_t *pmetadata;

--- gstshout2.h 2006-04-18 11:17:55.000000000 -0600
+++ gstshout2.h.new     2007-01-23 08:56:28.000000000 -0700
@@ -54,7 +54,8 @@ struct _GstShout2send {
   gchar *url;
   gboolean connected;
   gchar *songmetadata;
-
+  gchar *songartist;
+  gchar *songtitle;
   guint16 audio_format;

   GstTagList* tags;


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email




More information about the Gstreamer-bugs mailing list