gst/tags/gstvorbistag.c: Add replaygain support to vorbistag

Original commit message from CVS:
2004-02-02  Jeremy Simon  <jesimon@libertysurf.fr>
* gst/tags/gstvorbistag.c: (gst_vorbis_tag_add),
(gst_tag_to_vorbis_comments):
Add replaygain support to vorbistag
This commit is contained in:
Jeremy Simon 2004-02-02 22:42:42 +00:00
parent f921cef745
commit 99adadce8c
2 changed files with 34 additions and 16 deletions

View file

@ -1,3 +1,9 @@
2004-02-02 Jeremy Simon <jesimon@libertysurf.fr>
* gst/tags/gstvorbistag.c: (gst_vorbis_tag_add),
(gst_tag_to_vorbis_comments):
Add replaygain support to vorbistag
2004-02-02 Jeremy Simon <jesimon@libertysurf.fr>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_extradata):

View file

@ -173,22 +173,26 @@ gst_vorbis_tag_init (GTypeInstance *instance, gpointer g_class)
gst_element_add_pad (GST_ELEMENT (tag), tag->srcpad);
}
static GstTagEntryMatch tag_matches[] = {
{ GST_TAG_TITLE, "TITLE" },
{ GST_TAG_VERSION, "VERSION" },
{ GST_TAG_ALBUM, "ALBUM" },
{ GST_TAG_TRACK_NUMBER,"TRACKNUMBER" },
{ GST_TAG_ARTIST, "ARTIST" },
{ GST_TAG_PERFORMER, "PERFORMER" },
{ GST_TAG_COPYRIGHT, "COPYRIGHT" },
{ GST_TAG_LICENSE, "LICENSE" },
{ GST_TAG_ORGANIZATION,"ORGANIZATION" },
{ GST_TAG_DESCRIPTION,"DESCRIPTION" },
{ GST_TAG_GENRE, "GENRE" },
{ GST_TAG_DATE, "DATE" },
{ GST_TAG_CONTACT, "CONTACT" },
{ GST_TAG_ISRC, "ISRC" },
{ GST_TAG_COMMENT, "COMMENT" },
{ NULL, NULL }
{ GST_TAG_TITLE, "TITLE" },
{ GST_TAG_VERSION, "VERSION" },
{ GST_TAG_ALBUM, "ALBUM" },
{ GST_TAG_TRACK_NUMBER, "TRACKNUMBER" },
{ GST_TAG_ARTIST, "ARTIST" },
{ GST_TAG_PERFORMER, "PERFORMER" },
{ GST_TAG_COPYRIGHT, "COPYRIGHT" },
{ GST_TAG_LICENSE, "LICENSE" },
{ GST_TAG_ORGANIZATION, "ORGANIZATION" },
{ GST_TAG_DESCRIPTION, "DESCRIPTION" },
{ GST_TAG_GENRE, "GENRE" },
{ GST_TAG_DATE, "DATE" },
{ GST_TAG_CONTACT, "CONTACT" },
{ GST_TAG_ISRC, "ISRC" },
{ GST_TAG_COMMENT, "COMMENT" },
{ GST_TAG_TRACK_GAIN, "REPLAYGAIN_TRACK_GAIN" },
{ GST_TAG_TRACK_PEAK, "REPLAYGAIN_TRACK_PEAK" },
{ GST_TAG_ALBUM_GAIN, "REPLAYGAIN_ALBUM_GAIN" },
{ GST_TAG_ALBUM_PEAK, "REPLAYGAIN_ALBUM_PEAK" },
{ NULL, NULL }
};
/**
* gst_tag_from_vorbis_tag:
@ -288,6 +292,9 @@ gst_vorbis_tag_add (GstTagList *list, const gchar *tag, const gchar *value)
case G_TYPE_STRING:
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, value, NULL);
break;
case G_TYPE_DOUBLE:
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, g_strtod (value, NULL), NULL);
break;
default:
break;
}
@ -409,6 +416,11 @@ gst_tag_to_vorbis_comments (const GstTagList *list, const gchar *tag)
result = g_strdup_printf ("%s=%s", vorbis_tag, str);
break;
}
case G_TYPE_DOUBLE: {
gdouble value;
g_assert (gst_tag_list_get_double_index (list, tag, i, &value));
result = g_strdup_printf ("%s=%f", vorbis_tag, value);
}
default:
GST_DEBUG ("Couldn't write tag %s", tag);
continue;