changeset 2942:233cb5dffbf7

Fix tags for ALAC files. For some reason, the tag can occour a second time, but this time empty. Always use the first tag we found.
author Jonathan Schleifer <js@webkeks.org>
date Sat, 27 Sep 2008 19:04:32 +0200
parents c57d9b5754b3
children d3e42ee17c93
files src/alac/demux.c
diffstat 1 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/alac/demux.c	Mon Sep 22 06:41:18 2008 +0300
+++ b/src/alac/demux.c	Sat Sep 27 19:04:32 2008 +0200
@@ -571,28 +571,36 @@
 	     bptr += 4;
              break;
         case MAKEFOURCC('d','a','t','a'):
+	     /* Don't compare to NULL in the following ifs!
+	      * NULL may be -1 on some system, but we used memset to set it
+	      * to 0!
+	      */
              switch(udta_tgt)
              {
              case UDTA_NAM:
-                 qtmovie->res->tuple.nam = g_strdup(bptr + 12);
-                 break;
+		 if (qtmovie->res->tuple.nam == 0)
+		     qtmovie->res->tuple.nam = g_strdup(bptr + 12);
+		 break;
              case UDTA_ART:
-                 qtmovie->res->tuple.art = g_strdup(bptr + 12);
-                 break;
+		 if (qtmovie->res->tuple.art == 0)
+                     qtmovie->res->tuple.art = g_strdup(bptr + 12);
+		 break;
              case UDTA_ALB:
-                 qtmovie->res->tuple.alb = g_strdup(bptr + 12);
-                 break;
+		 if (qtmovie->res->tuple.alb == 0)
+                     qtmovie->res->tuple.alb = g_strdup(bptr + 12);
+		 break;
              case UDTA_DAY:
-                 qtmovie->res->tuple.day = g_strdup(bptr + 12);
-                 break;
+		 if (qtmovie->res->tuple.day == 0)
+                     qtmovie->res->tuple.day = g_strdup(bptr + 12);
+		 break;
              case UDTA_CMT:
-                 qtmovie->res->tuple.cmt = g_strdup(bptr + 12);
-                 break;
+		 if (qtmovie->res->tuple.cmt == 0)
+                     qtmovie->res->tuple.cmt = g_strdup(bptr + 12);
+		 break;
              case UDTA_GEN:
-                 qtmovie->res->tuple.gen = g_strdup(bptr + 12);
-                 break;
-             default:
-	         break;
+		 if (qtmovie->res->tuple.gen == 0)
+                     qtmovie->res->tuple.gen = g_strdup(bptr + 12);
+		 break;
              }
 
              bptr += 12;