Revision: 2206
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2206&view=rev
Author:   jcsjcs
Date:     2009-01-11 13:00:36 +0000 (Sun, 11 Jan 2009)

Log Message:
-----------
        * configure.in
          src/mp4file.c: Adding support for MP4V2 2.0_20081129 without
          losing support for older versions of MP4V2 from the mpeg4ip
          line. Thanks to William Hardeman.

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog
    gtkpod/trunk/configure.in
    gtkpod/trunk/src/mp4file.c

Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog      2009-01-11 10:52:25 UTC (rev 2205)
+++ gtkpod/trunk/ChangeLog      2009-01-11 13:00:36 UTC (rev 2206)
@@ -1,5 +1,12 @@
 2008-01-11 Jorg Schuler <jcsjcs at users.sourceforge.net>
 
+       * configure.in
+         src/mp4file.c: Adding support for MP4V2 2.0_20081129 without
+         losing support for older versions of MP4V2 from the mpeg4ip
+         line. Thanks to William Hardeman.
+
+2008-01-11 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
        * src/mp3file.c: correct programming error when determining offset
          of the LAME tag. Thanks to <Anonymous> for submitting tracker
          #2490479.

Modified: gtkpod/trunk/configure.in
===================================================================
--- gtkpod/trunk/configure.in   2009-01-11 10:52:25 UTC (rev 2205)
+++ gtkpod/trunk/configure.in   2009-01-11 13:00:36 UTC (rev 2206)
@@ -144,35 +144,59 @@
     have_hal="*no -- will build without HAL support"
 fi
 
-dnl Check for libmp4v2 (and mp4.h)
+dnl Check for libmp4v2 (and mp4.h or mp4v2/mp4v2.h)
 AC_ARG_WITH(mp4v2, AC_HELP_STRING([--without-mp4v2], [Disable MP4/AAC 
support]))
 if test "x$with_mp4v2" != "xno"; then
+    have_mp4v2_2_header=no
     AC_SEARCH_LIBS(MP4GetMetadataGrouping,
         ["mp4v2" "mp4v2 -lstdc++" "mp4v2 -lz" "mp4v2 -lz -lstdc++"],
         [AC_CHECK_HEADER(mp4.h, have_mp4v2=yes, have_mp4v2_header=no)], 
have_mp4v2=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 cannot be found or is unusable. Check your mp4v2 
installation.])
+        AC_MSG_WARN([mp4.h and mp4v2/mp4v2.h cannot be found or is unusable. 
Check your mp4v2 installation.])
     else
 dnl Check if MP4GetMetadataFreeForm() requires an extra argument
-        AC_TRY_COMPILE( [#include <mp4.h> ],
-            [bool TestMP4GetMetadataFreeForm(MP4FileHandle hFile, const char 
*name,
-                u_int8_t** pValue, u_int32_t* valueSize, const char *owner)
-                {
-                    MP4GetMetadataFreeForm(hFile, name,pValue, valueSize, 
owner);
-                } ], freeform_accepts_extra_arg=yes)
+        if test "x$have_mp4v2_2_header" = "xyes"; then
+            AC_TRY_COMPILE( [#include <mp4v2/mp4v2.h>],
+                [bool TestMP4GetMetadataFreeForm(MP4FileHandle hFile, const 
char *name,
+                    uint8_t** pValue, uint32_t* valueSize, const char *owner)
+                    {
+                        MP4GetMetadataFreeForm(hFile, name,pValue, valueSize, 
owner);
+                    } ], freeform_accepts_extra_arg=yes)
+        else
+            AC_TRY_COMPILE( [#include <mp4.h>],
+                [bool TestMP4GetMetadataFreeForm(MP4FileHandle hFile, const 
char *name,
+                    u_int8_t** pValue, u_int32_t* valueSize, const char *owner)
+                    {
+                        MP4GetMetadataFreeForm(hFile, name,pValue, valueSize, 
owner);
+                    } ], freeform_accepts_extra_arg=yes)
+        fi
         if test "x$freeform_accepts_extra_arg" = "xyes"; then
             AC_DEFINE(FREEFORM_ACCEPTS_EXTRA_ARG, 1, [MP4GetMetadataFreeForm
                       accepts an extra argument in libmp4v2 >= 1.6])
         fi
 dnl Check if MP4GetMetadataCoverArt() requires an extra argument
-        AC_TRY_COMPILE( [#include <mp4.h>],
-            [bool TestMP4GetMetadataCoverArt(MP4FileHandle hFile,
-                u_int8_t **coverArt, u_int32_t* size, uint32_t index)
-                {
-                    MP4GetMetadataCoverArt(hFile, coverArt, size, index);
-                }], coverart_accepts_extra_arg=yes)
-
+        if test "x$have_mp4v2_2_header" = "xyes"; then
+            AC_TRY_COMPILE( [#include <mp4v2/mp4v2.h>],
+                [bool TestMP4GetMetadataCoverArt(MP4FileHandle hFile,
+                    uint8_t **coverArt, uint32_t* size, uint32_t index)
+                    {
+                        MP4GetMetadataCoverArt(hFile, coverArt, size, index);
+                    }], coverart_accepts_extra_arg=yes)
+        else
+            AC_TRY_COMPILE( [#include <mp4.h>],
+                [bool TestMP4GetMetadataCoverArt(MP4FileHandle hFile,
+                    u_int8_t **coverArt, u_int32_t* size, uint32_t index)
+                    {
+                        MP4GetMetadataCoverArt(hFile, coverArt, size, index);
+                    }], coverart_accepts_extra_arg=yes)
+        fi
         if test "x$coverart_accepts_extra_arg" = "xyes"; then
             AC_DEFINE(COVERART_ACCEPTS_EXTRA_ARG, 1, [MP4GetMetadataCoverArt
                       accepts an extra argument in libmp4v2 >= 1.6])

Modified: gtkpod/trunk/src/mp4file.c
===================================================================
--- gtkpod/trunk/src/mp4file.c  2009-01-11 10:52:25 UTC (rev 2205)
+++ gtkpod/trunk/src/mp4file.c  2009-01-11 13:00:36 UTC (rev 2206)
@@ -137,7 +137,11 @@
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
-#include "mp4.h"
+#ifdef HAVE_LIBMP4V2_2
+#include <mp4v2/mp4v2.h>
+#else
+#include <mp4.h>
+#endif
 
 #ifndef FREEFORM_ACCEPTS_EXTRA_ARG
 /* Version 1.6 of libmp4v2 introduces an index argument for 
MP4GetMetadataFreeForm. For C++ sources it defaults
@@ -395,7 +399,11 @@
 #else
 #warning "Album Artist field not supported with this version of libmp4v2. 
Album Artist support requires at least V1.6.0"
 #endif
+#if HAVE_LIBMP4V2_2
+                   if (MP4GetMetadataComposer(mp4File, &value) && value != 
NULL)
+#else
                    if (MP4GetMetadataWriter(mp4File, &value) && value != NULL)
+#endif
                    {
                        track->composer = charset_to_utf8 (value);
                        g_free(value);
@@ -405,7 +413,11 @@
                        track->comment = charset_to_utf8 (value);
                        g_free(value);
                    }
+#if HAVE_LIBMP4V2_2
+                   if (MP4GetMetadataReleaseDate(mp4File, &value) && value != 
NULL)
+#else
                    if (MP4GetMetadataYear(mp4File, &value) && value != NULL)
+#endif
                    {
                        track->year = atoi (value);
                        g_free(value);
@@ -435,7 +447,11 @@
                        track->genre = charset_to_utf8 (value);
                        g_free(value);
                    }
+#if HAVE_LIBMP4V2_2
+                   if (MP4GetMetadataBPM (mp4File, &numvalue))
+#else
                    if (MP4GetMetadataTempo (mp4File, &numvalue))
+#endif
                    {
                        track->BPM = numvalue;
                    }
@@ -525,16 +541,29 @@
                                                      &m_track, &m_tracks);
            gboolean has_disk = MP4GetMetadataDisk (mp4File,
            &m_disk, &m_disks);*/
+#if HAVE_LIBMP4V2_2
+           gboolean has_tempo = MP4GetMetadataBPM (mp4File,
+                                                     &m_tempo);
+#else
            gboolean has_tempo = MP4GetMetadataTempo (mp4File,
                                                      &m_tempo);
+#endif
            gboolean has_compilation = MP4GetMetadataCompilation (mp4File,
                                                                  &m_cpl);
 /*         MP4GetMetadataName (mp4File, &m_name);
            MP4GetMetadataArtist (mp4File, &m_artist);
            MP4GetMetadataAlbumArtist (mp4File, &m_albumartist);
+#if HAVE_LIBMP4V2_2
+           MP4GetMetadataComposer (mp4File, &m_writer);
+#else
            MP4GetMetadataWriter (mp4File, &m_writer);
+#endif
            MP4GetMetadataComment (mp4File, &m_comment);
+#if HAVE_LIBMP4V2_2
+           MP4GetMetadataReleaseDate (mp4File, &m_year);
+#else
            MP4GetMetadataYear (mp4File, &m_year);
+#endif
            MP4GetMetadataAlbum (mp4File, &m_album);
            MP4GetMetadataGenre (mp4File, &m_genre);*/
            MP4GetMetadataTool (mp4File, &m_tool);
@@ -555,7 +584,11 @@
            g_free (value);
 #endif
            value = charset_from_utf8 (track->composer);
+#if HAVE_LIBMP4V2_2
+           MP4SetMetadataComposer (mp4File, value);
+#else
            MP4SetMetadataWriter (mp4File, value);
+#endif
            g_free (value);
 
            value = charset_from_utf8 (track->comment);
@@ -563,7 +596,11 @@
            g_free (value);
 
            value = g_strdup_printf ("%d", track->year);
+#if HAVE_LIBMP4V2_2
+           MP4SetMetadataReleaseDate (mp4File, value);
+#else
            MP4SetMetadataYear (mp4File, value);
+#endif
            g_free (value);
 
            value = charset_from_utf8 (track->album);
@@ -574,7 +611,11 @@
 
            MP4SetMetadataDisk (mp4File, track->cd_nr, track->cds);
 
+#if HAVE_LIBMP4V2_2
+           MP4SetMetadataBPM (mp4File, track->BPM);
+#else
            MP4SetMetadataTempo (mp4File, track->BPM);
+#endif
 
            value = charset_from_utf8 (track->grouping);
            MP4SetMetadataGrouping (mp4File, value);
@@ -585,7 +626,11 @@
            g_free (value);
 
 #if MP4V2_HAS_METADATA_BUG
+#if HAVE_LIBMP4V2_2
+           if (has_tempo) MP4SetMetadataBPM (mp4File, m_tempo);
+#else
            if (has_tempo) MP4SetMetadataTempo (mp4File, m_tempo);
+#endif
            if (has_compilation) MP4SetMetadataCompilation (mp4File, m_cpl);
            if (m_tool)     MP4SetMetadataTool (mp4File, m_tool);
            if (m_covert)   MP4SetMetadataCoverArt (mp4File, m_covert, m_size);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to