diff options
| author | Tim-Philipp Müller <tim@centricular.net> | 2007-10-11 16:41:44 +0000 | 
|---|---|---|
| committer | Tim-Philipp Müller <tim@centricular.net> | 2007-10-11 16:41:44 +0000 | 
| commit | a16be6f13a90c31c01f41aa524748a5454a617bf (patch) | |
| tree | 116a87fa4a8545925045991ec2a52384b2822464 | |
| parent | 3ca2d477b2e8f051a54ea1f781f97f14c88971e2 (diff) | |
ext/taglib/gstid3v2mux.cc: Add support for license/copyright URI tags (ID3v2 WCOP frame).
Original commit message from CVS:
* ext/taglib/gstid3v2mux.cc:
Add support for license/copyright URI tags (ID3v2 WCOP frame).
Prerequisite for #447000.
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | ext/taglib/gstid3v2mux.cc | 47 | 
2 files changed, 52 insertions, 1 deletions
| @@ -1,3 +1,9 @@ +2007-10-11  Tim-Philipp Müller  <tim at centricular dot net> + +	* ext/taglib/gstid3v2mux.cc: +	  Add support for license/copyright URI tags (ID3v2 WCOP frame). +	  Prerequisite for #447000. +  2007-10-08  Jan Schmidt  <Jan.Schmidt@sun.com>  	* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_flush): diff --git a/ext/taglib/gstid3v2mux.cc b/ext/taglib/gstid3v2mux.cc index ecc9f22a..6cf742de 100644 --- a/ext/taglib/gstid3v2mux.cc +++ b/ext/taglib/gstid3v2mux.cc @@ -61,6 +61,8 @@  #include <uniquefileidentifierframe.h>  #include <attachedpictureframe.h>  #include <commentsframe.h> +#include <unknownframe.h> +#include <id3v2synchdata.h>  #include <id3v2tag.h>  #include <gst/tag/tag.h> @@ -515,6 +517,47 @@ add_text_tag (ID3v2::Tag * id3v2tag, const GstTagList * list,    }  } +static void +add_uri_tag (ID3v2::Tag * id3v2tag, const GstTagList * list, +    const gchar * tag, guint num_tags, const gchar * frame_id) +{ +  gchar *url = NULL; + +  g_assert (frame_id != NULL); + +  /* URI tags are limited to one of each per taglist */ +  if (gst_tag_list_get_string_index (list, tag, 0, &url) && url != NULL) { +    guint url_len; + +    url_len = strlen (url); +    if (url_len > 0 && gst_uri_is_valid (url)) { +      ID3v2::FrameFactory * factory = ID3v2::FrameFactory::instance (); +      ID3v2::Frame * frame; +      char *data; + +      data = g_new0 (char, 10 + url_len); + +      memcpy (data, frame_id, 4); +      memcpy (data + 4, ID3v2::SynchData::fromUInt (url_len).data (), 4); +      memcpy (data + 10, url, url_len); +      ByteVector bytes (data, 10 + url_len); + +      g_free (data); + +      frame = factory->createFrame (bytes, (TagLib::uint) 4); +      if (frame) { +        id3v2tag->addFrame (frame); + +        GST_LOG ("%s: %s = '%s'", frame_id, tag, url); +      } +    } else { +      GST_WARNING ("Tag %s does not contain a valid URI (%s)", tag, url); +    } + +    g_free (url); +  } +} +  /* id3demux produces these for frames it cannot parse */  #define GST_ID3_DEMUX_TAG_ID3V2_FRAME "private-id3v2-frame" @@ -548,7 +591,9 @@ static const struct    GST_TAG_ALBUM_VOLUME_NUMBER, add_count_or_num_tag, "TPOS"}, {    GST_TAG_ALBUM_VOLUME_COUNT, add_count_or_num_tag, "TPOS"}, {    GST_TAG_ENCODER, add_encoder_tag, ""}, { -  GST_TAG_ENCODER_VERSION, add_encoder_tag, ""} +  GST_TAG_ENCODER_VERSION, add_encoder_tag, ""}, { +  GST_TAG_COPYRIGHT_URI, add_uri_tag, "WCOP"}, { +  GST_TAG_LICENSE_URI, add_uri_tag, "WCOP"}  }; | 
