OSDN Git Service

Finally recommitting clee's patch from r518 to allow 64-bit mp4 files that can hold...
authorjbrjake <jbrjake@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 13 Jun 2007 18:41:23 +0000 (18:41 +0000)
committerjbrjake <jbrjake@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 13 Jun 2007 18:41:23 +0000 (18:41 +0000)
Also converted a few stray hard tabs into soft tabs.

git-svn-id: svn://localhost/HandBrake/trunk@618 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/common.h
libhb/muxmp4.c
test/test.c

index 116f99a..a6ea8ac 100644 (file)
@@ -142,10 +142,10 @@ struct hb_job_s
          vbitrate:          output bitrate (kbps)
          pass:              0, 1 or 2
          vrate, vrate_base: output framerate is vrate / vrate_base
-                h264_level:            boolean for whether or not we're encoding for iPod
-                crf:                           boolean for whether to use constant rate factor with x264
-                x264opts:                      string of extra x264 options 
-                areBframes:            boolean to note if b-frames are included in x264opts */
+         h264_level:        boolean for whether or not we're encoding for iPod
+         crf:               boolean for whether to use constant rate factor with x264
+         x264opts:          string of extra x264 options 
+         areBframes:        boolean to note if b-frames are included in x264opts */
 #define HB_VCODEC_MASK   0x0000FF
 #define HB_VCODEC_FFMPEG 0x000001
 #define HB_VCODEC_XVID   0x000002
@@ -158,15 +158,15 @@ struct hb_job_s
     int             vrate_base;
     int             pass;
     int             h264_13;
-       int                             h264_level;
-       int                             crf;
-       char                *x264opts;
-       int                             areBframes;
-       
+    int             h264_level;
+    int             crf;
+    char            *x264opts;
+    int             areBframes;
+    
     /* Audio tracks:
          audios:          Indexes in hb_title_t's audios list, starting from 0.
                           -1 indicates the end of the list
-            audio_mixdowns:  The mixdown to be used for each audio track in audios[] */
+        audio_mixdowns:  The mixdown to be used for each audio track in audios[] */
 
 /* define some masks, used to extract the various information from the HB_AMIXDOWN_XXXX values */
 #define HB_AMIXDOWN_DCA_FORMAT_MASK             0x00FFF000
@@ -245,6 +245,10 @@ struct hb_job_s
     int             mux;
     const char          * file;
 
+    /* Allow MP4 files > 4 gigs */
+    int             largeFileSize;
+    
+
     int subtitle_scan;
     hb_subtitle_t ** select_subtitle;
     char * native_language;
index cfaf11e..c70e2c1 100644 (file)
@@ -143,7 +143,18 @@ static int MP4Init( hb_mux_object_t * m )
     
 
     /* Create an empty mp4 file */
-    m->file = MP4Create( job->file, MP4_DETAILS_ERROR, 0 );
+    if (job->largeFileSize)
+    /* Use 64-bit MP4 file */
+    {
+        m->file = MP4Create( job->file, MP4_DETAILS_ERROR, MP4_CREATE_64BIT_DATA ); 
+        hb_log("Using 64-bit MP4 formatting.");
+    }
+    else
+    /* Limit MP4s to less than 4 GB */
+    {
+        m->file = MP4Create( job->file, MP4_DETAILS_ERROR, 0 );
+    }
+    
     if (m->file == MP4_INVALID_FILE_HANDLE)
     {
         hb_log("muxmp4.c: MP4Create failed!");
index addee82..25939b6 100644 (file)
@@ -56,6 +56,7 @@ static int      maxHeight             = 0;
 static int       maxWidth              = 0;
 static int    turbo_opts_enabled = 0;
 static char * turbo_opts = "no-fast-pskip=0:subme=1:me=dia:trellis=0:analyse=none";
+static int    largeFileSize = 0;
 
 /* Exit cleanly on Ctrl-C */
 static volatile int die = 0;
@@ -539,6 +540,12 @@ static int HandleEvents( hb_handle_t * h )
             {
                 job->mux = mux;
             }
+            
+            if ( largeFileSize )
+            {
+                job->largeFileSize = 1;
+            }
+            
             job->file = strdup( output );
 
             if( crf )
@@ -736,6 +743,8 @@ static void ShowHelp()
     "    -o, --output <string>   Set output file name\n"
        "    -f, --format <string>   Set output format (avi/mp4/ogm, default:\n"
     "                            autodetected from file name)\n"
+    "    -4, --large-file        Use 64-bit mp4 files that can hold more than\n"
+    "                            4 GB. Note: Breaks iPod, @TV, PS3 compatibility.\n"""
     "\n"
        
        "### Picture Settings---------------------------------------------------------\n\n"
@@ -828,7 +837,8 @@ static int ParseOptions( int argc, char ** argv )
             { "format",      required_argument, NULL,    'f' },
             { "input",       required_argument, NULL,    'i' },
             { "output",      required_argument, NULL,    'o' },
-
+            { "large-file",  no_argument,       NULL,    '4' },
+            
             { "title",       required_argument, NULL,    't' },
             { "longest",     no_argument,       NULL,    'L' },
             { "chapters",    required_argument, NULL,    'c' },
@@ -869,7 +879,7 @@ static int ParseOptions( int argc, char ** argv )
         int c;
 
         c = getopt_long( argc, argv,
-                         "hvuC:f:i:o:t:Lc:ma:6:s:UN:e:E:2dgpw:l:n:b:q:S:B:r:R:Qx:TY:X:",
+                         "hvuC:f:4i:o:t:Lc:ma:6:s:UN:e:E:2dgpw:l:n:b:q:S:B:r:R:Qx:TY:X:",
                          long_options, &option_index );
         if( c < 0 )
         {
@@ -900,7 +910,9 @@ static int ParseOptions( int argc, char ** argv )
             case 'o':
                 output = strdup( optarg );
                 break;
-
+            case '4':
+                largeFileSize = 1;
+                break;
             case 't':
                 titleindex = atoi( optarg );
                 break;