summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2010-02-11 23:38:00 +0000
committerdynaflash <[email protected]>2010-02-11 23:38:00 +0000
commit748a83548709b07001f3a715dcb11279609d9395 (patch)
tree806ef5653b28b982537410fd3bb2d3823a842aa4 /macosx
parent5212b9a80b24015b8c638d49e789d253ddc70eb5 (diff)
Adjustable picture modulus: Base patch by BradleyS, Thanks BradleyS!
- Enables setting modulus for all anamorphic modes (including non-anamorphic) except strict. The job variable "anamorphic.modulus" is repurposed for this and is renamed to simply "modulus" - Other changes: Increases minimum output dimensions to 32x32 pixels in libhb (prevents possible crashes, notably in macgui). Better crop value and maximum crop value calculations to prevent crashes. Some code optimization / refactoring. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3113 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.m32
-rw-r--r--macosx/HBQueueController.mm2
-rw-r--r--macosx/PictureController.m41
3 files changed, 49 insertions, 26 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 545a263a8..0715bff0e 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -2320,10 +2320,11 @@ fWorkingCount = 0;
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
+ [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"];
/* if we are custom anamorphic, store the exact storage, par and display dims */
if (fTitle->job->anamorphic.mode == 3)
{
- [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.modulus] forKey:@"PicturePARModulus"];
+ [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PicturePARModulus"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PicturePARStorageWidth"];
[queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PicturePARStorageHeight"];
@@ -2954,6 +2955,7 @@ fWorkingCount = 0;
}
+ //job->modulus = [[queueToApply objectForKey:@"PictureModulus"] intValue];
/* we check to make sure the presets width/height does not exceed the sources width/height */
if (fTitle->width < [[queueToApply objectForKey:@"PictureWidth"] intValue] || fTitle->height < [[queueToApply objectForKey:@"PictureHeight"] intValue])
@@ -2980,7 +2982,7 @@ fWorkingCount = 0;
}
}
job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"] intValue];
-
+ job->modulus = [[queueToApply objectForKey:@"PictureModulus"] intValue];
[self writeToActivityLog: "applyQueueSettingsToMainWindow: picture sizing set up"];
@@ -3080,7 +3082,6 @@ fWorkingCount = 0;
/* we call SetTitle: in fPictureController so we get an instant update in the Picture Settings window */
[fPictureController SetTitle:fTitle];
- [fPictureController SetTitle:fTitle];
[self calculatePictureSizing:nil];
[self writeToActivityLog: "applyQueueSettingsToMainWindow: picture filters set up"];
@@ -3722,13 +3723,14 @@ bool one_burned = FALSE;
job->keep_ratio = [[queueToApply objectForKey:@"PictureKeepRatio"] intValue];
job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"] intValue];
+ job->modulus = [[queueToApply objectForKey:@"PictureModulus"] intValue];
if ([[queueToApply objectForKey:@"PicturePAR"] intValue] == 3)
{
/* insert our custom values here for capuj */
job->width = [[queueToApply objectForKey:@"PicturePARStorageWidth"] intValue];
job->height = [[queueToApply objectForKey:@"PicturePARStorageHeight"] intValue];
- job->anamorphic.modulus = [[queueToApply objectForKey:@"PicturePARModulus"] intValue];
+ job->modulus = [[queueToApply objectForKey:@"PicturePARModulus"] intValue];
job->anamorphic.par_width = [[queueToApply objectForKey:@"PicturePARPixelWidth"] intValue];
job->anamorphic.par_height = [[queueToApply objectForKey:@"PicturePARPixelHeight"] intValue];
@@ -5198,8 +5200,14 @@ the user is using "Custom" settings by determining the sender*/
fTitle->job->keep_ratio = 0;
}
- [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@", [fPictureController getPictureSizeInfoString]]];
-
+ if (fTitle->job->anamorphic.mode != 1) // we are not strict so show the modulus
+ {
+ [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@, Modulus: %d", [fPictureController getPictureSizeInfoString], fTitle->job->modulus]];
+ }
+ else
+ {
+ [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@", [fPictureController getPictureSizeInfoString]]];
+ }
NSString *picCropping;
/* Set the display field for crop as per boolean */
if (![fPictureController autoCrop])
@@ -7097,7 +7105,16 @@ return YES;
}
-
+ /* Set modulus */
+ if ([chosenPreset objectForKey:@"PictureModulus"])
+ {
+ job->modulus = [[chosenPreset objectForKey:@"PictureModulus"] intValue];
+ }
+ else
+ {
+ job->modulus = 16;
+ }
+
/* Check to see if the objectForKey:@"UsesPictureSettings is 2 which is "Use Max for the source */
if ([[chosenPreset objectForKey:@"UsesPictureSettings"] intValue] == 2 || [[chosenPreset objectForKey:@"UsesMaxPictureSettings"] intValue] == 1)
{
@@ -7472,6 +7489,7 @@ return YES;
[preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
[preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
[preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
+ [preset setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"];
/* Set crop settings here */
[preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];
diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm
index 9321b1dd8..9f7ce38a0 100644
--- a/macosx/HBQueueController.mm
+++ b/macosx/HBQueueController.mm
@@ -1189,6 +1189,7 @@ return ![(HBQueueOutlineView*)outlineView isDragging];
[finalString appendString: @"Destination: " withAttributes:detailBoldAttr];
[finalString appendString: [item objectForKey:@"DestinationPath"] withAttributes:detailAttr];
[finalString appendString:@"\n" withAttributes:detailAttr];
+
/* Fifth Line Picture Details*/
NSString * pictureInfo;
pictureInfo = [NSString stringWithFormat:@"%@", [item objectForKey:@"PictureSizingSummary"]];
@@ -1196,6 +1197,7 @@ return ![(HBQueueOutlineView*)outlineView isDragging];
{
pictureInfo = [pictureInfo stringByAppendingString:@" Keep Aspect Ratio"];
}
+
if ([[item objectForKey:@"VideoGrayScale"] intValue] == 1)
{
pictureInfo = [pictureInfo stringByAppendingString:@", Grayscale"];
diff --git a/macosx/PictureController.m b/macosx/PictureController.m
index e70ec80eb..b02dab729 100644
--- a/macosx/PictureController.m
+++ b/macosx/PictureController.m
@@ -150,8 +150,6 @@
[fParHeightLabel setHidden: NO];
[fDisplayWidthField setHidden: NO];
[fDisplayWidthLabel setHidden: NO];
- [fModulusLabel setHidden: NO];
- [fModulusPopUp setHidden: NO];
/* adjust/move keep ar checkbox */
[fRatioLabel setHidden: YES];
[fRatioLabel2 setHidden: NO];
@@ -192,8 +190,6 @@
[fParHeightLabel setHidden: YES];
[fDisplayWidthField setHidden: YES];
[fDisplayWidthLabel setHidden: YES];
- [fModulusLabel setHidden: YES];
- [fModulusPopUp setHidden: YES];
/* adjust/move keep ar checkbox */
[fRatioLabel setHidden: NO];
[fRatioLabel2 setHidden: YES];
@@ -532,15 +528,16 @@
[fModulusPopUp addItemWithTitle: @"8"];
[fModulusPopUp addItemWithTitle: @"4"];
[fModulusPopUp addItemWithTitle: @"2"];
- if (job->anamorphic.mode == 3)
+ if (job->modulus)
{
- [fModulusPopUp selectItemWithTitle: [NSString stringWithFormat:@"%d",job->anamorphic.modulus]];
+ [fModulusPopUp selectItemWithTitle: [NSString stringWithFormat:@"%d",job->modulus]];
}
else
{
- [fModulusPopUp selectItemWithTitle: @"16"];
+ [fModulusPopUp selectItemAtIndex: 0];
}
+
/* We initially set the previous state of keep ar to on */
keepAspectRatioPreviousState = 1;
if (!autoCrop)
@@ -648,8 +645,24 @@
- (IBAction) SettingsChanged: (id) sender
{
hb_job_t * job = fTitle->job;
- [fModulusPopUp setEnabled:NO];
- job->anamorphic.modulus = 16;
+
+ /* if we are anything but strict anamorphic */
+ if ([fAnamorphicPopUp indexOfSelectedItem] != 1)
+ {
+ [fModulusLabel setHidden:NO];
+ [fModulusPopUp setHidden:NO];
+ }
+ else
+ {
+ /* we are strict so hide the mod popup since libhb uses mod 2 for strict anamorphic*/
+ [fModulusLabel setHidden:YES];
+ [fModulusPopUp setHidden:YES];
+ }
+
+ job->modulus = [[fModulusPopUp titleOfSelectedItem] intValue];
+
+ [fWidthStepper setIncrement: job->modulus];
+ [fHeightStepper setIncrement: job->modulus];
/* Since custom anamorphic allows for a height setting > fTitle->height
* check to make sure it is returned to fTitle->height for all other modes
@@ -687,14 +700,6 @@
job->anamorphic.par_width = titleParWidth;
job->anamorphic.par_height = titleParHeight;
[fRatioLabel setHidden: NO];
-
- [fWidthStepper setIncrement: 16];
- [fHeightStepper setIncrement: 16];
- }
- else
- {
- [fWidthStepper setIncrement: [[fModulusPopUp titleOfSelectedItem] intValue]];
- [fHeightStepper setIncrement: [[fModulusPopUp titleOfSelectedItem] intValue]];
}
if( [fAnamorphicPopUp indexOfSelectedItem] > 0 )
@@ -752,9 +757,7 @@
job->anamorphic.mode = 3;
/* Set the status of our custom ana only widgets accordingly */
- /* for mod 3 we can use modulus other than 16 */
[fModulusPopUp setEnabled:YES];
- job->anamorphic.modulus = [[fModulusPopUp titleOfSelectedItem] intValue];
[fWidthStepper setEnabled: YES];
[fWidthField setEnabled: YES];