shithub: aacenc

Download patch

ref: 8466fece22b0eb5070e39e9f964d442fe91916d5
parent: 1dc4953ff4a78e7d5308367b24e9a60ece9481c0
author: menno <menno>
date: Fri Jan 23 19:15:12 EST 2009

Added -s option for output of optimized mp4 layout

--- a/frontend/faac.sln
+++ b/frontend/faac.sln
@@ -1,15 +1,15 @@
 
 Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
+# Visual Studio 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faac", "faac.vcproj", "{92992E74-AEDE-46DC-AD8C-ADEA876F1A4C}"
 	ProjectSection(ProjectDependencies) = postProject
-		{C7A305F1-8C73-4E1F-BB1B-623707D44D24} = {C7A305F1-8C73-4E1F-BB1B-623707D44D24}
+		{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B} = {55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}
 		{9CC48C6E-92EB-4814-AD37-97AB3622AB65} = {9CC48C6E-92EB-4814-AD37-97AB3622AB65}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac", "..\LIBFAAC\libfaac.vcproj", "{9CC48C6E-92EB-4814-AD37-97AB3622AB65}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac", "..\libfaac\libfaac.vcproj", "{9CC48C6E-92EB-4814-AD37-97AB3622AB65}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp4v2_st", "..\common\mp4v2\libmp4v2_st60.vcproj", "{C7A305F1-8C73-4E1F-BB1B-623707D44D24}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp4v2_st", "..\common\mp4v2\libmp4v2_st60.vcproj", "{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,10 +25,10 @@
 		{9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Debug|Win32.Build.0 = Debug|Win32
 		{9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Release|Win32.ActiveCfg = Release|Win32
 		{9CC48C6E-92EB-4814-AD37-97AB3622AB65}.Release|Win32.Build.0 = Release|Win32
-		{C7A305F1-8C73-4E1F-BB1B-623707D44D24}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C7A305F1-8C73-4E1F-BB1B-623707D44D24}.Debug|Win32.Build.0 = Debug|Win32
-		{C7A305F1-8C73-4E1F-BB1B-623707D44D24}.Release|Win32.ActiveCfg = Release|Win32
-		{C7A305F1-8C73-4E1F-BB1B-623707D44D24}.Release|Win32.Build.0 = Release|Win32
+		{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Debug|Win32.Build.0 = Debug|Win32
+		{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Release|Win32.ActiveCfg = Release|Win32
+		{55C87BFB-9C9C-41E0-B9DC-57F41F679D4B}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
--- 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.80 2007/03/19 19:57:40 menno Exp $
+ * $Id: main.c,v 1.81 2009/01/24 00:15:12 menno Exp $
  */
 
 #ifdef _MSC_VER
@@ -108,6 +108,7 @@
   "MP4 specific options:\n"
 #ifdef HAVE_LIBMP4V2
   "  -w\t\tWrap AAC data in MP4 container. (default for *.mp4 and *.m4a)\n"
+  "  -s\t\tOptimize MP4 container layout after encoding\n"
   "  --artist X\tSet artist to X\n"
   "  --writer X\tSet writer to X\n"
   "  --title X\tSet title to X\n"
@@ -175,6 +176,7 @@
 #ifdef HAVE_LIBMP4V2
   "  -w\t\tWrap AAC data in MP4 container. (default for *.mp4, *.m4a and\n"
   "\t\t*.m4b)\n"
+  "  -s\t\tOptimize MP4 container layout after encoding.\n"
   "  --artist X\tSet artist to X\n"
   "  --writer X\tSet writer/composer to X\n"
   "  --title X\tSet title/track name to X\n"
@@ -404,6 +406,7 @@
     unsigned int useMidSide = 1;
     static unsigned int useTns = DEFAULT_TNS;
     enum container_format container = NO_CONTAINER;
+    int optimizeFlag = 0;
     enum stream_format stream = ADTS_STREAM;
     int cutOff = -1;
     int bitRate = 0;
@@ -489,6 +492,7 @@
             { "license", 0, 0, 'L'},
 #ifdef HAVE_LIBMP4V2
             { "createmp4", 0, 0, 'w'},
+            { "optimize", 0, 0, 's'},
             { "artist", 1, 0, ARTIST_FLAG},
             { "title", 1, 0, TITLE_FLAG},
             { "album", 1, 0, ALBUM_FLAG},
@@ -509,7 +513,7 @@
 
         c = getopt_long(argc, argv, "Hhb:m:o:rnc:q:PR:B:C:I:X"
 #ifdef HAVE_LIBMP4V2
-                        "w"
+                        "ws"
 #endif
             ,long_options, &option_index);
 
@@ -606,6 +610,9 @@
         case 'w':
         container = MP4_CONTAINER;
             break;
+        case 's':
+        optimizeFlag = 1;
+            break;
     case ARTIST_FLAG:
         artist = optarg;
         break;
@@ -1126,15 +1133,23 @@
 #endif
             }
         }
-        fprintf(stderr, "\n\n");
 
 #ifdef HAVE_LIBMP4V2
         /* clean up */
         if (container == MP4_CONTAINER)
+        {
             MP4Close(MP4hFile);
-        else
+            if (optimizeFlag == 1)
+            {
+                fprintf(stderr, "\n\nMP4 format optimization... ");
+                MP4Optimize(aacFileName, NULL, 0);
+                fprintf(stderr, "Done!");
+            }
+        } else
 #endif
             fclose(outfile);
+
+        fprintf(stderr, "\n\n");
     }
 
     faacEncClose(hEncoder);
@@ -1152,6 +1167,9 @@
 
 /*
 $Log: main.c,v $
+Revision 1.81  2009/01/24 00:15:12  menno
+Added -s option for output of optimized mp4 layout
+
 Revision 1.80  2007/03/19 19:57:40  menno
 Made faacgui buildable again
 Made stdout as output possible (use - as output filename)