changeset 3027:3b200cf6d1b7

Support comment tag in FLAC files. By Brent Towe, resolves bug #4.
author Tony Vroon <chainsaw@gentoo.org>
date Fri, 10 Apr 2009 00:30:15 +0100
parents d49fca0fc7fd
children b20622733f08
files src/flacng/flacng.h src/flacng/tools.c
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/flacng/flacng.h	Fri Apr 10 00:12:59 2009 +0100
+++ b/src/flacng/flacng.h	Fri Apr 10 00:30:15 2009 +0100
@@ -65,6 +65,7 @@
     gchar* tracknumber;
     gchar* genre;
     gchar* date;
+    gchar* comment;
 };
 
 /*
--- a/src/flacng/tools.c	Fri Apr 10 00:12:59 2009 +0100
+++ b/src/flacng/tools.c	Fri Apr 10 00:30:15 2009 +0100
@@ -59,6 +59,7 @@
     info->comment.tracknumber = NULL;
     info->comment.genre = NULL;
     info->comment.date = NULL;
+    info->comment.comment = NULL;
     info->replaygain.ref_loud = NULL;
     info->replaygain.track_gain = NULL;
     info->replaygain.track_peak = NULL;
@@ -141,6 +142,11 @@
         info->comment.genre = NULL;
     }
 
+    if (NULL != info->comment.comment) {
+        free(info->comment.comment);
+        info->comment.comment = NULL;
+    }
+
     if (NULL != info->replaygain.ref_loud) {
         free(info->replaygain.ref_loud);
         info->replaygain.ref_loud = NULL;
@@ -257,6 +263,7 @@
     aud_tuple_associate_string(out, FIELD_TITLE, NULL, info->comment.title);
     aud_tuple_associate_string(out, FIELD_ALBUM, NULL, info->comment.album);
     aud_tuple_associate_string(out, FIELD_GENRE, NULL, info->comment.genre);
+    aud_tuple_associate_string(out, FIELD_COMMENT, NULL, info->comment.comment);
 
     if (info->comment.tracknumber != NULL)
         aud_tuple_associate_int(out, FIELD_TRACK_NUMBER, NULL, atoi(info->comment.tracknumber));
@@ -343,6 +350,11 @@
         destination = &(info->comment.tracknumber);
     }
 
+    if (0 == strcasecmp(key, "DESCRIPTION")) {
+        _DEBUG("Found key DESCRIPTION");
+        destination = &(info->comment.comment);
+    }
+
     if (0 == strcasecmp(key, "REPLAYGAIN_REFERENCE_LOUDNESS")) {
         _DEBUG("Found key REPLAYGAIN_REFERENCE_LOUDNESS");
         destination = &(info->replaygain.ref_loud);