summaryrefslogtreecommitdiff
path: root/faac/faac-1.28-libmp4v2_r479_compat.patch
blob: f4ac8e6d4c5380594ff92a803ae3c7af5580d794 (plain)
    1 http://bugs.gentoo.org/397575
    2 http://sourceforge.net/tracker/?func=detail&aid=3476707&group_id=704&atid=100704
    3 
    4 --- configure.in
    5 +++ configure.in
    6 @@ -33,8 +33,8 @@ AC_CHECK_LIB(gnugetopt, getopt_long)
    7  AM_CONDITIONAL(WITH_MP4V2, false)
    8  AM_CONDITIONAL(WITH_EXTERNAL_MP4V2, false)
    9  
   10 -AC_CHECK_DECLS([MP4Create, MP4MetadataDelete],
   11 -               AC_CHECK_LIB(mp4v2, MP4MetadataDelete, external_mp4v2=yes,
   12 +AC_CHECK_DECLS([MP4Create],
   13 +               AC_CHECK_LIB(mp4v2, MP4Create, external_mp4v2=yes,
   14                              external_mp4v2=no, -lstdc++),
   15                 external_mp4v2=no, [#include <mp4v2/mp4v2.h>])
   16  
   17 @@ -42,6 +42,7 @@ if test x$external_mp4v2 = xyes; then
   18    AC_MSG_NOTICE([*** Building with external mp4v2 ***])
   19    MY_DEFINE(HAVE_EXTERNAL_LIBMP4V2)
   20    AM_CONDITIONAL(WITH_EXTERNAL_MP4V2, true)
   21 +  AC_CHECK_DECLS([MP4TagsAlloc], [], [], [#include <mp4v2/mp4v2.h>])
   22  else
   23    if test x$WITHMP4V2 = xyes; then
   24       AC_MSG_NOTICE([*** Building with internal mp4v2 ***])
   25 --- frontend/main.c
   26 +++ frontend/main.c
   27 @@ -873,8 +873,12 @@ int main(int argc, char *argv[])
   28      if (!faacEncSetConfiguration(hEncoder, myFormat)) {
   29          fprintf(stderr, "Unsupported output format!\n");
   30  #ifdef HAVE_LIBMP4V2
   31 +#ifdef MP4_CLOSE_DO_NOT_COMPUTE_BITRATE /* r479 fix */
   32 +        if (container == MP4_CONTAINER) MP4Close(MP4hFile, 0);
   33 +#else
   34          if (container == MP4_CONTAINER) MP4Close(MP4hFile);
   35  #endif
   36 +#endif
   37          return 1;
   38      }
   39  
   40 @@ -885,12 +889,10 @@ int main(int argc, char *argv[])
   41          unsigned long ASCLength = 0;
   42      char *version_string;
   43  
   44 -#ifdef MP4_CREATE_EXTENSIBLE_FORMAT
   45 -    /* hack to compile against libmp4v2 >= 1.0RC3
   46 -     * why is there no version identifier in mp4.h? */
   47 +#ifdef MP4_DETAILS_ERROR /* r453 fix */
   48          MP4hFile = MP4Create(aacFileName, MP4_DETAILS_ERROR, 0);
   49  #else
   50 -    MP4hFile = MP4Create(aacFileName, MP4_DETAILS_ERROR, 0, 0);
   51 +        MP4hFile = MP4Create(aacFileName, 0);
   52  #endif
   53          if (!MP4_IS_VALID_FILE_HANDLE(MP4hFile)) {
   54              fprintf(stderr, "Couldn't create output file %s\n", aacFileName);
   55 @@ -905,12 +907,22 @@ int main(int argc, char *argv[])
   56      free(ASC);
   57  
   58      /* set metadata */
   59 +#if HAVE_DECL_MP4TAGSALLOC
   60 +    const MP4Tags* tags;
   61 +    tags = MP4TagsAlloc();
   62 +    MP4TagsFetch( tags, MP4hFile );
   63 +#endif
   64      version_string = malloc(strlen(faac_id_string) + 6);
   65      strcpy(version_string, "FAAC ");
   66      strcpy(version_string + 5, faac_id_string);
   67 +#if !HAVE_DECL_MP4TAGSALLOC
   68      MP4SetMetadataTool(MP4hFile, version_string);
   69 +#else
   70 +    MP4TagsSetEncodingTool(tags, version_string);
   71 +#endif
   72      free(version_string);
   73  
   74 +#if !HAVE_DECL_MP4TAGSALLOC
   75      if (artist) MP4SetMetadataArtist(MP4hFile, artist);
   76      if (writer) MP4SetMetadataWriter(MP4hFile, writer);
   77      if (title) MP4SetMetadataName(MP4hFile, title);
   78 @@ -923,8 +935,40 @@ int main(int argc, char *argv[])
   79      if (comment) MP4SetMetadataComment(MP4hFile, comment);
   80          if (artSize) {
   81          MP4SetMetadataCoverArt(MP4hFile, art, artSize);
   82 +#else
   83 +    if (artist) MP4TagsSetArtist(tags, artist);
   84 +    if (writer) MP4TagsSetComposer(tags, writer);
   85 +    if (title) MP4TagsSetName(tags, title);
   86 +    if (album) MP4TagsSetAlbum(tags, album);
   87 +    if (trackno > 0) {
   88 +        MP4TagTrack tt;
   89 +        tt.index = trackno;
   90 +        tt.total = ntracks;
   91 +        MP4TagsSetTrack(tags, &tt);
   92 +    }
   93 +    if (discno > 0) {
   94 +        MP4TagDisk td;
   95 +        td.index = discno;
   96 +        td.total = ndiscs;
   97 +        MP4TagsSetDisk(tags, &td);
   98 +    }
   99 +    if (compilation) MP4TagsSetCompilation(tags, compilation);
  100 +    if (year) MP4TagsSetReleaseDate(tags, year);
  101 +    if (genre) MP4TagsSetGenre(tags, genre);
  102 +    if (comment) MP4TagsSetComments(tags, comment);
  103 +    if (artSize) {
  104 +        MP4TagArtwork mp4art;
  105 +        mp4art.data = art;
  106 +        mp4art.size = artSize;
  107 +        mp4art.type = MP4_ART_UNDEFINED; // delegate typing to libmp4v2
  108 +        MP4TagsAddArtwork( tags, &mp4art );
  109 +#endif
  110          free(art);
  111      }
  112 +#if HAVE_DECL_MP4TAGSALLOC
  113 +    MP4TagsStore( tags, MP4hFile );
  114 +    MP4TagsFree( tags );
  115 +#endif
  116      }
  117      else
  118      {
  119 @@ -1141,11 +1185,19 @@ int main(int argc, char *argv[])
  120          /* clean up */
  121          if (container == MP4_CONTAINER)
  122          {
  123 +#ifdef MP4_CLOSE_DO_NOT_COMPUTE_BITRATE /* r479 fix */
  124 +            MP4Close(MP4hFile, 0);
  125 +#else
  126              MP4Close(MP4hFile);
  127 +#endif
  128              if (optimizeFlag == 1)
  129              {
  130                  fprintf(stderr, "\n\nMP4 format optimization... ");
  131 +#ifdef MP4_DETAILS_ERROR /* r453 fix */
  132                  MP4Optimize(aacFileName, NULL, 0);
  133 +#else
  134 +                MP4Optimize(aacFileName, NULL);
  135 +#endif
  136                  fprintf(stderr, "Done!");
  137              }
  138          } else

Generated by cgit