From 3acef0a88cf9a9635f60dab16f7b41fdaf4be9fe Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 22 Feb 2004 15:14:25 +0000 Subject: [PATCH] configure.ac: export [_]*{gst,Gst,GST}.* symbols from plugins Original commit message from CVS: 2004-02-22 Benjamin Otte * configure.ac: export [_]*{gst,Gst,GST}.* symbols from plugins 2004-02-22 Christophe Fergeau reviewed by: Benjamin Otte * ext/lame/gstlame.c: (add_one_tag): * ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list): * ext/vorbis/vorbisenc.c: (gst_vorbisenc_get_tag_value), (gst_vorbisenc_metadata_set1): * gst/tags/gstid3tag.c: * gst/tags/gstvorbistag.c: (gst_vorbis_tag_add): apply fixes from bugs #135042 (lame can't write tags) and #133817 (add GST_ALBUM_VOLUME_{COUNT,NUMBER} tags) --- ChangeLog | 19 +++++++ configure.ac | 2 +- ext/vorbis/vorbisenc.c | 120 ++++++++++++++++------------------------ gst/tags/gstid3tag.c | 1 + gst/tags/gstvorbistag.c | 16 +++++- 5 files changed, 84 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d46dc6640..ead95afa78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,23 @@ +2004-02-22 Benjamin Otte + + * configure.ac: + export [_]*{gst,Gst,GST}.* symbols from plugins + +2004-02-22 Christophe Fergeau + + reviewed by: Benjamin Otte + + * ext/lame/gstlame.c: (add_one_tag): + * ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list): + * ext/vorbis/vorbisenc.c: (gst_vorbisenc_get_tag_value), + (gst_vorbisenc_metadata_set1): + * gst/tags/gstid3tag.c: + * gst/tags/gstvorbistag.c: (gst_vorbis_tag_add): + apply fixes from bugs #135042 (lame can't write tags) and #133817 + (add GST_ALBUM_VOLUME_{COUNT,NUMBER} tags) + 2004-02-22 Ramon Garcia + * configure.ac: Export only gst_plugin_desc from plugins. Note that this change only makes any effect with Linux using libtool 1.5.2 or higher. Otherwise it is silently ignored, but it would build diff --git a/configure.ac b/configure.ac index 1cc668fc5e..9c6910ebcf 100644 --- a/configure.ac +++ b/configure.ac @@ -326,7 +326,7 @@ dnl =========================================================================== plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" AC_SUBST(plugindir) -GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex gst_plugin_desc' +GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*{gst_,Gst,GST_}.*' AC_SUBST(GST_PLUGIN_LDFLAGS) dnl these are all the gst plug-ins, compilable without additional libs diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 52c1dc2237..6dbedce31a 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -27,6 +27,7 @@ #include #include +#include #include "vorbisenc.h" static GstPadTemplate *gst_vorbisenc_src_template, *gst_vorbisenc_sink_template; @@ -462,87 +463,64 @@ gst_vorbisenc_init (VorbisEnc * vorbisenc) GST_FLAG_SET (vorbisenc, GST_ELEMENT_EVENT_AWARE); } + +static gchar * +gst_vorbisenc_get_tag_value (const GstTagList *list, const gchar *tag, int index) +{ + gchar *vorbisvalue = NULL; + + if (tag == NULL) { + return NULL; + } + + /* get tag name right */ + if ((strcmp (tag, GST_TAG_TRACK_NUMBER) == 0) + || (strcmp (tag, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) + || (strcmp (tag, GST_TAG_TRACK_COUNT) == 0) + || (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0)) { + guint track_no; + g_assert (gst_tag_list_get_uint_index (list, tag, index, &track_no)); + vorbisvalue = g_strdup_printf ("%u", track_no); + } else if (strcmp (tag, GST_TAG_DATE) == 0) { + /* FIXME: how are dates represented in vorbis files? */ + GDate *date; + guint u; + + g_assert (gst_tag_list_get_uint_index (list, tag, index, &u)); + date = g_date_new_julian (u); + vorbisvalue = g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date), + (gint) g_date_get_month (date), (gint) g_date_get_day (date)); + g_date_free (date); + } else if (gst_tag_get_type (tag) == G_TYPE_STRING) { + g_assert (gst_tag_list_get_string_index (list, tag, index, &vorbisvalue)); + } + + return vorbisvalue; +} + static void gst_vorbisenc_metadata_set1 (const GstTagList *list, const gchar *tag, gpointer vorbisenc) { - gchar *vorbistag = NULL; + const gchar *vorbistag = NULL; gchar *vorbisvalue = NULL; guint i, count; VorbisEnc *enc = GST_VORBISENC (vorbisenc); - count = gst_tag_list_get_tag_size (list, tag); - for (i = 0; i < count; i++) { - /* get tag name right */ - if (strcmp (tag, GST_TAG_TITLE) == 0) { - vorbistag = g_strdup ("TITLE"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_VERSION) == 0) { - vorbistag = g_strdup ("VERSION"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_ALBUM) == 0) { - vorbistag = g_strdup ("ALBUM"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_TRACK_NUMBER) == 0) { - guint track_no; - vorbistag = g_strdup ("TRACKNUMBER"); - g_assert (gst_tag_list_get_uint_index (list, tag, i, &track_no)); - vorbisvalue = g_strdup_printf ("%u", track_no); - } else if (strcmp (tag, GST_TAG_ARTIST) == 0) { - vorbistag = g_strdup ("ARTIST"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_PERFORMER) == 0) { - vorbistag = g_strdup ("PERFORMER"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_COPYRIGHT) == 0) { - vorbistag = g_strdup ("COPYRIGHT"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_LICENSE) == 0) { - vorbistag = g_strdup ("LICENSE"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_ORGANIZATION) == 0) { - vorbistag = g_strdup ("ORGANIZATION"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_DESCRIPTION) == 0) { - vorbistag = g_strdup ("DESCRIPTION"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_GENRE) == 0) { - vorbistag = g_strdup ("GENRE"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_DATE) == 0) { - /* FIXME: how are dates represented in vorbis files? */ - GDate *date; - guint u; - - vorbistag = g_strdup ("DATE"); - g_assert (gst_tag_list_get_uint_index (list, tag, i, &u)); - date = g_date_new_julian (u); - vorbisvalue = g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date), - (gint) g_date_get_month (date), (gint) g_date_get_day (date)); - g_date_free (date); - /* NOTE: GST_TAG_LOCATION != vorbis' location - } else if (strcmp (tag, PLACE) == 0) { - vorbistag = g_strdup ("LOCATION"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - */ - } else if (strcmp (tag, GST_TAG_CONTACT) == 0) { - vorbistag = g_strdup ("CONTACT"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else if (strcmp (tag, GST_TAG_ISRC) == 0) { - vorbistag = g_strdup ("ISRC"); - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else { - vorbistag = g_ascii_strup (tag, -1); - if (gst_tag_get_type (tag) == G_TYPE_STRING) { - g_assert (gst_tag_list_get_string_index (list, tag, i, &vorbisvalue)); - } else { - const GValue *value = gst_tag_list_get_value_index (list, tag, i); - vorbisvalue = g_strdup_value_contents (value); - } - } + vorbistag = gst_tag_to_vorbis_tag (tag); + if (vorbistag == NULL) { + return; } - vorbis_comment_add_tag (&enc->vc, vorbistag, vorbisvalue); + count = gst_tag_list_get_tag_size (list, tag); + for (i = 0; i < count; i++) { + vorbisvalue = gst_vorbisenc_get_tag_value (list, tag, i); + + if (vorbisvalue != NULL) { + vorbis_comment_add_tag (&enc->vc, g_strdup (vorbistag), vorbisvalue); + } + } } + static void gst_vorbisenc_set_metadata (VorbisEnc *vorbisenc) { diff --git a/gst/tags/gstid3tag.c b/gst/tags/gstid3tag.c index 871fbbdbea..2250f29da2 100644 --- a/gst/tags/gstid3tag.c +++ b/gst/tags/gstid3tag.c @@ -186,6 +186,7 @@ static GstTagEntryMatch tag_matches[] = { { GST_TAG_GENRE, "TCON" }, { GST_TAG_DATE, "TDRC" }, { GST_TAG_COMMENT, "COMM" }, + { GST_TAG_ALBUM_VOLUME_NUMBER, "TPOS" }, { NULL, NULL } }; /** diff --git a/gst/tags/gstvorbistag.c b/gst/tags/gstvorbistag.c index 9df5bf3687..f6f2ac7002 100644 --- a/gst/tags/gstvorbistag.c +++ b/gst/tags/gstvorbistag.c @@ -177,6 +177,9 @@ static GstTagEntryMatch tag_matches[] = { { GST_TAG_VERSION, "VERSION" }, { GST_TAG_ALBUM, "ALBUM" }, { GST_TAG_TRACK_NUMBER, "TRACKNUMBER" }, + { GST_TAG_ALBUM_VOLUME_NUMBER, "DISCNUMBER" }, + { GST_TAG_TRACK_COUNT, "TRACKTOTAL" }, + { GST_TAG_ALBUM_VOLUME_COUNT, "DISCTOTAL" }, { GST_TAG_ARTIST, "ARTIST" }, { GST_TAG_PERFORMER, "PERFORMER" }, { GST_TAG_COPYRIGHT, "COPYRIGHT" }, @@ -277,13 +280,22 @@ gst_vorbis_tag_add (GstTagList *list, const gchar *tag, const gchar *value) } else { guint tmp; gchar *check; + gboolean is_track_number_tag; + gboolean is_disc_number_tag; + + is_track_number_tag = (strcmp (gst_tag, GST_TAG_TRACK_NUMBER) == 0); + is_disc_number_tag = (strcmp (gst_tag, GST_TAG_ALBUM_VOLUME_NUMBER) == 0); tmp = strtoul (value, &check, 10); - if (*check == '/' && strcmp (gst_tag, GST_TAG_TRACK_NUMBER) == 0) { + if (*check == '/' && (is_track_number_tag || is_disc_number_tag)) { guint count; check++; count = strtoul (check, &check, 10); if (*check != '\0' || count == 0) break; - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_COUNT, count, NULL); + if (is_track_number_tag) { + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_COUNT, count, NULL); + } else { + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_ALBUM_VOLUME_COUNT, count, NULL); + } } if (*check != '\0') break; gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, tmp, NULL);