Hi,

instead of reintroducing the old api, you can try
to use the attached patch for faac.
it builds, but i don't know if it works ^^

Regards

Sébastien
--- faac/frontend/main.c
+++ faac/frontend/main.c
@@ -874,7 +874,7 @@
     if (!faacEncSetConfiguration(hEncoder, myFormat)) {
         fprintf(stderr, "Unsupported output format!\n");
 #ifdef HAVE_LIBMP4V2
-        if (container == MP4_CONTAINER) MP4Close(MP4hFile);
+        if (container == MP4_CONTAINER) MP4Close(MP4hFile, 0);
 #endif
         return 1;
     }
@@ -886,13 +886,9 @@
         unsigned long ASCLength = 0;
     char *version_string;
 
-#ifdef MP4_CREATE_EXTENSIBLE_FORMAT
-    /* hack to compile against libmp4v2 >= 1.0RC3
-     * why is there no version identifier in mp4.h? */
-        MP4hFile = MP4Create(aacFileName, MP4_DETAILS_ERROR, 0);
-#else
-    MP4hFile = MP4Create(aacFileName, MP4_DETAILS_ERROR, 0, 0);
-#endif
+        MP4LogSetLevel(MP4_LOG_ERROR);
+        MP4hFile = MP4Create(aacFileName, 0);
+
         if (!MP4_IS_VALID_FILE_HANDLE(MP4hFile)) {
             fprintf(stderr, "Couldn't create output file %s\n", aacFileName);
             return 1;
@@ -906,26 +902,46 @@
     free(ASC);
 
     /* set metadata */
+    const MP4Tags* tags;
+    tags = MP4TagsAlloc();
+    MP4TagsFetch( tags, MP4hFile );
+
     version_string = malloc(strlen(faac_id_string) + 6);
     strcpy(version_string, "FAAC ");
     strcpy(version_string + 5, faac_id_string);
-    MP4SetMetadataTool(MP4hFile, version_string);
+    MP4TagsSetEncodingTool(tags, version_string);
     free(version_string);
 
-    if (artist) MP4SetMetadataArtist(MP4hFile, artist);
-    if (writer) MP4SetMetadataWriter(MP4hFile, writer);
-    if (title) MP4SetMetadataName(MP4hFile, title);
-    if (album) MP4SetMetadataAlbum(MP4hFile, album);
-    if (trackno > 0) MP4SetMetadataTrack(MP4hFile, trackno, ntracks);
-    if (discno > 0) MP4SetMetadataDisk(MP4hFile, discno, ndiscs);
-    if (compilation) MP4SetMetadataCompilation(MP4hFile, compilation);
-    if (year) MP4SetMetadataYear(MP4hFile, year);
-    if (genre) MP4SetMetadataGenre(MP4hFile, genre);
-    if (comment) MP4SetMetadataComment(MP4hFile, comment);
-        if (artSize) {
-        MP4SetMetadataCoverArt(MP4hFile, art, artSize);
+    if (artist) MP4TagsSetArtist(tags, artist);
+    if (writer) MP4TagsSetComposer(tags, writer);
+    if (title) MP4TagsSetName(tags, title);
+    if (album) MP4TagsSetAlbum(tags, album);
+    if (trackno > 0) {
+        MP4TagTrack tt;
+        tt.index = trackno;
+        tt.total = ntracks;+
+        MP4TagsSetTrack(tags, &tt);
+    }
+    if (discno > 0) {
+        MP4TagDisk td;
+        td.index = discno;
+        td.total = ndiscs;
+        MP4TagsSetDisk(tags, &td);
+    }
+    if (compilation) MP4TagsSetCompilation(tags, compilation);
+    if (year) MP4TagsSetReleaseDate(tags, year);
+    if (genre) MP4TagsSetGenre(tags, genre);
+    if (comment) MP4TagsSetComments(tags, comment);
+    if (artSize) {
+        MP4TagArtwork mp4art;
+        mp4art.data = art;
+        mp4art.size = artSize;
+        mp4art.type = MP4_ART_UNDEFINED; // delegate typing to libmp4v2
+        MP4TagsAddArtwork( tags, &mp4art );
         free(art);
     }
+    MP4TagsStore( tags, MP4hFile );
+    MP4TagsFree( tags );
     }
     else
     {
@@ -1142,11 +1158,11 @@
         /* clean up */
         if (container == MP4_CONTAINER)
         {
-            MP4Close(MP4hFile);
+            MP4Close(MP4hFile, 0);
             if (optimizeFlag == 1)
             {
                 fprintf(stderr, "\n\nMP4 format optimization... ");
-                MP4Optimize(aacFileName, NULL, 0);
+                MP4Optimize(aacFileName, NULL);
                 fprintf(stderr, "Done!");
             }
         } else

Reply via email to