]> granicus.if.org Git - handbrake/commitdiff
Implements CLI support for all x264 options with command line flag --x264opts (short...
authorjbrjake <jb.rubin@gmail.com>
Wed, 14 Feb 2007 22:56:59 +0000 (22:56 +0000)
committerjbrjake <jb.rubin@gmail.com>
Wed, 14 Feb 2007 22:56:59 +0000 (22:56 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.8.0_beta2_5.1@333 b64f7644-9d1e-0410-96f1-a4d463321fa5

test/test.c

index 5b9b2b3c0da8e82d8d770c112e4a9dd87e7b28d5..0675a630299aa1b834ac9b7bf38ff637d3f8f80a 100644 (file)
@@ -44,6 +44,7 @@ static int    pixelratio  = 0;
 static int    chapter_start = 0;
 static int    chapter_end   = 0;
 static int       crf                   = 0;
+static char      *x264opts             = NULL;
 
 /* Exit cleanly on Ctrl-C */
 static volatile int die = 0;
@@ -174,7 +175,8 @@ int main( int argc, char ** argv )
     if( output ) free( output );
     if( format ) free( format );
     if( audios ) free( audios );
-
+       if( x264opts ) free (x264opts );
+       
     fprintf( stderr, "MediaFork has exited.\n" );
 
     return 0;
@@ -426,6 +428,16 @@ static int HandleEvents( hb_handle_t * h )
                                job->crf = 1;
                        }
 
+                       if (x264opts != NULL && *x264opts != '\0' )
+                       {
+                               hb_log("Applying the following x264 options: %s", x264opts);
+                               job->x264opts = x264opts;
+                       }
+                       else /*avoids a bus error crash when options aren't specified*/
+                       {
+                               job->x264opts =  NULL;
+                       }
+
             if( twoPass )
             {
                 job->pass = 1;
@@ -567,7 +579,11 @@ static void ShowHelp()
     "    -B, --ab <kb/s>         Set audio bitrate (default: 128)\n"
     "    -w, --width <number>    Set picture width\n"
     "    -l, --height <number>   Set picture height\n"
-    "        --crop <T:B:L:R>    Set cropping values (default: autocrop)\n" );
+    "        --crop <T:B:L:R>    Set cropping values (default: autocrop)\n"
+       "\n"
+       "    -x, --x264opts <string> Specify advanced x264 options in the\n"
+       "                            same style as mencoder:\n"
+       "                            option1=value1:option2=value2\n" );
 }
 
 /****************************************************************************
@@ -611,6 +627,7 @@ static int ParseOptions( int argc, char ** argv )
             { "rate",        required_argument, NULL,    'r' },
             { "arate",       required_argument, NULL,    'R' },
                        { "crf",                 no_argument,           NULL,    'Q' },
+                       { "x264opts",    required_argument, NULL,    'x' },
                        
             { 0, 0, 0, 0 }
           };
@@ -619,7 +636,7 @@ static int ParseOptions( int argc, char ** argv )
         int c;
 
         c = getopt_long( argc, argv,
-                         "hvuC:f:i:o:t:c:a:6s:e:E:2dgpw:l:n:b:q:S:B:r:R:Q",
+                         "hvuC:f:i:o:t:c:a:s:e:E:2dgpw:l:n:b:q:S:B:r:R:Qx:",
                          long_options, &option_index );
         if( c < 0 )
         {
@@ -806,6 +823,9 @@ static int ParseOptions( int argc, char ** argv )
                        case 'Q':
                                crf = 1;
                                break;
+                       case 'x':
+                               x264opts = strdup( optarg );
+                           break;
 
             default:
                 fprintf( stderr, "unknown option (%s)\n", argv[optind] );