karlheyes / icecast-kh

KH branch of icecast
GNU General Public License v2.0
300 stars 107 forks source link

Update of metadata for OGG streams is not implemented #38

Open jorisvandesande opened 11 years ago

jorisvandesande commented 11 years ago

When streaming an OGG stream via icecast, it is not possible to update the metadata of the stream. The update is triggered via the web interface at: /admin/metadata.xsl?song=xxxx&mount=/xxxx.ogg&mode=updinfo&charset=UTF-8

As far as I can see from the source code the hook to set the metadata is not implemented for OGG (plugin->set_tag = NULL; (line 170 in format_ogg.c).

However the update command responds with:

Message : Metadata update successful Return Code: 1

It would be great if this could be implemented for OGG. But if that's impossible, an error code should be returned when the metadata update is not supported for the current stream (in my opinion).

jorisvandesande commented 11 years ago

Is there anybody that can shed some light on this?

karlheyes commented 11 years ago

it should be possible when it's vorbis only, multiple codecs would disable it. It should be set up by default to allow it unless explicily disabled by a mount tag . The odd source client used to issue admin updates of metadata as well as in stream updates but I haven't checked the response set up in some time on this. It's low priority as I needed to get kh6 out of the way first, but not forgotten

karl.

jorisvandesande commented 11 years ago

Thanks for the insight. I might look into this if you could give me some pointers what needs to be changed for this to work. I know the basics of C/C++, but I haven't written a single line of C in the past few years.

jorisvandesande commented 11 years ago

I've been digging a little deeper into this. My conclusion is that the problem is in the process_vorbis_page function in format_vorbis.c. In that function the following code checks if the mount configuration option "admin_comments_only" is 0 (default). When it's 0 the metadata is always taken from the stream (overwriting any metadata that has been set via the update metadata command). This behaviour is a bit odd, as the "allow-url-ogg-metadata" might still have a value of 1.

    if (ogg_info->admin_comments_only == 0)
    {
        free (ogg_info->title);
        comment = vorbis_comment_query (&source_vorbis->vc, "TITLE", 0);
        if (comment)
            ogg_info->title = strdup (comment);
        else
            ogg_info->title = NULL;

        free (ogg_info->artist);
        comment = vorbis_comment_query (&source_vorbis->vc, "ARTIST", 0);
        if (comment)
            ogg_info->artist = strdup (comment);
        else
            ogg_info->artist = NULL;
    }

In my opinion the best solution is to use the metadata that has been set via the update metadata command, because this is explicitly called.