[Easytag-mailing] support new mp4v2 fork



Hi everyone,

mpeg4ip seems to be dead and the libmp4v2 fork doesn't include the
latest changes. There's a new fork of the libmp4v2 library at:
http://code.google.com/p/mp4v2/

My attached patch adds support for the new header location and the
renamed functions, inspired by gtkpod trunk.

Regards, Götz

-- 
AL I:40: Do what thou wilt shall be the whole of the Law.
diff -p -up easytag-2.1.6/configure.in.mp4v2 easytag-2.1.6/configure.in
--- easytag-2.1.6/configure.in.mp4v2	2009-01-12 11:08:52.000000000 +0100
+++ easytag-2.1.6/configure.in	2009-01-12 11:13:13.000000000 +0100
@@ -318,6 +318,18 @@ if test "x$enable_mp4" = "xyes"; then
     dnl Librairies required for mp4 files, if not found 'enable_mp4' is disabled
     AC_CHECK_LIB(m, cos)
     AC_CHECK_LIB(mp4v2, MP4GetTrackMediaDataName, , mp4_available=no)
+    have_mp4v2_2_header=no
+    AC_CHECK_HEADER(mp4.h, have_mp4v2=yes, have_mp4v2_header=no)
+        if test "x$have_mp4v2_header" = "xno"; then
+        AC_CHECK_HEADER(mp4v2/mp4v2.h, [have_mp4v2_2_header=yes; have_mp4v2_header=yes; have_mp4v2=yes], have_mp4v2_header=no)
+        if test "x$have_mp4v2_2_header" = "xyes"; then
+            AC_DEFINE(HAVE_LIBMP4V2_2, 1, [Define if you have the mp4v2 library version 2.0 or greater])
+        fi
+    fi
+    if test "x$have_mp4v2_header" = "xno"; then
+        have_mp4v2="no"
+        AC_MSG_WARN([mp4.h and mp4v2/mp4v2.h cannot be found or is unusable. Check your mp4v2 installation.])
+   fi
 fi
 
 AC_MSG_CHECKING(for MP4/AAC file support)
diff -p -up easytag-2.1.6/src/mp4_header.c.mp4v2 easytag-2.1.6/src/mp4_header.c
--- easytag-2.1.6/src/mp4_header.c.mp4v2	2009-01-12 11:37:43.000000000 +0100
+++ easytag-2.1.6/src/mp4_header.c	2009-01-12 12:05:24.000000000 +0100
@@ -44,8 +44,11 @@
 #undef PACKAGE_STRING
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
+#ifdef HAVE_LIBMP4V2_2
+#include <mp4v2/mp4v2.h>
+#else
 #include <mp4.h>
-
+#endif
 
 /****************
  * Declarations *
diff -p -up easytag-2.1.6/src/mp4_tag.c.mp4v2 easytag-2.1.6/src/mp4_tag.c
--- easytag-2.1.6/src/mp4_tag.c.mp4v2	2009-01-12 12:05:47.000000000 +0100
+++ easytag-2.1.6/src/mp4_tag.c	2009-01-12 12:16:33.000000000 +0100
@@ -50,7 +50,11 @@
 #undef PACKAGE_STRING
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
+#ifdef HAVE_LIBMP4V2_2
+#include <mp4v2/mp4v2.h>
+#else
 #include <mp4.h>
+#endif
 
 
 /****************
@@ -85,7 +89,7 @@ gboolean Mp4tag_Read_File_Tag (gchar *fi
     u_int8_t *coverArt;
     u_int32_t coverSize;
     Picture *prev_pic = NULL;
-#ifdef NEWMP4
+#if NEWMP4 || HAVE_LIBMP4V2_2
     gint pic_num;
 #endif
     
@@ -146,7 +150,11 @@ gboolean Mp4tag_Read_File_Tag (gchar *fi
     /********
      * Year *
      ********/
+#if HAVE_LIBMP4V2_2
+    MP4GetMetadataReleaseDate(mp4file, &FileTag->year);
+#else
     MP4GetMetadataYear(mp4file, &FileTag->year);
+#endif
 
     /*************************
      * Track and Total Track *
@@ -172,7 +180,11 @@ gboolean Mp4tag_Read_File_Tag (gchar *fi
     /**********************
      * Composer or Writer *
      **********************/
+#if HAVE_LIBMP4V2_2
+    MP4GetMetadataComposer(mp4file, &FileTag->composer);
+#else
     MP4GetMetadataWriter(mp4file, &FileTag->composer);
+#endif
 
     /*****************
      * Encoding Tool *
@@ -187,7 +199,7 @@ gboolean Mp4tag_Read_File_Tag (gchar *fi
     /***********
      * Picture *
      ***********/
-#ifdef NEWMP4
+#if NEWMP4 || HAVE_LIBMP4V2_2
     // There version can handle multiple pictures!
     // Version 1.6 of libmp4v2 introduces an index argument for MP4GetMetadataCoverart
     for (pic_num = 0; (MP4GetMetadataCoverArt( mp4file, &coverArt, &coverSize,pic_num )); pic_num++)
@@ -342,11 +354,19 @@ gboolean Mp4tag_Write_File_Tag (ET_File 
      ********/
     if (FileTag->year && g_utf8_strlen(FileTag->year, -1) > 0)
     {
+#if HAVE_LIBMP4V2_2
+        MP4SetMetadataReleaseDate(mp4file, FileTag->year);
+#else
         MP4SetMetadataYear(mp4file, FileTag->year);
+#endif
     }else
     {
         //MP4DeleteMetadataYear(mp4file);
+#if HAVE_LIBMP4V2_2
+        MP4SetMetadataReleaseDate(mp4file, "");
+#else
         MP4SetMetadataYear(mp4file, "");
+#endif
     }
 
     /*************************
@@ -397,11 +417,19 @@ gboolean Mp4tag_Write_File_Tag (ET_File 
      **********************/
     if (FileTag->composer && g_utf8_strlen(FileTag->composer, -1) > 0)
     {
+#if HAVE_LIBMP4V2_2
+        MP4SetMetadataComposer(mp4file, FileTag->composer);
+#else
         MP4SetMetadataWriter(mp4file, FileTag->composer);
+#endif
     }else
     {
         //MP4DeleteMetadataWriter(mp4file);
+#if HAVE_LIBMP4V2_2
+        MP4SetMetadataComposer(mp4file, "");
+#else
         MP4SetMetadataWriter(mp4file, "");
+#endif
     }
 
     /*****************


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]