OSDN Git Service

cli: allow setting modulus with ana-none
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 17 Dec 2010 16:36:22 +0000 (16:36 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 17 Dec 2010 16:36:22 +0000 (16:36 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@3711 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/work.c
test/test.c

index 9504d4d..5944286 100644 (file)
@@ -237,9 +237,9 @@ void hb_display_job_info( hb_job_t * job )
     }
     else
     {
-        hb_log( "   + dimensions: %d * %d -> %d * %d, crop %d/%d/%d/%d",
+        hb_log( "   + dimensions: %d * %d -> %d * %d, crop %d/%d/%d/%d, mod %i",
                 title->width, title->height, job->width, job->height,
-                job->crop[0], job->crop[1], job->crop[2], job->crop[3] );
+                job->crop[0], job->crop[1], job->crop[2], job->crop[3], job->modulus );
     }
 
     if ( job->grayscale )
index 3300540..e8d9d18 100644 (file)
@@ -1285,6 +1285,11 @@ static int HandleEvents( hb_handle_t * h )
             {
                 case 0: // Non-anamorphic
                     
+                    if (modulus)
+                    {
+                        job->modulus = modulus;
+                    }
+                    
                     if( width && height )
                     {
                         job->width  = width;
@@ -1293,15 +1298,27 @@ static int HandleEvents( hb_handle_t * h )
                     else if( width )
                     {
                         job->width = width;
+                        // do not exceed source dimensions by default
+                        if( !maxHeight )
+                            job->maxHeight = title->height;
                         hb_fix_aspect( job, HB_KEEP_WIDTH );
                     }
                     else if( height )
                     {
                         job->height = height;
+                        // do not exceed source dimensions by default
+                        if( !maxWidth )
+                            job->maxWidth = title->width;
                         hb_fix_aspect( job, HB_KEEP_HEIGHT );
                     }
                     else if( !width && !height )
                     {
+                        /* Default to cropped width when one isn't specified
+                         * avoids rounding to mod 16 regardless of modulus */
+                        job->width = title->width - job->crop[2] - job->crop[3];
+                        // do not exceed source dimensions by default
+                        if( !maxHeight )
+                            job->maxHeight = title->height;
                         hb_fix_aspect( job, HB_KEEP_WIDTH );
                     }