diff options
author | jstebbins <[email protected]> | 2014-06-18 21:26:44 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-06-18 21:26:44 +0000 |
commit | 80a124ff2567ac45b26a606d425420a1ee590506 (patch) | |
tree | c298a7164dc5fd1d21e730fbd3ae66dc7820272b /test/test.c | |
parent | c152bd90aec1ab2d28edd26a08f3d4760d01b167 (diff) |
macui/cli/libhb: cleanup
macui: Simplifies code in Controller.m and fixes a few bugs
macui: Fixes "Windows 8 Phone" preset aspect ratio problem
macui: round up to next mod boundary when limiting to title dimensions - crop
libhb: Eliminates hb_fix_aspect and hb_set_size functions.
libhb: Makes hb_validate_size a passthru to hb_set_anamorphic_size
cli: eliminage use of hb_validate_size
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6215 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'test/test.c')
-rw-r--r-- | test/test.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/test/test.c b/test/test.c index 616afbd13..c35a8fc96 100644 --- a/test/test.c +++ b/test/test.c @@ -1721,10 +1721,14 @@ static int HandleEvents( hb_handle_t * h ) job->use_hwd = use_hwd; } + job->anamorphic.mode = anamorphic_mode; switch( anamorphic_mode ) { case 0: // Non-anamorphic + { + hb_ui_geometry_t ui_geo; + ui_geo.keep = 0; if (modulus) { job->modulus = modulus; @@ -1734,43 +1738,65 @@ static int HandleEvents( hb_handle_t * h ) { job->width = width; job->height = height; + ui_geo.keep |= HB_KEEP_WIDTH; } else if( width ) { job->width = width; + ui_geo.keep |= HB_KEEP_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; + ui_geo.keep |= HB_KEEP_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 ) + 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]; + ui_geo.keep |= HB_KEEP_WIDTH; // do not exceed source dimensions by default if( !maxHeight ) job->maxHeight = title->height; - hb_fix_aspect( job, HB_KEEP_WIDTH ); } - + hb_geometry_t result; + hb_geometry_t src; + + src.width = title->width; + src.height = title->height; + src.par.num = title->pixel_aspect_width; + src.par.den = title->pixel_aspect_height; + + ui_geo.width = job->width; + ui_geo.height = job->height; + + ui_geo.modulus = job->modulus; + memcpy(ui_geo.crop, job->crop, sizeof(int[4])); + ui_geo.maxWidth = job->maxWidth; + ui_geo.maxHeight = job->maxHeight; + ui_geo.mode = anamorphic_mode; + if (keep_display_aspect) + ui_geo.keep |= HB_KEEP_DISPLAY_ASPECT; + + hb_set_anamorphic_size2(&src, &ui_geo, &result); + job->width = result.width; + job->height = result.height; + job->anamorphic.par_width = result.par.num; + job->anamorphic.par_height = result.par.den; + } break; case 1: // Strict anammorphic - job->anamorphic.mode = anamorphic_mode; break; case 2: // Loose anamorphic - job->anamorphic.mode = 2; - if (modulus) { job->modulus = modulus; @@ -1794,8 +1820,6 @@ static int HandleEvents( hb_handle_t * h ) break; case 3: // Custom Anamorphic 3: Power User Jamboree - job->anamorphic.mode = 3; - if (modulus) { job->modulus = modulus; |