diff options
-rw-r--r-- | macosx/Controller.h | 3 | ||||
-rw-r--r-- | macosx/Controller.mm | 95 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | macosx/PictureController.mm | 20 |
4 files changed, 90 insertions, 30 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 37d2791e5..448e258c6 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -204,6 +204,9 @@ - (NSDictionary *)CreateIpodPreset; - (NSDictionary *)CreateAppleTVPreset; +- (IBAction) RevertPictureSizeToMax:(id)sender; + + - (void) savePreset; - (IBAction)AddFactoryPresets:(id)sender; - (IBAction)AddUserPreset:(id)sender; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index e1cea515c..d5881db28 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1046,8 +1046,13 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow @"%d", fTitle->height]]; /* We get the originial output picture width and height and put them in variables for use with some presets later on */ - PicOrigOutputWidth = title->job->width; - PicOrigOutputHeight = title->job->height; + PicOrigOutputWidth = job->width; + PicOrigOutputHeight = job->height; + /* we test getting the max output value for pic sizing here to be used later*/ + [fPicSettingWidth setStringValue: [NSString stringWithFormat: + @"%d", PicOrigOutputWidth]]; + [fPicSettingHeight setStringValue: [NSString stringWithFormat: + @"%d", PicOrigOutputHeight]]; /* Turn Deinterlace on/off depending on the preference */ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultDeinterlaceOn"] > 0) { @@ -1070,7 +1075,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow } /* Run Through EncoderPopUpChanged to see if there needs to be any pic value modifications based on encoder settings */ - [self EncoderPopUpChanged: NULL]; + //[self EncoderPopUpChanged: NULL]; /* END Get and set the initial pic size for display */ @@ -1301,11 +1306,11 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPicSizeAutoiPod"] > 0) { - if (fTitle->job->width > 640) + if (job->width > 640) { - fTitle->job->width = 640; + job->width = 640; } - fTitle->job->keep_ratio = 1; + job->keep_ratio = 1; hb_fix_aspect( job, HB_KEEP_WIDTH ); } @@ -1398,6 +1403,26 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow } +/* lets set the picture size back to the max from right after title scan + Lets use an IBAction here as down the road we could always use a checkbox + in the gui to easily take the user back to max. Remember, the compiler + resolves IBActions down to -(void) during compile anyway */ +- (IBAction) RevertPictureSizeToMax: (id) sender +{ + hb_job_t * job = fTitle->job; + /* We use the output picture width and height + as calculated from libhb right after title is set + in TitlePopUpChanged */ + job->width = PicOrigOutputWidth; + job->height = PicOrigOutputHeight; + + + + [self CalculatePictureSizing: sender]; + /* We call method method to change UI to reflect whether a preset is used or not*/ + [self CustomSettingUsed: sender]; +} + /* Get and Display Current Pic Settings in main window */ - (IBAction) CalculatePictureSizing: (id) sender @@ -1429,8 +1454,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow @"%d", displayparwidth]]; [fPicSettingPARHeight setStringValue: [NSString stringWithFormat: @"%d", displayparheight]]; - [fPicSettingHeight setStringValue: [NSString stringWithFormat: - @"%d", displayparheight]]; + fTitle->job->keep_ratio = 0; } else @@ -1602,6 +1626,8 @@ the user is using "Custom" settings by determining the sender*/ /*Picture Settings*/ hb_job_t * job = fTitle->job; /* Basic Picture Settings */ + /* Use Max Picture settings for whatever the dvd is.*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; [preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"]; [preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"]; @@ -1667,6 +1693,8 @@ the user is using "Custom" settings by determining the sender*/ /*Picture Settings*/ //hb_job_t * job = fTitle->job; /* Basic Picture Settings */ + /* Use Max Picture settings for whatever the dvd is.*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; //[preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"]; //[preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"]; //[preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"]; @@ -1730,15 +1758,20 @@ the user is using "Custom" settings by determining the sender*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; /*Picture Settings*/ - hb_job_t * job = fTitle->job; + /* For AppleTV we only want to retain UsesMaxPictureSettings + which depend on the source dvd picture settings, so we don't + record the current dvd's picture info since it will vary from + source to source*/ + //hb_job_t * job = fTitle->job; //hb_job_t * job = title->job; /* Basic Picture Settings */ - + /* Use Max Picture settings for whatever the dvd is.*/ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesMaxPictureSettings"]; //[preset setObject:[NSNumber numberWithInt:PicOrigOutputWidth] forKey:@"PictureWidth"]; //[preset setObject:[NSNumber numberWithInt:PicOrigOutputHeight] forKey:@"PictureHeight"]; //[preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //[preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - //[preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ //[preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"]; @@ -1858,24 +1891,44 @@ the user is using "Custom" settings by determining the sender*/ if ([[chosenPreset objectForKey:@"UsesPictureSettings"] intValue] == 1) { hb_job_t * job = fTitle->job; - job->width = [[chosenPreset objectForKey:@"PictureWidth"] intValue]; - job->height = [[chosenPreset objectForKey:@"PictureHeight"] intValue]; - job->keep_ratio = [[chosenPreset objectForKey:@"PictureKeepRatio"] intValue]; - if (job->keep_ratio == 1) + /* Check to see if we should use the max picture setting for the current title*/ + if ([[chosenPreset objectForKey:@"UsesMaxPictureSettings"] intValue] == 1) { - hb_fix_aspect( job, HB_KEEP_WIDTH ); + /* Use Max Picture settings for whatever the dvd is.*/ + [self RevertPictureSizeToMax: NULL]; + job->keep_ratio = [[chosenPreset objectForKey:@"PictureKeepRatio"] intValue]; + if (job->keep_ratio == 1) + { + hb_fix_aspect( job, HB_KEEP_WIDTH ); + } + job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"] intValue]; + } + else + { + job->width = [[chosenPreset objectForKey:@"PictureWidth"] intValue]; + job->height = [[chosenPreset objectForKey:@"PictureHeight"] intValue]; + job->keep_ratio = [[chosenPreset objectForKey:@"PictureKeepRatio"] intValue]; + if (job->keep_ratio == 1) + { + hb_fix_aspect( job, HB_KEEP_WIDTH ); + } + job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"] intValue]; + job->crop[0] = [[chosenPreset objectForKey:@"PictureTopCrop"] intValue]; + job->crop[1] = [[chosenPreset objectForKey:@"PictureBottomCrop"] intValue]; + job->crop[2] = [[chosenPreset objectForKey:@"PictureLeftCrop"] intValue]; + job->crop[3] = [[chosenPreset objectForKey:@"PictureRightCrop"] intValue]; } - job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"] intValue]; - job->crop[0] = [[chosenPreset objectForKey:@"PictureTopCrop"] intValue]; - job->crop[1] = [[chosenPreset objectForKey:@"PictureBottomCrop"] intValue]; - job->crop[2] = [[chosenPreset objectForKey:@"PictureLeftCrop"] intValue]; - job->crop[3] = [[chosenPreset objectForKey:@"PictureRightCrop"] intValue]; [self CalculatePictureSizing: NULL]; } + + + } } + + - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return [UserPresets count]; diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index 2a5b575c9..a4d0f7cbe 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -129,7 +129,7 @@ /* Begin PBXFileReference section */ 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 0D096DFF0B707D1200A845D4 /* libhb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhb.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 0D6E35760B6BD4F0005AABB3 /* HandBrake.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = HandBrake.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0D6E35760B6BD4F0005AABB3 /* HandBrake.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HandBrake.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0DF377970B7BF99A00115CB0 /* fakexcode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = fakexcode.cpp; path = ../test/fakexcode.cpp; sourceTree = SOURCE_ROOT; }; 0DFA5C7A0B8DD1E90020BC09 /* HandBrake.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = HandBrake.icns; sourceTree = "<group>"; }; 0DFA5C7E0B8DD3B60020BC09 /* declpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = declpcm.c; path = ../libhb/declpcm.c; sourceTree = SOURCE_ROOT; }; diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index 2ed27ab54..f978fc48f 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -88,8 +88,8 @@ static int GetAlignedSize( int size ) [fDeinterlaceCheck setState: job->deinterlace ? NSOnState : NSOffState]; [fPARCheck setState: job->pixel_ratio ? NSOnState : NSOffState]; - MaxOutputWidth = title->width; - MaxOutputHeight = title->height; + MaxOutputWidth = job->width; + MaxOutputHeight = job->height; fPicture = 0; [self SettingsChanged: nil]; } @@ -111,12 +111,14 @@ static int GetAlignedSize( int size ) /* Copy line by line */ uint8_t * in = fBuffer; uint8_t * out = fTexBuf[0]; + for( int i = fTitle->height + 2; i--; ) { memcpy( out, in, 4 * ( fTitle->width + 2 ) ); in += 4 * ( fTitle->width + 2 ); out += 4 * GetAlignedSize( fTitle->width + 2 ); } + } if( [fEffectsCheck state] == NSOffState ) @@ -133,17 +135,18 @@ static int GetAlignedSize( int size ) height: ( fTitle->height + 2 )]; /* Set the Output Display below the Preview Picture*/ - if (fTitle->job->pixel_ratio == 1) - { int titlewidth = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3]; int arpwidth = fTitle->job->pixel_aspect_width; int arpheight = fTitle->job->pixel_aspect_height; int displayparwidth = titlewidth * arpwidth / arpheight; int displayparheight = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]; + if (fTitle->job->pixel_ratio == 1) + { + [fInfoField setStringValue: [NSString stringWithFormat: @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d", fTitle->width, fTitle->height, - titlewidth, fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1], displayparwidth, - fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]]; + MaxOutputWidth, MaxOutputHeight, displayparwidth, + displayparheight]]; } @@ -154,6 +157,7 @@ static int GetAlignedSize( int size ) fTitle->job->width, fTitle->job->height]]; } + [fPrevButton setEnabled: ( fPicture > 0 )]; [fNextButton setEnabled: ( fPicture < 9 )]; } @@ -167,8 +171,8 @@ static int GetAlignedSize( int size ) [fWidthStepper setIntValue: MaxOutputWidth]; [fWidthField setIntValue: MaxOutputWidth]; - [fHeightStepper setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; - [fHeightField setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; + [fHeightStepper setIntValue: MaxOutputHeight]; + [fHeightField setIntValue: MaxOutputHeight]; [fRatioCheck setState: 0]; [fWidthStepper setEnabled: NO]; |