mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
configure.ac: Require CVS of GStreamer core and -base (for
Original commit message from CVS: * configure.ac: Require CVS of GStreamer core and -base (for GST_TAG_EXTENDED_COMMENT and gst_tag_parse_extended_comment()). * ext/taglib/gstid3v2mux.cc: Write extended comment tags properly (#348762). * gst/id3demux/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame): Extract COMM frames into extended comments, which makes it easier to properly retain the description bit of the tag and maintain this information when re-tagging (#348762).
This commit is contained in:
parent
e501141c75
commit
81d46b8277
4 changed files with 72 additions and 25 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2006-08-16 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* configure.ac:
|
||||
Require CVS of GStreamer core and -base (for
|
||||
GST_TAG_EXTENDED_COMMENT and gst_tag_parse_extended_comment()).
|
||||
|
||||
* ext/taglib/gstid3v2mux.cc:
|
||||
Write extended comment tags properly (#348762).
|
||||
|
||||
* gst/id3demux/id3v2frames.c: (id3demux_id3v2_parse_frame),
|
||||
(parse_comment_frame):
|
||||
Extract COMM frames into extended comments, which makes it
|
||||
easier to properly retain the description bit of the tag
|
||||
and maintain this information when re-tagging (#348762).
|
||||
|
||||
2006-08-16 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* tests/check/Makefile.am:
|
||||
|
|
|
@ -44,8 +44,8 @@ dnl AS_LIBTOOL_TAGS
|
|||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl *** required versions of GStreamer stuff ***
|
||||
GST_REQ=0.10.8
|
||||
GSTPB_REQ=0.10.5.1
|
||||
GST_REQ=0.10.9.1
|
||||
GSTPB_REQ=0.10.9.1
|
||||
|
||||
dnl *** autotools stuff ****
|
||||
|
||||
|
|
|
@ -458,21 +458,34 @@ add_comment_tag (ID3v2::Tag * id3v2tag, const GstTagList * list,
|
|||
|
||||
if (gst_tag_list_get_string_index (list, tag, n, &s) && s != NULL) {
|
||||
ID3v2::CommentsFrame * f;
|
||||
gchar *desc;
|
||||
gchar *desc = NULL, *val = NULL, *lang = NULL;
|
||||
|
||||
GST_LOG ("%s[%u] = '%s'", tag, n, s);
|
||||
f = new ID3v2::CommentsFrame (String::UTF8);
|
||||
|
||||
/* FIXME: we should somehow try to preserve the original descriptions */
|
||||
desc = g_strdup_printf ("c%u", n);
|
||||
f->setDescription (desc);
|
||||
g_free (desc);
|
||||
if (strcmp (tag, GST_TAG_COMMENT) == 0 ||
|
||||
!gst_tag_parse_extended_comment (s, &desc, &lang, &val, TRUE)) {
|
||||
/* create dummy description to allow for multiple comment frames
|
||||
* (taglib will drop comment frames if descriptions are not unique) */
|
||||
desc = g_strdup_printf ("c%u", n);
|
||||
val = g_strdup (s);
|
||||
}
|
||||
|
||||
f->setText (s);
|
||||
g_free (s);
|
||||
GST_LOG ("%s[%u] = '%s' (%s|%s|%s)", tag, n, s, GST_STR_NULL (desc),
|
||||
GST_STR_NULL (lang), GST_STR_NULL (val));
|
||||
|
||||
f->setDescription (desc);
|
||||
f->setText (val);
|
||||
if (lang) {
|
||||
f->setLanguage (lang);
|
||||
}
|
||||
|
||||
g_free (lang);
|
||||
g_free (desc);
|
||||
g_free (val);
|
||||
|
||||
id3v2tag->addFrame (f);
|
||||
}
|
||||
g_free (s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,6 +533,7 @@ static const struct
|
|||
GST_TAG_COPYRIGHT, add_text_tag, "TCOP"}, {
|
||||
GST_TAG_GENRE, add_text_tag, "TCON"}, {
|
||||
GST_TAG_COMMENT, add_comment_tag, ""}, {
|
||||
GST_TAG_EXTENDED_COMMENT, add_comment_tag, ""}, {
|
||||
GST_TAG_DATE, add_date_tag, ""}, {
|
||||
GST_TAG_IMAGE, add_image_tag, ""}, {
|
||||
GST_TAG_PREVIEW_IMAGE, add_image_tag, ""}, {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (id3demux_debug);
|
||||
#define GST_CAT_DEFAULT (id3demux_debug)
|
||||
|
||||
static gchar *parse_comment_frame (ID3TagsWorking * work);
|
||||
static gboolean parse_comment_frame (ID3TagsWorking * work);
|
||||
static GArray *parse_text_identification_frame (ID3TagsWorking * work);
|
||||
static gchar *parse_user_text_identification_frame (ID3TagsWorking * work,
|
||||
const gchar ** tag_name);
|
||||
|
@ -156,7 +156,7 @@ id3demux_id3v2_parse_frame (ID3TagsWorking * work)
|
|||
}
|
||||
} else if (!strcmp (work->frame_id, "COMM")) {
|
||||
/* Comment */
|
||||
tag_str = parse_comment_frame (work);
|
||||
result = parse_comment_frame (work);
|
||||
} else if (!strcmp (work->frame_id, "APIC")) {
|
||||
/* Attached picture */
|
||||
result = parse_picture_frame (work);
|
||||
|
@ -195,17 +195,17 @@ id3demux_id3v2_parse_frame (ID3TagsWorking * work)
|
|||
return result;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
static gboolean
|
||||
parse_comment_frame (ID3TagsWorking * work)
|
||||
{
|
||||
guint dummy;
|
||||
guint8 encoding;
|
||||
gchar language[4];
|
||||
GArray *fields = NULL;
|
||||
gchar *out_str = NULL;
|
||||
gchar *description, *text;
|
||||
|
||||
if (work->parse_size < 6)
|
||||
return NULL;
|
||||
return FALSE;
|
||||
|
||||
encoding = work->parse_data[0];
|
||||
language[0] = work->parse_data[1];
|
||||
|
@ -226,19 +226,37 @@ parse_comment_frame (ID3TagsWorking * work)
|
|||
if (!g_utf8_validate (text, -1, NULL)) {
|
||||
GST_WARNING ("Converted string is not valid utf-8");
|
||||
goto fail;
|
||||
} else {
|
||||
if (strlen (description) > 0 && g_utf8_validate (description, -1, NULL)) {
|
||||
out_str = g_strdup_printf ("Description: %s\nComment: %s",
|
||||
description, text);
|
||||
} else {
|
||||
out_str = g_strdup (text);
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
free_tag_strings (fields);
|
||||
/* skip our own dummy descriptions (from id3v2mux) */
|
||||
if (strlen (description) > 0 && g_utf8_validate (description, -1, NULL) &&
|
||||
sscanf (description, "c%u", &dummy) != 1) {
|
||||
gchar *s;
|
||||
|
||||
return out_str;
|
||||
if (language[0] != '\0') {
|
||||
s = g_strdup_printf ("%s[%s]=%s", description, language, text);
|
||||
} else {
|
||||
s = g_strdup_printf ("%s=%s", description, text);
|
||||
}
|
||||
gst_tag_list_add (work->tags, GST_TAG_MERGE_APPEND,
|
||||
GST_TAG_EXTENDED_COMMENT, s, NULL);
|
||||
g_free (s);
|
||||
} else if (text != NULL && *text != '\0') {
|
||||
gst_tag_list_add (work->tags, GST_TAG_MERGE_APPEND,
|
||||
GST_TAG_COMMENT, text, NULL);
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
free_tag_strings (fields);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
{
|
||||
GST_WARNING ("failed to parse COMM frame");
|
||||
free_tag_strings (fields);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static GArray *
|
||||
|
|
Loading…
Reference in a new issue