[easytag/wip/unstable: 20/22] Do not write COMMENT field for Vorbis and FLAC
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/unstable: 20/22] Do not write COMMENT field for Vorbis and FLAC
- Date: Mon, 11 Feb 2013 19:48:45 +0000 (UTC)
commit 3ec379bbd8796654cabf4e77e0cb044c905cbb83
Author: David King <amigadave amigadave com>
Date: Sat Jan 12 15:44:08 2013 +0000
Do not write COMMENT field for Vorbis and FLAC
DESCRIPTION is the field in the Vorbis comment specification for "a
short text description of the contents" and so it should be used. The
COMMENT field is not present in the specification. Fixes bug 690297.
TODO | 1 +
src/flac_tag.c | 32 ++++----------------------------
src/ogg_tag.c | 11 ++---------
3 files changed, 7 insertions(+), 37 deletions(-)
---
diff --git a/TODO b/TODO
index ef97ba6..a0ff403 100644
--- a/TODO
+++ b/TODO
@@ -17,6 +17,7 @@ General tidying
* Use g_spawn_async() or g_app_info_launch() to spawn processes
* Check usage and casting away of const
* Check C-style casts for errors
+* Remove XMMS Vorbis comment compatibility
After GTK+ 3
------------
diff --git a/src/flac_tag.c b/src/flac_tag.c
index 9d8b09f..f8b2bcd 100644
--- a/src/flac_tag.c
+++ b/src/flac_tag.c
@@ -62,7 +62,6 @@
* - ARTIST : Track performer
* - ORGANIZATION : Name of the organization producing the track (i.e. the 'record label')
* - DESCRIPTION : A short text description of the contents
- * - COMMENT : same than DESCRIPTION
* - GENRE : A short text indication of music genre
* - DATE : Date the track was recorded
* - LOCATION : Location where track was recorded
@@ -421,28 +420,8 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
* Comment *
***********/
field_num = 0;
- while ( 1 )
+ while ((field_num = FLAC__metadata_object_vorbiscomment_find_entry_from (block, field_num, "DESCRIPTION")) >= 0)
{
- gint field_num1, field_num2;
-
- // The comment field can take two forms...
- field_num1 = FLAC__metadata_object_vorbiscomment_find_entry_from(block,field_num,"DESCRIPTION");
- field_num2 = FLAC__metadata_object_vorbiscomment_find_entry_from(block,field_num,"COMMENT");
-
- if (field_num1 >= 0 && field_num2 >= 0)
- // Note : We set field_num to the last "comment" field to avoid to concatenate
- // the DESCRIPTION and COMMENT field if there are both present (EasyTAG writes the both...)
- if (field_num1 < field_num2)
- field_num = field_num2;
- else
- field_num = field_num1;
- else if (field_num1 >= 0)
- field_num = field_num1;
- else if (field_num2 >= 0)
- field_num = field_num2;
- else
- break;
-
/* Extract field value */
field = &vc->comments[field_num++];
field_value = memchr(field->entry, '=', field->length);
@@ -456,10 +435,10 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
field_value_tmp = g_strndup(field_value, field_len);
field_value = Try_To_Validate_Utf8_String(field_value_tmp);
g_free(field_value_tmp);
- if (FileTag->comment==NULL)
- FileTag->comment = g_strdup(field_value);
+ if (FileTag->comment == NULL)
+ FileTag->comment = g_strdup (field_value);
else
- FileTag->comment = g_strconcat(FileTag->comment,MULTIFIELD_SEPARATOR,field_value,NULL);
+ FileTag->comment = g_strconcat(FileTag->comment, MULTIFIELD_SEPARATOR, field_value, NULL);
g_free(field_value);
}
}
@@ -621,7 +600,6 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
&& strncasecmp((gchar *)field->entry,"TRACKTOTAL=", MIN(11, field->length)) != 0
&& strncasecmp((gchar *)field->entry,"GENRE=", MIN(6, field->length)) != 0
&& strncasecmp((gchar *)field->entry,"DESCRIPTION=", MIN(12, field->length)) != 0
- && strncasecmp((gchar *)field->entry,"COMMENT=", MIN(8, field->length)) != 0
&& strncasecmp((gchar *)field->entry,"COMPOSER=", MIN(9, field->length)) != 0
&& strncasecmp((gchar *)field->entry,"PERFORMER=", MIN(10, field->length)) != 0
&& strncasecmp((gchar *)field->entry,"COPYRIGHT=", MIN(10, field->length)) != 0
@@ -971,9 +949,7 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
/***********
* Comment *
***********/
- // We write the comment using the "both" format
Flac_Set_Tag(vc_block,"DESCRIPTION=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
- Flac_Set_Tag(vc_block,"COMMENT=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
/************
* Composer *
diff --git a/src/ogg_tag.c b/src/ogg_tag.c
index e6fe6e1..a697dae 100644
--- a/src/ogg_tag.c
+++ b/src/ogg_tag.c
@@ -99,7 +99,6 @@
* PART : a division within a work; eg, a movement of a symphony. Some tracks contain several parts. Use a single PART tag for each part contained in a track. ie, PART="Oh sole mio"
* PARTNUMBER : The part number goes in here. You can use any format you like, such as Roman numerals, regular numbers, or whatever. The numbers should be entered in such a way that an alphabetical sort on this tag will correctly show the proper ordering of all the oggs that contain the contain the piece of music.
* LOCATION : location of recording, or other location of interest
- * COMMENT : additional comments of any nature.
*/
@@ -356,7 +355,6 @@ gboolean Ogg_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
field_num = 0;
string1 = NULL; // Cause it may be not updated into the 'while' condition
while ( ((string2 = vorbis_comment_query(vc,"DESCRIPTION",field_num)) != NULL ) // New specifications
- || ((string = vorbis_comment_query(vc,"COMMENT", field_num)) != NULL ) // Old : Winamp format (for EasyTAG 1.99.11 and older)
|| ((string1 = vorbis_comment_query(vc,"", field_num)) != NULL ) ) // Old : Xmms format (for EasyTAG 1.99.11 and older)
{
string = Try_To_Validate_Utf8_String(string);
@@ -557,7 +555,6 @@ gboolean Ogg_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
&& strncasecmp(vc->user_comments[i],"TRACKTOTAL=", 11) != 0
&& strncasecmp(vc->user_comments[i],"GENRE=", 6) != 0
&& strncasecmp(vc->user_comments[i],"DESCRIPTION=", 12) != 0
- && strncasecmp(vc->user_comments[i],"COMMENT=", 8) != 0
&& strncasecmp(vc->user_comments[i],"=", 1) != 0
&& strncasecmp(vc->user_comments[i],"COMPOSER=", 9) != 0
&& strncasecmp(vc->user_comments[i],"PERFORMER=", 10) != 0
@@ -744,16 +741,12 @@ gboolean Ogg_Tag_Write_File_Tag (ET_File *ETFile)
/***********
* Comment *
***********/
- // We write the comment using the two formats "DESCRIPTION" and "COMMENT" to be compatible with old versions
- // Format of new specification
+ /* Format of new specification. */
Ogg_Set_Tag(vc,"DESCRIPTION=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
- // Format used in winamp plugin
- Ogg_Set_Tag(vc,"COMMENT=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
-
if (OGG_TAG_WRITE_XMMS_COMMENT)
{
- // Format used into xmms-1.2.5
+ /* Format used with xmms-1.2.5. */
Ogg_Set_Tag(vc,"=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]