I started looking into options for the compilation tag, and noticed quite a lot was not working properly. The tag does in fact contain the iTunes compilation setting, the empty string if it is not set, or a single character string with the character containing a value of 1 if the flag is set. I overlooked this in my earlier patches because I was only looking at the string as it was printed out. Since this field does contain useful data I updated the code to use it in the same way that iTunes does, which means that we can't use it to store the compilation artist. The compilation artist is set to the artist of the track.

Also, the ascii->utf changes don't work...I'm not sure why I didn't notice this when I tested it yesterday (I'm guessing because I accidentally was looking at the DB values, not the tag values). Anyway, I have reverted these changes to use ascii. I will look into options for using utf8, but ascii is better than gobbledigook in the meantime.


Colin Guthrie wrote:

Lonnie Hutchinson wrote:

This patch improves MP4 compilation handling. The compilation field is empty, even for iTunes created files that are marked as having a compilation; from looking at the source to the mp4ff library I think it is a library limitation. The patch sets this field to "0" or "1", and fixes a bug introduced by thor's commit that caused all tracks to be marked as part of a compilation with "Unknown Artist".

Please commit this to CVS prior to 0.17 since what is in CVS doesn't work very well (but at least it compiles :) ).


Cool. This will save me looking!

On a side note, would it be better to use the char storage for compilation to be the Compilation Artist rather than a simple 1 or 0?

If this field has data, then compilation = 1 else compilation = 0 and you also have the real compilation artist??

Col.


------------------------------------------------------------------------

_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev



Index: mythmusic/metaiomp4.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/metaiomp4.cpp,v
retrieving revision 1.3
diff -u -d -w -r1.3 metaiomp4.cpp
--- mythmusic/metaiomp4.cpp     8 Feb 2005 07:53:45 -0000       1.3
+++ mythmusic/metaiomp4.cpp     9 Feb 2005 03:06:10 -0000
@@ -131,16 +131,16 @@
     }
 
     mp4ff_mdata->tags[0].item = "artist";
-    mp4ff_mdata->tags[0].value = mdata->Artist().utf8().data();
+    mp4ff_mdata->tags[0].value = (char*)mdata->Artist().ascii();
 
     mp4ff_mdata->tags[1].item = "album";
-    mp4ff_mdata->tags[1].value = mdata->Album().utf8().data();
+    mp4ff_mdata->tags[1].value = (char*)mdata->Album().ascii();
 
     mp4ff_mdata->tags[2].item = "title";
-    mp4ff_mdata->tags[2].value = mdata->Title().utf8().data();
+    mp4ff_mdata->tags[2].value = (char*)mdata->Title().ascii();
 
     mp4ff_mdata->tags[3].item = "genre";
-    mp4ff_mdata->tags[3].value = mdata->Genre().utf8().data();
+    mp4ff_mdata->tags[3].value = (char*)mdata->Genre().ascii();
 
     mp4ff_mdata->tags[4].item = "date";
     mp4ff_mdata->tags[4].value = (char*)malloc(128);
@@ -151,7 +151,9 @@
     snprintf(mp4ff_mdata->tags[5].value, 128, "%d", mdata->Track());
 
     mp4ff_mdata->tags[6].item = "compilation";
-    mp4ff_mdata->tags[6].value = (char*)(mdata->Compilation() ? "1" : "0");
+    mp4ff_mdata->tags[6].value = (char*)malloc(2);
+    mp4ff_mdata->tags[6].value[0] = mdata->Compilation() ? 1 : 0;
+    mp4ff_mdata->tags[6].value[1] = 0;
 
     mp4ff_mdata->count = 7;
 
@@ -163,6 +165,7 @@
     fclose(callback_data.file);
     free(mp4ff_mdata->tags[4].value);
     free(mp4ff_mdata->tags[5].value);
+    free(mp4ff_mdata->tags[6].value);
     free(mp4ff_mdata->tags);
     free(mp4ff_mdata);
 
@@ -271,7 +274,7 @@
 
     if (mp4ff_meta_get_compilation(mp4_ifile, &char_storage))
     {
-        compilation = (0 == strncmp("1", char_storage, 1));
+        compilation = (1 == char_storage[0]);
         free(char_storage);
     }
 
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to