[Icecast-dev] Logging album info for ogg-vorbis

Aaron Gutierrez aaron.gutierrez at gmail.com
Fri Jul 20 00:06:15 PDT 2007


For our source clients, I use mpd, ices, ezstream, vlc media player, and
oddcast.  They all have very unique advantages and disadvantages, which is
why we use so many.  It would be great to build one *super* icecast source
client that could do what all of those other ones do (but not really
feasible I suppose).  Among these clients, Oddcast doesn't send out album
metadata, but it is the one we use for streaming a live input.  For
streaming ogg vorbis, oddcast inserts the metadata directly into the vorbis
header.  But another way to set metadata would be to send an admin command
to icecast to update the metadata (i believe this is what libshout does).
However, icecast allows you to only set the Trackname or the Artist and
Trackname.  If needed, it would be very easy to update icecast to accept an
album value as well.  I believe then you could use libshout with no
modifications to update the album metadata.



On 3/26/07, Matthias Behnisch <mat at 4freax.net> wrote:
>
> Hi Aaron
>
> thats interesting, I made a similar change to icecast some time ago
> myself. It writes ALL metadata to the log, not only ARTIST and TRACK. We
> wanted to include more information into the playlist of our radio but
> unfortunately we discovered that oddcast doesn't send more than ARTIST
> and TRACK... so I am looking for something that sends really everything.
> What do you use as your stream source?
>
> If you or someone else has interest I included a patch against
> icecast-2.3.1. yeah, I know its kind of a dirty.
>
> Matthias
>
> Aaron Gutierrez schrieb:
> > Hi, i just joined the list.  I was wondering if anyone would be
> > interested in a change to icecast that logs album info as well as ARTST
> > and TRACK.  I have made the changes to the source code and it's working
> > fine.   If there is any interest, I could look into making it an
> > addition to the code.
> >
> > Let me know.
> >
> >
> > thanks,
> >
> >
> >
> > --
> > Aaron
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Icecast-dev mailing list
> > Icecast-dev at xiph.org
> > http://lists.xiph.org/mailman/listinfo/icecast-dev
>
> diff -aur icecast-2.3.1/src/format_ogg.c icecast-2.3.1-modified
> /src/format_ogg.c
> --- icecast-2.3.1/src/format_ogg.c      2005-08-19 04:01:58.000000000+0200
> +++ icecast-2.3.1-modified/src/format_ogg.c     2007-03-26 23:24:
> 51.000000000 +0200
> @@ -184,12 +184,17 @@
> void format_ogg_free_plugin (format_plugin_t *plugin)
> {
>      ogg_state_t *state = plugin->_state;
> +    int i;
>
>      /* free memory associated with this plugin instance */
>      free_ogg_codecs (state);
>      free (state->artist);
>      free (state->title);
>
> +    for(i=0; i < state->metadata_count; ++i)
> +      free(state->metadata[i]);
> +    free(state->metadata);
> +
>      ogg_sync_clear (&state->oy);
>      free (state);
>
> @@ -268,6 +273,7 @@
>      unsigned int len = 1; /* space for the nul byte at least */
>      ogg_codec_t *codec;
>      char codec_names [100] = "";
> +    int i;
>
>      if (ogg_info->artist)
>      {
> @@ -293,6 +299,17 @@
>              snprintf (metadata, len, "%s", title);
>          }
>      }
> +
> +    if (ogg_info->metadata_count > 0) {
> +      len += ogg_info->metadata_len;
> +      if(metadata) metadata = realloc(metadata,len);
> +      else metadata = calloc(1,len);
> +      for(i=0; i < ogg_info->metadata_count; ++i) {
> +       strcat(metadata,"|");
> +       strcat(metadata,ogg_info->metadata[i]);
> +      }
> +    }
> +
>      if (metadata)
>      {
>          logging_playlist (source->mount, metadata, source->listeners);
>
> diff -aur icecast-2.3.1/src/format_ogg.h icecast-2.3.1-modified
> /src/format_ogg.h
> --- icecast-2.3.1/src/format_ogg.h      2005-08-19 04:01:58.000000000+0200
> +++ icecast-2.3.1-modified/src/format_ogg.h     2007-03-26 23:15:
> 51.000000000 +0200
> @@ -41,6 +41,11 @@
>      long bitrate;
>      struct ogg_codec_tag *current;
>      struct ogg_codec_tag *codec_sync;
> +
> +  char **metadata;
> +  int metadata_count;
> +  int metadata_len;
> +
> } ogg_state_t;
>
>
> diff -aur icecast-2.3.1/src/format_vorbis.c icecast-2.3.1-modified
> /src/format_vorbis.c
> --- icecast-2.3.1/src/format_vorbis.c   2005-11-30 19:16:17.000000000+0100
> +++ icecast-2.3.1-modified/src/format_vorbis.c  2007-03-26 23:27:
> 23.000000000 +0200
> @@ -511,6 +511,8 @@
>      vorbis_codec_t *source_vorbis = codec->specific;
>      char *comment;
>
> +    int i;
> +
>      if (ogg_stream_pagein (&codec->os, page) < 0)
>      {
>          ogg_info->error = 1;
> @@ -565,6 +567,21 @@
>          format_ogg_attach_header (ogg_info, page);
>          codec->process_page = process_vorbis_passthru_page;
>      }
> +
> +    //free previous comment fields
> +    for(i=0; i < ogg_info->metadata_count; ++i)
> +      free(ogg_info->metadata[i]);
> +    free(ogg_info->metadata);
> +
> +    ogg_info->metadata = calloc(source_vorbis->vc.comments
> ,sizeof(char*));
> +
> +    //copy all comment fields
> +    ogg_info->metadata_count = source_vorbis->vc.comments;
> +    ogg_info->metadata_len = source_vorbis->vc.comments;  //space for tag
> separators
> +    for(i=0; i < source_vorbis->vc.comments; ++i) {
> +      ogg_info->metadata[i] = strdup(source_vorbis->vc.user_comments[i]);
> +      ogg_info->metadata_len += source_vorbis->vc.comment_lengths[i];
> +    }
>
>      free (ogg_info->title);
>      comment = vorbis_comment_query (&source_vorbis->vc, "TITLE", 0);
> @@ -573,6 +590,7 @@
>      else
>          ogg_info->title = NULL;
>
> +
>      free (ogg_info->artist);
>      comment = vorbis_comment_query (&source_vorbis->vc, "ARTIST", 0);
>      if (comment)
>
>


-- 
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/icecast-dev/attachments/20070720/0cb0b5bc/attachment.html


More information about the Icecast-dev mailing list