shithub: aacdec

Download patch

ref: a432dd721ceda6bf59e4a51d338cb8920d245219
parent: 65a42927fa9d5bbe1ec173fdf3abb32d52d49799
author: menno <menno>
date: Mon Dec 22 20:24:49 EST 2008

[ 2150104 ] fix album artist, disc number, and compilation flag in mp4ff

--- a/common/mp4ff/mp4atom.c
+++ b/common/mp4ff/mp4atom.c
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4atom.c,v 1.27 2008/11/24 21:40:36 menno Exp $
+** $Id: mp4atom.c,v 1.28 2008/12/23 01:24:49 menno Exp $
 **/
 
 #include <stdlib.h>
@@ -192,6 +192,9 @@
         return ATOM_USER;
     else if (mp4ff_atom_compare(a,b,c,d, 'k','e','y',' '))
         return ATOM_KEY;
+	/* added by AJS */
+    else if (mp4ff_atom_compare(a,b,c,d, 'a','A','R','T'))
+        return ATOM_ALBUM_ARTIST;
     else
         return ATOM_UNKNOWN;
 }
--- a/common/mp4ff/mp4ffint.h
+++ b/common/mp4ff/mp4ffint.h
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4ffint.h,v 1.23 2008/11/24 21:27:12 menno Exp $
+** $Id: mp4ffint.h,v 1.24 2008/12/23 01:24:49 menno Exp $
 **/
 
 #ifndef MP4FF_INTERNAL_H
@@ -121,6 +121,9 @@
 #define ATOM_PRIV 154
 #define ATOM_USER 155
 #define ATOM_KEY  156
+
+/* added by AJS */
+#define ATOM_ALBUM_ARTIST	157
 
 #define ATOM_UNKNOWN 255
 #define ATOM_FREE ATOM_UNKNOWN
--- a/common/mp4ff/mp4meta.c
+++ b/common/mp4ff/mp4meta.c
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4meta.c,v 1.19 2007/11/01 12:33:29 menno Exp $
+** $Id: mp4meta.c,v 1.20 2008/12/23 01:24:49 menno Exp $
 **/
 
 #ifdef USE_TAGGING
@@ -168,7 +168,9 @@
     static char *tag_names[] = {
         "unknown", "title", "artist", "writer", "album",
         "date", "tool", "comment", "genre", "track",
-        "disc", "compilation", "genre", "tempo", "cover"
+        "disc", "compilation", "genre", "tempo", "cover",
+		/* added by AJS */
+		"album_artist"
     };
     uint8_t tag_idx = 0;
 
@@ -188,6 +190,8 @@
     case ATOM_GENRE2: tag_idx = 12; break;
     case ATOM_TEMPO: tag_idx = 13; break;
     case ATOM_COVER: tag_idx = 14; break;
+	/* added by AJS */
+	case ATOM_ALBUM_ARTIST: tag_idx = 15; break;
     default: tag_idx = 0; break;
     }
 
@@ -243,7 +247,14 @@
 						done = 1;
 					}
 				} else if (parent_atom_type == ATOM_TRACK || parent_atom_type == ATOM_DISC) {
-					if (!done && subsize - header_size >= 8 + 8)
+					/* if (!done && subsize - header_size >= 8 + 8) */
+					/* modified by AJS */
+					if ( !done && (subsize - header_size) >=
+						(sizeof(char) + sizeof(uint8_t)*3 + sizeof(uint32_t) + /* version + flags + reserved */
+						+ sizeof(uint16_t) /* leading uint16_t */
+						+ sizeof(uint16_t) /* track / disc */
+						+ sizeof(uint16_t)) /* totaltracks / totaldiscs */
+						)
 					{
 						uint16_t index,total;
 						char temp[32];
@@ -250,7 +261,8 @@
 						mp4ff_read_int16(f);
 						index = mp4ff_read_int16(f);
 						total = mp4ff_read_int16(f);
-						mp4ff_read_int16(f);
+  						/* modified by AJS */
+						/* mp4ff_read_int16(f); */
 
 						sprintf(temp,"%d",index);
 						mp4ff_tag_add_field(&(f->tags), parent_atom_type == ATOM_TRACK ? "track" : "disc", temp);
--- a/common/mp4ff/mp4tagupdate.c
+++ b/common/mp4ff/mp4tagupdate.c
@@ -225,6 +225,8 @@
 //	{"disk","disc"},
 //	{"gnre","genre"},
 	{"covr","cover"},
+	/* added by AJS */
+	{"aART","album_artist"},
 };
 
 
@@ -265,11 +267,20 @@
 
 static void membuffer_write_std_tag(membuffer * buf,const char * name,const char * value)
 {
+	/* added by AJS */
+	uint32_t flags = 1;
+
+	/* special check for compilation flag */
+	if ( strcmp(name, "cpil") == 0)
+	{
+		flags = 21;
+	}
+
 	membuffer_write_int32(buf,8 /*atom header*/ + 8 /*data atom header*/ + 8 /*flags + reserved*/ + strlen(value) );
 	membuffer_write_atom_name(buf,name);
 	membuffer_write_int32(buf,8 /*data atom header*/ + 8 /*flags + reserved*/ + strlen(value));
 	membuffer_write_atom_name(buf,"data");
-	membuffer_write_int32(buf,1);//flags
+	membuffer_write_int32(buf,flags);//flags
 	membuffer_write_int32(buf,0);//reserved
 	membuffer_write_data(buf,value,strlen(value));
 }