summaryrefslogtreecommitdiffstats
path: root/ext/taglib
diff options
context:
space:
mode:
authorAlex Lancaster <alexl@users.sourceforge.net>2006-07-19 11:52:53 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-07-19 11:52:53 +0000
commitdaab8f41933814eecd92aab4e736855847494df0 (patch)
treea8a8cdb43b7686ed0b1f1aa88aa2f8dbbe0ae5a9 /ext/taglib
parentcf49086d9d2f12cf2c5d88b4a96e2b78ef9c4bc1 (diff)
ext/taglib/gstid3v2mux.cc: Write GST_TAG_ENCODER and GST_TAG_ENCODER_VERSION as
Original commit message from CVS: Patch by: Alex Lancaster <alexl at users sourceforge net> * ext/taglib/gstid3v2mux.cc: Write GST_TAG_ENCODER and GST_TAG_ENCODER_VERSION as ID3v2 TSSE frames (#347898).
Diffstat (limited to 'ext/taglib')
-rw-r--r--ext/taglib/gstid3v2mux.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/ext/taglib/gstid3v2mux.cc b/ext/taglib/gstid3v2mux.cc
index 2f75b669..e0c15aa7 100644
--- a/ext/taglib/gstid3v2mux.cc
+++ b/ext/taglib/gstid3v2mux.cc
@@ -139,6 +139,23 @@ add_one_txxx_musicbrainz_tag (ID3v2::Tag * id3v2tag, const gchar * spec_id,
}
}
+#if 0
+static void
+add_one_txxx_tag (ID3v2::Tag * id3v2tag, const gchar * key, const gchar * val)
+{
+ ID3v2::UserTextIdentificationFrame * frame;
+
+ if (val == NULL)
+ return;
+
+ GST_DEBUG ("Setting %s to %s", key, val);
+ frame = new ID3v2::UserTextIdentificationFrame (String::UTF8);
+ id3v2tag->addFrame (frame);
+ frame->setDescription (key);
+ frame->setText (val);
+}
+#endif
+
static void
add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
{
@@ -307,6 +324,40 @@ add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
frame->setText (copyright);
g_free (copyright);
}
+ } else if (strcmp (tag, GST_TAG_ENCODER) == 0) {
+ gchar *encoder;
+
+ result = gst_tag_list_get_string_index (list, tag, 0, &encoder);
+
+ if (result != FALSE && encoder != NULL) {
+ ID3v2::TextIdentificationFrame * frame;
+ guint encoder_version;
+ gchar *tag_str;
+
+ frame = new ID3v2::TextIdentificationFrame ("TSSE", String::UTF8);
+ if (gst_tag_list_get_uint_index (list, GST_TAG_ENCODER_VERSION, 0,
+ &encoder_version) && encoder_version > 0) {
+ tag_str = g_strdup_printf ("%s %u", encoder, encoder_version);
+ } else {
+ tag_str = g_strdup (encoder);
+ }
+
+ GST_DEBUG ("Setting encoder to %s", tag_str);
+
+ id3v2tag->addFrame (frame);
+ frame->setText (tag_str);
+ g_free (tag_str);
+ g_free (encoder);
+ }
+ } else if (strcmp (tag, GST_TAG_ENCODER_VERSION) == 0) {
+ gchar *tmp_str = NULL;
+
+ if (gst_tag_list_get_string_index (list, GST_TAG_ENCODER, 0, &tmp_str)) {
+ GST_DEBUG ("encoder-version handled with encoder, skipping");
+ g_free (tmp_str);
+ } else {
+ GST_WARNING ("encoder-version, but no encoder?! skipping");
+ }
} else if (strcmp (tag, GST_TAG_MUSICBRAINZ_ARTISTID) == 0) {
gchar *id_str;
@@ -415,6 +466,18 @@ gst_id3v2_mux_render_tag (GstTagLibMux * mux, GstTagList * taglist)
/* Render the tag */
gst_tag_list_foreach (taglist, add_one_tag, &id3v2tag);
+#if 0
+ /* Do we want to add our own signature to the tag somewhere? */
+ {
+ gchar *tag_producer_str;
+
+ tag_producer_str = g_strdup_printf ("(GStreamer id3v2mux %s, using "
+ "taglib %u.%u)", VERSION, TAGLIB_MAJOR_VERSION, TAGLIB_MINOR_VERSION);
+ add_one_txxx_tag (id3v2tag, "tag_encoder", tag_producer_str);
+ g_free (tag_producer_str);
+ }
+#endif
+
rendered_tag = id3v2tag.render ();
tag_size = rendered_tag.size ();