shithub: aacdec

Download patch

ref: 10c4ca7ae1e5c28c22e2ad438a73f9e2243f9a6f
parent: 6c2b587f9d120e591fca74dee60b3f320f1c6099
author: knik <knik@users.sourceforge.net>
date: Wed Jul 19 09:55:54 EDT 2017

new API: NeAACDecGetVersion

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -1142,6 +1142,8 @@
     unsigned char header[8];
     float length = 0;
     FILE *hMP4File;
+    char *faad_id_string;
+    char *faad_copyright_string;
 
 /* System dependant types */
 #ifdef _WIN32
@@ -1299,13 +1301,11 @@
         }
     }
 
+    NeAACDecGetVersion(&faad_id_string, &faad_copyright_string);
 
-    faad_fprintf(stderr, " *********** Ahead Software MPEG-4 AAC Decoder V%s ******************\n\n", FAAD2_VERSION);
+    faad_fprintf(stderr, " *********** Ahead Software MPEG-4 AAC Decoder V%s ******************\n\n", faad_id_string);
     faad_fprintf(stderr, " Build: %s\n", __DATE__);
-    faad_fprintf(stderr, " Copyright 2002-2004: Ahead Software AG\n");
-    faad_fprintf(stderr, " http://www.audiocoding.com\n");
-    faad_fprintf(stderr, "\n Latest version and bug tracking available here:\n");
-    faad_fprintf(stderr, " http://sourceforge.net/projects/faac/\n\n");
+    faad_fprintf(stderr, "%s", faad_copyright_string);
     if (cap & FIXED_POINT_CAP)
         faad_fprintf(stderr, " Fixed point version\n");
     else
--- a/include/neaacdec.h
+++ b/include/neaacdec.h
@@ -73,8 +73,6 @@
   #endif
 #endif
 
-#define FAAD2_VERSION PACKAGE_VERSION
-
 /* object types for AAC */
 #define MAIN       1
 #define LC         2
@@ -250,6 +248,10 @@
 char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
                                              unsigned long buffer_size,
                                              mp4AudioSpecificConfig *mp4ASC);
+
+/* Get version and copyright strings */
+int NEAACDECAPI NeAACDecGetVersion(char **faad_id_string,
+                                   char **faad_copyright_string);
 
 #ifdef _WIN32
   #pragma pack(pop)
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -64,6 +64,23 @@
                                   NeAACDecFrameInfo *hInfo);
 
 
+int NEAACDECAPI NeAACDecGetVersion(char **faad_id_string,
+                                   char **faad_copyright_string)
+{
+    static char *libfaadName = PACKAGE_VERSION;
+    static char *libCopyright =
+        " Copyright 2002-2004: Ahead Software AG\n"
+	" http://www.audiocoding.com\n"
+	" bug tracking: https://sourceforge.net/p/faac/bugs/\n";
+
+    if (faad_id_string)
+        *faad_id_string = libfaadName;
+
+    if (faad_copyright_string)
+        *faad_copyright_string = libCopyright;
+
+    return 0;
+}
 char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode)
 {
     if (errcode >= NUM_ERROR_MESSAGES)
@@ -115,7 +132,7 @@
     hDecoder->config.downMatrix = 0;
     hDecoder->adts_header_present = 0;
     hDecoder->adif_header_present = 0;
-	hDecoder->latm_header_present = 0;
+    hDecoder->latm_header_present = 0;
 #ifdef ERROR_RESILIENCE
     hDecoder->aacSectionDataResilienceFlag = 0;
     hDecoder->aacScalefactorDataResilienceFlag = 0;
@@ -283,8 +300,8 @@
 #endif
         /* Check if an ADIF header is present */
         if ((buffer[0] == 'A') && (buffer[1] == 'D') &&
-			(buffer[2] == 'I') && (buffer[3] == 'F'))
-		{
+            (buffer[2] == 'I') && (buffer[3] == 'F'))
+        {
             hDecoder->adif_header_present = 1;
 
             get_adif_header(&adif, &ld);
@@ -325,7 +342,7 @@
     }
 
     if (!*samplerate)
-	return -1;
+        return -1;
 
 #if (defined(PS_DEC) || defined(DRM_PS))
     /* check if we have a mono file */