mp4v2-2.0.0.patch 4.6 KB

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