shithub: aacenc

Download patch

ref: fc7feec33dde58ae9aade966a3fca6cf5aee4431
parent: a66bde45993a9ab3bb96e5054f1c153b8aceae0e
author: danchr <danchr>
date: Fri Apr 16 05:49:10 EDT 2004

change -a <kbps/channel> to -b <kbps>
Darwin portability fixes
Make LTP imply MPEG-4 AAC
silence a few warnings

--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,6 @@
 AC_DEFUN(MY_DEFINE, [ AC_DEFINE($1, 1, [define if needed]) ])
 
 CFLAGS=${CFLAGS:-"-O2 -Wall"}
-LDFLAGS=${LDFLAGS:-"-s"}
 
 AC_PROG_CC
 AM_PROG_LIBTOOL
@@ -19,6 +18,8 @@
 AC_CHECK_TYPES(int32_t)
 AC_CHECK_TYPES(int16_t)
 
+AC_CHECK_DECL(strcasecmp, MY_DEFINE(HAVE_STRCASECMP))
+
 AC_CHECK_LIB(gnugetopt, getopt_long)
 AC_CHECK_LIB(mp4v2, MP4MetadataDelete,
 		    [AC_MSG_NOTICE([*** Building with MP4 support ***])
@@ -26,7 +27,6 @@
 		     LIBS="$LIBS -lstdc++ -lmp4v2"],
 		     [AC_MSG_NOTICE([*** Building without MP4 support ***])],
 		     -lstdc++)
-
 AC_C_BIGENDIAN
 
 dnl Checks for header files required for mp4.h
--- a/frontend/getopt.c
+++ b/frontend/getopt.c
@@ -157,7 +157,7 @@
   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
 } ordering;
 
-#ifdef  __GNU_LIBRARY__
+#if defined(__GNU_LIBRARY__) || defined(__APPLE__)
 /* We want to avoid inclusion of string.h with non-GNU libraries
    because there are many ways it can cause trouble.
    On some systems, it contains special magic macros that don't work
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -18,7 +18,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: main.c,v 1.66 2004/04/13 13:47:05 danchr Exp $
+ * $Id: main.c,v 1.67 2004/04/16 09:49:10 danchr Exp $
  */
 
 #ifdef _MSC_VER
@@ -61,6 +61,10 @@
 # include "getopt.c"
 #endif
 
+#if !defined(HAVE_STRCASECMP) && !defined(_WIN32)
+# define strcasecmp strcmp
+#endif
+
 #include "input.h"
 
 #include <faac.h>
@@ -79,7 +83,7 @@
   "Usage: %s [options] infiles ...\n"
   "Options:\n"
   "  -q <quality>\tSet quantizer quality.\n"
-  "  -a <bitrate>\tSet average bitrate to x kbps/channel. (lower quality mode)\n"
+  "  -b <bitrate>\tSet average bitrate to x kbps. (ABR, lower quality mode)\n"
   "  -c <freq>\tSet the bandwidth in Hz. (default=automatic)\n"
   "  -o X\t\tSet output file to X (only for one input file)\n"
   "  -r\t\tUse RAW AAC output file.\n"
@@ -125,9 +129,7 @@
   "\t\t(default: 100, averages at approx. 120 kbps VBR for a normal \n"
   "\t\tstereo input file with 16 bit and 44.1 kHz sample rate; max.\n"
   "\t\tvalue 500, min. 10).Set quantizer quality.\n"
-  "  -a <bitrate>\tSet average bitrate (ABR) to approximately X kbps PER CHANNEL\n"
-  "\t\t(default: VBR mode; using -a 64 averages at 128 kbps/stereo max.\n"
-  "\t\tvalue 76 kbps/channel = 152 kbps/stereo at a 16 kHz cutoff).\n"
+  "  -b <bitrate>\tSet average bitrate (ABR) to approximately <bitrate> kbps.\n"
   "  -c <freq>\tSet the bandwidth in Hz (default: automatic, i.e. adapts\n"
   "\t\tmaximum value to input sample rate).\n"
   "\n"
@@ -489,7 +491,7 @@
         int c = -1;
         int option_index = 0;
 
-        c = getopt_long(argc, argv, "Hha:m:o:rnc:q:PR:B:C:I:X"
+        c = getopt_long(argc, argv, "Hhb:m:o:rnc:q:PR:B:C:I:X"
 #ifdef HAVE_LIBMP4V2
                         "w"
 #endif
@@ -528,7 +530,7 @@
             }
             break;
         }
-        case 'a': {
+        case 'b': {
             unsigned int i;
             if (sscanf(optarg, "%u", &i) > 0)
             {
@@ -676,13 +678,14 @@
             }
             break;
 	case OBJTYPE_FLAG:
-	    if (!strcasecmp(optarg, "LC") || !strcasecmp(optarg, "lc"))
+	    if (!strcasecmp(optarg, "LC"))
                 objectType = LOW;
-	    else if (!strcmp(optarg, "Main") || !strcmp(optarg, "main"))
+	    else if (!strcasecmp(optarg, "Main"))
 	        objectType = MAIN;
-	    else if (!strcasecmp(optarg, "LTP") || !strcasecmp(optarg, "ltp"))
-	        objectType = LTP;
-	    else
+	    else if (!strcasecmp(optarg, "LTP")) {
+	        mpegVersion = MPEG4;
+		objectType = LTP;
+	    } else
 	        dieMessage = "Unrecognised object type!\n";
 	    break;
         case 'L':
@@ -831,7 +834,7 @@
         myFormat->useLfe = 1;
     myFormat->allowMidside = useMidSide;
     if (bitRate)
-        myFormat->bitRate = bitRate;
+        myFormat->bitRate = bitRate / infile->channels;
     myFormat->bandWidth = cutOff;
     if (quantqual > 0)
         myFormat->quantqual = quantqual;
@@ -911,8 +914,8 @@
     quantqual = myFormat->quantqual;
     bitRate = myFormat->bitRate;
     if (bitRate)
-      fprintf(stderr, "Average bitrate: %d kbps/channel\n",
-	      (bitRate + 500)/1000);
+      fprintf(stderr, "Average bitrate: %d kbps\n",
+	      (bitRate + 500)/1000*infile->channels);
     fprintf(stderr, "Quantization quality: %ld\n", quantqual);
     fprintf(stderr, "Bandwidth: %d Hz\n", cutOff);
     fprintf(stderr, "Object type: ");
@@ -1119,6 +1122,12 @@
 
 /*
 $Log: main.c,v $
+Revision 1.67  2004/04/16 09:49:10  danchr
+change -a <kbps/channel> to -b <kbps>
+Darwin portability fixes
+Make LTP imply MPEG-4 AAC
+silence a few warnings
+
 Revision 1.66  2004/04/13 13:47:05  danchr
 compilation and composer patch by Jordan Breeding
 undocumented single-letter switches removed