[mythtv] [PATCH] mp4 metaio compilation support

Lonnie Hutchinson gdchinacat at comcast.net
Tue Feb 8 02:10:44 UTC 2005


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 :) ).

Lonnie Hutchinson wrote:

> I'm looking into the mp4ff_meta_get_compilation() issue.
>
> mythtv at cvs.mythtv.org wrote:
>
>> ---------------------------------------------------------------------------- 
>>
>> Changes committed by thor on Mon Feb  7 19:52:23 2005
>>
>> Modified Files:
>>   in mythmusic/mythmusic:
>>        metaiomp4.cpp playbackbox.cpp Log Message:
>>
>> Hack-around to let metaiomp4.cpp compile with current Metadata 
>> constructor.
>> If someone has actual mp4/aac files and can figure out what the
>> mp4ff_meta_get_compilation() method sets as the char * value, this 
>> could be
>> made much better.
>> Check that curMeta exists before firing up the metadata editor (no more
>> segfaults from "i" when browsing the tree and nothing is playing).
>>
>> ---------------------------------------------------------------------------- 
>>
>>  
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> mythtv-commits mailing list
>> mythtv-commits at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-commits
>>  
>>
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>

-------------- next part --------------
Index: mythmusic/metaiomp4.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/metaiomp4.cpp,v
retrieving revision 1.2
diff -u -d -w -r1.2 metaiomp4.cpp
--- mythmusic/metaiomp4.cpp	7 Feb 2005 19:52:23 -0000	1.2
+++ mythmusic/metaiomp4.cpp	8 Feb 2005 02:06:16 -0000
@@ -107,7 +107,7 @@
       fclose(callback_data.file);
       return false;
     }
-    mp4ff_mdata->tags = (mp4ff_tag_t*)malloc(6 * sizeof(mp4ff_tag_t));
+    mp4ff_mdata->tags = (mp4ff_tag_t*)malloc(7 * sizeof(mp4ff_tag_t));
     if (!mp4ff_mdata) {
       free(mp4_cb);
       free(mp4ff_mdata);
@@ -150,7 +150,10 @@
     mp4ff_mdata->tags[5].value = (char*)malloc(128);
     snprintf(mp4ff_mdata->tags[5].value, 128, "%d", mdata->Track());
 
-    mp4ff_mdata->count = 6;
+    mp4ff_mdata->tags[6].item = "compilation";
+    mp4ff_mdata->tags[6].value = (char*)(mdata->Compilation() ? "1" : "0");
+
+    mp4ff_mdata->count = 7;
 
     mp4ff_meta_update(mp4_cb, mp4ff_mdata);
 
@@ -268,15 +271,11 @@
 
     if (mp4ff_meta_get_compilation(mp4_ifile, &char_storage))
     {
-        //
-        //  Does the returned char_storage tell us anything?
-        //  I dunno?
-        //
-
-        compilation = true;
+        compilation = (0 == strncmp("1", char_storage, 1));
         free(char_storage);
     }
 
+
     //
     //  Find the AAC track inside this mp4 which we need to do to find the
     //  length
@@ -337,14 +336,16 @@
     metadataSanityCheck(&artist, &album, &title, &genre);
 
     Metadata *retdata = new Metadata(filename, 
-                                     "",
                                      artist, 
+                                     compilation ? artist : "",
                                      album, 
                                      title, 
                                      genre,
                                      year, 
                                      tracknum, 
                                      length,
+                                     0, 0, 0,
+                                     "",
                                      compilation);
 
     //retdata->setComposer(writer);


More information about the mythtv-dev mailing list