/* called from the admin interface, here we update the artist/title info * and schedule a new set of header pages */ static void vorbis_set_tag (format_plugin_t *plugin, const char *tag, const char *in_value, const char *charset) { ogg_state_t *ogg_info = plugin->_state; ogg_codec_t *codec = ogg_info->codecs; vorbis_codec_t *source_vorbis; char *value; /* avoid url updates unless allowed to */ if (ogg_info->use_url_metadata == 0) return; /* avoid updating if multiple codecs in use */ if (codec && codec->next == NULL) source_vorbis = codec->specific; else return; if (tag == NULL) { source_vorbis->stream_notify = 1; source_vorbis->rebuild_comment = 1; return; } value = util_conv_string (in_value, charset, "UTF-8"); if (value == NULL && in_value) value = strdup (in_value); if (strcmp (tag, "artist") == 0) { free (ogg_info->artist); ogg_info->artist = value; } else if (strcmp (tag, "title") == 0) { free (ogg_info->title); ogg_info->title = value; } else if (strcmp (tag, "song") == 0) { free (ogg_info->title); ogg_info->title = value; } else free (value); }
static void mp3_set_tag (format_plugin_t *plugin, const char *tag, const char *in_value, const char *charset) { mp3_state *source_mp3 = plugin->_state; char *value = NULL; /* protect against multiple updaters */ thread_mutex_lock (&source_mp3->url_lock); if (tag==NULL) { source_mp3->update_metadata = 1; thread_mutex_unlock (&source_mp3->url_lock); return; } if (in_value) { value = util_conv_string (in_value, charset, plugin->charset); if (value == NULL) value = strdup (in_value); } if (strcmp (tag, "title") == 0 || strcmp (tag, "song") == 0) { free (source_mp3->url_title); source_mp3->url_title = value; } else if (strcmp (tag, "artist") == 0) { free (source_mp3->url_artist); source_mp3->url_artist = value; } else if (strcmp (tag, "url") == 0) { free (source_mp3->url); source_mp3->url = value; } else free (value); thread_mutex_unlock (&source_mp3->url_lock); }