diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 22 | ||||
-rw-r--r-- | macosx/Controller.mm | 107 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/classes.nib | 18 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/info.nib | 2 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/keyedobjects.nib | bin | 92816 -> 82015 bytes | |||
-rw-r--r-- | macosx/English.lproj/PictureSettings.nib/classes.nib | 162 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.nib/info.nib | 18 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.nib/keyedobjects.nib | bin | 24625 -> 26332 bytes | |||
-rw-r--r-- | macosx/PictureController.h | 9 | ||||
-rw-r--r-- | macosx/PictureController.mm | 198 |
10 files changed, 325 insertions, 211 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index cd3f715d6..a68087d23 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -98,20 +98,18 @@ /* Picture Settings box */ IBOutlet NSTextField * fPicLabelSettings; IBOutlet NSTextField * fPicLabelSrc; + IBOutlet NSTextField * fPicSettingsSrc; IBOutlet NSTextField * fPicLabelOutp; - IBOutlet NSTextField * fPicLabelAr; - IBOutlet NSTextField * fPicLabelSrcX; - IBOutlet NSTextField * fPicLabelOutputX; + IBOutlet NSTextField * fPicSettingsOutp; + IBOutlet NSTextField * fPicLabelAnamorphic; + IBOutlet NSTextField * fPicSettingsAnamorphic; + + IBOutlet NSTextField * fPicLabelAr; IBOutlet NSTextField * fPicLabelAutoCrop; IBOutlet NSTextField * fPicLabelDetelecine; IBOutlet NSTextField * fPicLabelDeinterlace; IBOutlet NSTextField * fPicLabelDenoise; IBOutlet NSTextField * fPicLabelDeblock; - - IBOutlet NSTextField * fPicSrcWidth; - IBOutlet NSTextField * fPicSrcHeight; - IBOutlet NSTextField * fPicSettingWidth; - IBOutlet NSTextField * fPicSettingHeight; IBOutlet NSTextField * fPicSettingDeinterlace; IBOutlet NSTextField * fPicSettingARkeep; IBOutlet NSTextField * fPicSettingPAR; @@ -119,12 +117,8 @@ IBOutlet NSTextField * fPicSettingDetelecine; IBOutlet NSTextField * fPicSettingDenoise; IBOutlet NSTextField * fPicSettingDeblock; - - IBOutlet NSTextField * fPicLabelAnamorphic; - IBOutlet NSTextField * fPicLabelPAROutputX; - IBOutlet NSTextField * fPicSettingPARWidth; - IBOutlet NSTextField * fPicSettingPARHeight; - /* Picture variables */ + + /* Picture variables */ int PicOrigOutputWidth; int PicOrigOutputHeight; int AutoCropTop; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 25ed44d8e..4a5488838 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -304,9 +304,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It [fVidRatePopUp selectItemAtIndex: 0]; /* Picture Settings */ - [fPicLabelPAROutputX setStringValue: @""]; - [fPicSettingPARWidth setStringValue: @""]; - [fPicSettingPARHeight setStringValue: @""]; + //[fPicLabelPAROutputX setStringValue: @""]; + //[fPicSettingPARWidth setStringValue: @""]; + //[fPicSettingPARHeight setStringValue: @""]; /* Set Auto Crop to On at launch */ [fPictureController setAutoCrop:YES]; @@ -382,12 +382,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It fAudLang1Field, fAudLang1PopUp, fAudLang2Field, fAudLang2PopUp, fAudTrack1MixLabel, fAudTrack1MixPopUp, fAudTrack2MixLabel, fAudTrack2MixPopUp, fAudRateField, fAudRatePopUp, fAudBitrateField, - fAudBitratePopUp, fPictureButton,fQueueStatus, - fPicSrcWidth,fPicSrcHeight,fPicSettingWidth,fPicSettingHeight,fPicSettingARkeep, - fPicSettingDeinterlace,fPicLabelSettings,fPicLabelSrc,fPicLabelOutp, - fPicLabelAr,fPicLabelDeinterlace,fPicLabelSrcX,fPicLabelOutputX, - fPicLabelPAROutputX,fPicSettingPARWidth,fPicSettingPARHeight, - fPicSettingPAR,fPicLabelAnamorphic,fPresetsAdd,fPresetsDelete, + fAudBitratePopUp, fPictureButton,fQueueStatus,fPicSettingARkeep, + fPicSettingDeinterlace,fPicLabelSettings,fPicLabelSrc,fPicLabelOutp,fPicSettingsSrc,fPicSettingsOutp,fPicSettingsAnamorphic, + fPicLabelAr,fPicLabelDeinterlace,fPicSettingPAR,fPicLabelAnamorphic,fPresetsAdd,fPresetsDelete, fCreateChapterMarkers,fVidTurboPassCheck,fDstMp4LargeFileCheck,fPicLabelAutoCrop, fPicSettingAutoCrop,fPicSettingDetelecine,fPicLabelDetelecine,fPicLabelDenoise,fPicSettingDenoise, fSubForcedCheck,fPicSettingDeblock,fPicLabelDeblock,fPresetsOutlineView,fAudDrcSlider, @@ -2044,17 +2041,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* Start Get and set the initial pic size for display */ hb_job_t * job = title->job; fTitle = title; - /* Turn Deinterlace on/off depending on the preference */ - /* - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultDeinterlaceOn"] > 0) - { - [fPictureController setDeinterlace:1]; - } - else - { - [fPictureController setDeinterlace:0]; - } - */ + /* Pixel Ratio Setting */ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PixelRatio"]) { @@ -2064,12 +2051,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It { job->pixel_ratio = 0 ; } - /*Set Source Size Fields Here */ - [fPicSrcWidth setStringValue: [NSString stringWithFormat: - @"%d", fTitle->width]]; - [fPicSrcHeight setStringValue: [NSString stringWithFormat: - @"%d", fTitle->height]]; - + /*Set Source Size Field Here */ + [fPicSettingsSrc setStringValue: [NSString stringWithFormat: @"%d x %d", fTitle->width, fTitle->height]]; + /* Set Auto Crop to on upon selecting a new title */ [fPictureController setAutoCrop:YES]; @@ -2081,11 +2065,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It AutoCropBottom = job->crop[1]; AutoCropLeft = job->crop[2]; AutoCropRight = job->crop[3]; - /* 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]]; + /* we run the picture size values through calculatePictureSizing to get all picture size information*/ @@ -2370,18 +2350,17 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* so call audioTrackPopUpChanged for both audio tracks to update the mixdown popups */ [self audioTrackPopUpChanged: fAudLang1PopUp]; [self audioTrackPopUpChanged: fAudLang2PopUp]; + [self encoderPopUpChanged: sender]; - [self calculateBitrate: sender]; - [self twoPassCheckboxChanged: sender]; } - (IBAction) encoderPopUpChanged: (id) sender { - + hb_job_t * job = fTitle->job; /* Check to see if we need to modify the job pic values based on x264 (iPod) encoder selection */ if ([fDstFormatPopUp indexOfSelectedItem] == 0 && [fDstCodecsPopUp indexOfSelectedItem] == 1 && [fVidEncoderPopUp indexOfSelectedItem] == 1) { - hb_job_t * job = fTitle->job; + job->pixel_ratio = 0 ; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPicSizeAutoiPod"] > 0) @@ -2399,6 +2378,23 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It [fDstMp4LargeFileCheck setState: NSOffState]; } + /* We need to set loose anamorphic as available depending on whether or not the ffmpeg encoder + is being used as it borks up loose anamorphic . + For convenience lets use the titleOfSelected index. Probably should revisit whether or not we want + to use the index itself but this is easier */ + if ([fVidEncoderPopUp titleOfSelectedItem] == @"FFmpeg") + { + if (job->pixel_ratio == 2) + { + job->pixel_ratio = 0; + } + [fPictureController setAllowLooseAnamorphic:NO]; + } + else + { + [fPictureController setAllowLooseAnamorphic:YES]; + } + [self calculatePictureSizing: sender]; [self twoPassCheckboxChanged: sender]; } @@ -2572,32 +2568,37 @@ the user is using "Custom" settings by determining the sender*/ /* Get and Display Current Pic Settings in main window */ - (IBAction) calculatePictureSizing: (id) sender { - [fPicSettingWidth setStringValue: [NSString stringWithFormat:@"%d", fTitle->job->width]]; - [fPicSettingHeight setStringValue: [NSString stringWithFormat:@"%d", fTitle->job->height]]; - - if (fTitle->job->pixel_ratio == 1) + [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", fTitle->job->width, fTitle->job->height]]; + + 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]; + [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", titlewidth, displayparheight]]; + [fPicSettingsAnamorphic setStringValue: [NSString stringWithFormat:@"%d x %d Strict", displayparwidth, displayparheight]]; + fTitle->job->keep_ratio = 0; + } + else if (fTitle->job->pixel_ratio == 2) + { + hb_job_t * job = fTitle->job; + int output_width, output_height, output_par_width, output_par_height; + hb_set_anamorphic_size(job, &output_width, &output_height, &output_par_width, &output_par_height); + int display_width; + display_width = output_width * output_par_width / output_par_height; - [fPicSettingWidth setStringValue: [NSString stringWithFormat:@"%d", titlewidth]]; - [fPicSettingHeight setStringValue: [NSString stringWithFormat:@"%d", displayparheight]]; - [fPicLabelPAROutputX setStringValue: @"x"]; - [fPicSettingPARWidth setStringValue: [NSString stringWithFormat:@"%d", displayparwidth]]; - [fPicSettingPARHeight setStringValue: [NSString stringWithFormat:@"%d", displayparheight]]; + [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", output_width, output_height]]; + [fPicSettingsAnamorphic setStringValue: [NSString stringWithFormat:@"%d x %d Loose", display_width, output_height]]; fTitle->job->keep_ratio = 0; - } + } else { - [fPicLabelPAROutputX setStringValue: @""]; - [fPicSettingPARWidth setStringValue: @""]; - [fPicSettingPARHeight setStringValue: @""]; + [fPicSettingsAnamorphic setStringValue: [NSString stringWithFormat:@"Off"]]; } - + /* Set ON/Off values for the deinterlace/keep aspect ratio according to boolean */ if (fTitle->job->keep_ratio > 0) { @@ -2618,7 +2619,7 @@ the user is using "Custom" settings by determining the sender*/ /* VFR (Variable Frame Rate) */ if ([fPictureController vfr]) { /* vfr has to set the framerate to 29.97 (ntsc video) - and disable the framerate popup */ + and disable the framerate popup */ [fVidRatePopUp selectItemAtIndex: 8]; [fVidRatePopUp setEnabled: NO]; /* We change the string of the fps popup to warn that vfr is on Framerate (FPS): */ @@ -2631,7 +2632,7 @@ the user is using "Custom" settings by determining the sender*/ /* and make sure the label for framerate is set to its default */ [fVidRateField setStringValue: @"Framerate (FPS):"]; } - + /* Deinterlace */ if ([fPictureController deinterlace] == 0) { @@ -2670,7 +2671,7 @@ the user is using "Custom" settings by determining the sender*/ { [fPicSettingDenoise setStringValue: @"Strong"]; } - + /* Deblock */ if ([fPictureController deblock]) { [fPicSettingDeblock setStringValue: @"Yes"]; @@ -2697,7 +2698,7 @@ the user is using "Custom" settings by determining the sender*/ [fPicSettingAutoCrop setStringValue: @"Auto"]; } - + } diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index fe465b1ae..a1654d0c7 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -196,16 +196,10 @@ <string>NSTextField</string> <key>fPicLabelOutp</key> <string>NSTextField</string> - <key>fPicLabelOutputX</key> - <string>NSTextField</string> - <key>fPicLabelPAROutputX</key> - <string>NSTextField</string> <key>fPicLabelSettings</key> <string>NSTextField</string> <key>fPicLabelSrc</key> <string>NSTextField</string> - <key>fPicLabelSrcX</key> - <string>NSTextField</string> <key>fPicSettingARkeep</key> <string>NSTextField</string> <key>fPicSettingAutoCrop</key> @@ -218,19 +212,13 @@ <string>NSTextField</string> <key>fPicSettingDetelecine</key> <string>NSTextField</string> - <key>fPicSettingHeight</key> - <string>NSTextField</string> <key>fPicSettingPAR</key> <string>NSTextField</string> - <key>fPicSettingPARHeight</key> - <string>NSTextField</string> - <key>fPicSettingPARWidth</key> - <string>NSTextField</string> - <key>fPicSettingWidth</key> + <key>fPicSettingsAnamorphic</key> <string>NSTextField</string> - <key>fPicSrcHeight</key> + <key>fPicSettingsOutp</key> <string>NSTextField</string> - <key>fPicSrcWidth</key> + <key>fPicSettingsSrc</key> <string>NSTextField</string> <key>fPictureButton</key> <string>NSButton</string> diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 2c679cd24..4888833ae 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -10,7 +10,7 @@ <integer>5</integer> <key>IBOpenObjects</key> <array> - <integer>2</integer> + <integer>1478</integer> </array> <key>IBSystem Version</key> <string>9B18</string> diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib Binary files differindex c33ccfe43..9bf9e598c 100644 --- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib +++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib diff --git a/macosx/English.lproj/PictureSettings.nib/classes.nib b/macosx/English.lproj/PictureSettings.nib/classes.nib index cfecb9ddb..ae456d39c 100644 --- a/macosx/English.lproj/PictureSettings.nib/classes.nib +++ b/macosx/English.lproj/PictureSettings.nib/classes.nib @@ -1,49 +1,113 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = HBPictureGLView; LANGUAGE = ObjC; SUPERCLASS = NSOpenGLView; }, - {CLASS = NSObject; LANGUAGE = ObjC; }, - { - ACTIONS = { - ClosePanel = id; - NextPicture = id; - PreviousPicture = id; - SettingsChanged = id; - }; - CLASS = PictureController; - LANGUAGE = ObjC; - OUTLETS = { - delegate = id; - fCropBottomField = NSTextField; - fCropBottomStepper = NSStepper; - fCropLeftField = NSTextField; - fCropLeftStepper = NSStepper; - fCropMatrix = NSMatrix; - fCropRightField = NSTextField; - fCropRightStepper = NSStepper; - fCropTopField = NSTextField; - fCropTopStepper = NSStepper; - fDeblockCheck = NSButton; - fDeinterlacePopUp = NSPopUpButton; - fDenoisePopUp = NSPopUpButton; - fDetelecineCheck = NSButton; - fEffectsCheck = NSButton; - fHeightField = NSTextField; - fHeightStepper = NSStepper; - fInfoField = NSTextField; - fNextButton = NSButton; - fPARCheck = NSButton; - fPictureGLView = HBPictureGLView; - fPictureGLViewArea = NSBox; - fPicturePanel = NSPanel; - fPrevButton = NSButton; - fRatioCheck = NSButton; - fVFRCheck = NSButton; - fWidthField = NSTextField; - fWidthStepper = NSStepper; - }; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -}
\ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBClasses</key> + <array> + <dict> + <key>CLASS</key> + <string>HBPictureGLView</string> + <key>LANGUAGE</key> + <string>ObjC</string> + <key>SUPERCLASS</key> + <string>NSOpenGLView</string> + </dict> + <dict> + <key>ACTIONS</key> + <dict> + <key>ClosePanel</key> + <string>id</string> + <key>NextPicture</key> + <string>id</string> + <key>PreviousPicture</key> + <string>id</string> + <key>SettingsChanged</key> + <string>id</string> + </dict> + <key>CLASS</key> + <string>PictureController</string> + <key>LANGUAGE</key> + <string>ObjC</string> + <key>OUTLETS</key> + <dict> + <key>delegate</key> + <string>id</string> + <key>fAnamorphicPopUp</key> + <string>NSPopUpButton</string> + <key>fCropBottomField</key> + <string>NSTextField</string> + <key>fCropBottomStepper</key> + <string>NSStepper</string> + <key>fCropLeftField</key> + <string>NSTextField</string> + <key>fCropLeftStepper</key> + <string>NSStepper</string> + <key>fCropMatrix</key> + <string>NSMatrix</string> + <key>fCropRightField</key> + <string>NSTextField</string> + <key>fCropRightStepper</key> + <string>NSStepper</string> + <key>fCropTopField</key> + <string>NSTextField</string> + <key>fCropTopStepper</key> + <string>NSStepper</string> + <key>fDeblockCheck</key> + <string>NSButton</string> + <key>fDeinterlacePopUp</key> + <string>NSPopUpButton</string> + <key>fDenoisePopUp</key> + <string>NSPopUpButton</string> + <key>fDetelecineCheck</key> + <string>NSButton</string> + <key>fEffectsCheck</key> + <string>NSButton</string> + <key>fHeightField</key> + <string>NSTextField</string> + <key>fHeightStepper</key> + <string>NSStepper</string> + <key>fInfoField</key> + <string>NSTextField</string> + <key>fNextButton</key> + <string>NSButton</string> + <key>fPARCheck</key> + <string>NSButton</string> + <key>fPictureGLView</key> + <string>HBPictureGLView</string> + <key>fPictureGLViewArea</key> + <string>NSBox</string> + <key>fPicturePanel</key> + <string>NSPanel</string> + <key>fPrevButton</key> + <string>NSButton</string> + <key>fRatioCheck</key> + <string>NSButton</string> + <key>fVFRCheck</key> + <string>NSButton</string> + <key>fWidthField</key> + <string>NSTextField</string> + <key>fWidthStepper</key> + <string>NSStepper</string> + </dict> + <key>SUPERCLASS</key> + <string>NSObject</string> + </dict> + <dict> + <key>CLASS</key> + <string>FirstResponder</string> + <key>LANGUAGE</key> + <string>ObjC</string> + <key>SUPERCLASS</key> + <string>NSObject</string> + </dict> + <dict> + <key>CLASS</key> + <string>NSObject</string> + <key>LANGUAGE</key> + <string>ObjC</string> + </dict> + </array> + <key>IBVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/macosx/English.lproj/PictureSettings.nib/info.nib b/macosx/English.lproj/PictureSettings.nib/info.nib index 2f049637a..36055763b 100644 --- a/macosx/English.lproj/PictureSettings.nib/info.nib +++ b/macosx/English.lproj/PictureSettings.nib/info.nib @@ -1,16 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>IBDocumentLocation</key> - <string>45 380 356 240 0 0 1440 878 </string> <key>IBFramework Version</key> - <string>446.1</string> + <string>629</string> + <key>IBLastKnownRelativeProjectPath</key> + <string>../../HandBrake.xcodeproj</string> + <key>IBOldestOS</key> + <integer>5</integer> <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> + <array/> <key>IBSystem Version</key> - <string>8R2218</string> + <string>9B18</string> + <key>targetFramework</key> + <string>IBCocoaFramework</string> </dict> </plist> diff --git a/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib b/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib Binary files differindex a3cac2a7f..20eea9f88 100644 --- a/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib +++ b/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib diff --git a/macosx/PictureController.h b/macosx/PictureController.h index b15eedb6d..a418ba40c 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -44,7 +44,7 @@ IBOutlet NSButton * fVFRCheck; IBOutlet NSButton * fDeblockCheck; IBOutlet NSPopUpButton * fDenoisePopUp; - IBOutlet NSButton * fPARCheck; + IBOutlet NSPopUpButton * fAnamorphicPopUp; IBOutlet NSButton * fEffectsCheck; IBOutlet NSButton * fPrevButton; IBOutlet NSButton * fNextButton; @@ -53,7 +53,9 @@ int MaxOutputWidth; int MaxOutputHeight; BOOL autoCrop; - + BOOL allowLooseAnamorphic; + int output_width, output_height, output_par_width, output_par_height; + int display_width; /* used to track the previous state of the keep aspect ratio checkbox when turning anamorphic on, so it can be returned to the previous state when anamorphic is turned @@ -85,6 +87,9 @@ - (BOOL) autoCrop; - (void) setAutoCrop: (BOOL) setting; +- (BOOL) allowLooseAnamorphic; +- (void) setAllowLooseAnamorphic: (BOOL) setting; + - (int) detelecine; - (void) setDetelecine: (int) setting; - (int) vfr; diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index 4a27da9c5..8526b849a 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -105,7 +105,19 @@ static int GetAlignedSize( int size ) [fCropLeftStepper setMaxValue: title->width/2-2]; [fCropRightStepper setMaxValue: title->width/2-2]; - [fPARCheck setState:(job->pixel_ratio ? NSOnState : NSOffState)]; + /* Populate the Anamorphic NSPopUp button here */ + [fAnamorphicPopUp removeAllItems]; + [fAnamorphicPopUp addItemWithTitle: @"None"]; + [fAnamorphicPopUp addItemWithTitle: @"Strict"]; + if (allowLooseAnamorphic) + { + [fAnamorphicPopUp addItemWithTitle: @"Loose"]; + } + [fAnamorphicPopUp selectItemAtIndex: job->pixel_ratio]; + + /* Set deinterlaces level according to the integer in the main window */ + [fDeinterlacePopUp selectItemAtIndex: fPictureFilterSettings.deinterlace]; + /* We initially set the previous state of keep ar to on */ keepAspectRatioPreviousState = 1; if (!autoCrop) @@ -126,10 +138,9 @@ static int GetAlignedSize( int size ) [fCropMatrix selectCellAtRow: 0 column:0]; } - MaxOutputWidth = job->width; - MaxOutputHeight = job->height; fPicture = 0; - + MaxOutputWidth = title->width - job->crop[2] - job->crop[3]; + MaxOutputHeight = title->height - job->crop[0] - job->crop[1]; [self SettingsChanged: nil]; } @@ -161,10 +172,10 @@ are maintained across different sources */ - (void) Display: (int) anim { hb_get_preview( fHandle, fTitle, fPicture, fBuffer ); - + /* Backup previous picture (for effects) */ memcpy( fTexBuf[1], fTexBuf[0], fTexBufSize ); - + if( fHasQE ) { /* Simply copy */ @@ -182,9 +193,9 @@ are maintained across different sources */ in += 4 * ( fTitle->width + 2 ); out += 4 * GetAlignedSize( fTitle->width + 2 ); } - + } - + if( [fEffectsCheck state] == NSOffState ) { anim = HB_ANIMATE_NONE; @@ -193,34 +204,45 @@ are maintained across different sources */ { anim |= HB_ANIMATE_SLOW; } - + [fPictureGLView Display: anim buffer1: fTexBuf[0] - buffer2: fTexBuf[1] width: ( fTitle->width + 2 ) - height: ( fTitle->height + 2 )]; + buffer2: fTexBuf[1] width: ( fTitle->width + 2 ) + height: ( fTitle->height + 2 )]; - /* Set the Output Display below the Preview Picture*/ - 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]; - - NSSize displaySize = NSMakeSize( (float)fTitle->width, (float)fTitle->height ); - if( fTitle->job->pixel_ratio == 1 ) + NSSize displaySize = NSMakeSize( (float)fTitle->width, (float)fTitle->height ); + /* Set the picture size display fields below the Preview Picture*/ + if( fTitle->job->pixel_ratio == 1 ) // Original PAR Implementation { + output_width = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3]; + output_height = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]; + display_width = output_width * fTitle->job->pixel_aspect_width / fTitle->job->pixel_aspect_height; [fInfoField setStringValue:[NSString stringWithFormat: - @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d", - fTitle->width, fTitle->height, titlewidth, - displayparheight, displayparwidth, displayparheight]]; - displaySize.width *= ((float)arpwidth) / ((float)arpheight); + @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d", + fTitle->width, fTitle->height, output_width, output_height, display_width, output_height]]; + displaySize.width *= ((float)fTitle->job->pixel_aspect_width) / ((float)fTitle->job->pixel_aspect_height); } - else + else if (fTitle->job->pixel_ratio == 2) // Loose Anamorphic { - [fInfoField setStringValue: [NSString stringWithFormat: - @"Source: %dx%d, Output: %dx%d", fTitle->width, fTitle->height, - fTitle->job->width, fTitle->job->height]]; + display_width = output_width * output_par_width / output_par_height; + [fInfoField setStringValue:[NSString stringWithFormat: + @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d", + fTitle->width, fTitle->height, output_width, output_height, display_width, output_height]]; + + /* FIXME: needs to be fixed so that the picture window does not resize itself on the first + anamorphic width drop + */ + if (fTitle->width - 8 < output_width) + { + displaySize.width *= ((float)output_par_width) / ((float)output_par_height); + } } - + else // No Anamorphic + { + [fInfoField setStringValue: [NSString stringWithFormat: + @"Source: %dx%d, Output: %dx%d", fTitle->width, fTitle->height, + fTitle->job->width, fTitle->job->height]]; + } + NSSize viewSize = [self optimalViewSizeForImageSize:displaySize]; if( [self viewNeedsToResizeToSize:viewSize] ) { @@ -234,13 +256,13 @@ are maintained across different sources */ { float scale = viewSize.width / ((float)fTitle->width); NSString *scaleString = [NSString stringWithFormat: - NSLocalizedString( @" (Preview scaled to %.0f%% actual size)", - @"String shown when a preview is scaled" ), - scale * 100.0]; + NSLocalizedString( @" (Preview scaled to %.0f%% actual size)", + @"String shown when a preview is scaled" ), + scale * 100.0]; [fInfoField setStringValue: - [[fInfoField stringValue] stringByAppendingString:scaleString]]; + [[fInfoField stringValue] stringByAppendingString:scaleString]]; } - + [fPrevButton setEnabled: ( fPicture > 0 )]; [fNextButton setEnabled: ( fPicture < 9 )]; } @@ -249,84 +271,109 @@ are maintained across different sources */ { hb_job_t * job = fTitle->job; - if( [fPARCheck state] == NSOnState ) + if( [fAnamorphicPopUp indexOfSelectedItem] > 0 ) { - [fWidthStepper setIntValue: MaxOutputWidth]; - [fWidthField setIntValue: MaxOutputWidth]; + if ([fAnamorphicPopUp indexOfSelectedItem] == 2) // Loose anamorphic + { + job->pixel_ratio = 2; + [fWidthStepper setEnabled: YES]; + [fWidthField setEnabled: YES]; + /* We set job->width and call hb_set_anamorphic_size in libhb to do a "dry run" to get + * the values to be used by libhb for loose anamorphic + */ + job->width = [fWidthStepper intValue]; + hb_set_anamorphic_size(job, &output_width, &output_height, &output_par_width, &output_par_height); + [fHeightStepper setIntValue: output_height]; + [fHeightField setIntValue: output_height]; + job->height = [fHeightStepper intValue]; + + } + else // must be "1" or strict anamorphic + { + [fWidthStepper setIntValue: fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3]]; + [fWidthField setIntValue: fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3]]; + + /* This will show correct anamorphic height values, but + show distorted preview picture ratio */ + [fHeightStepper setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; + [fHeightField setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; + job->width = [fWidthStepper intValue]; + job->height = [fHeightStepper intValue]; + + job->pixel_ratio = 1; + [fWidthStepper setEnabled: NO]; + [fWidthField setEnabled: NO]; + } - /* This will show correct anamorphic height values, but - show distorted preview picture ratio */ - [fHeightStepper setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; - [fHeightField setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; - /* if the sender is the Anamorphic checkbox, record the state - of KeepAspect Ratio so it can be reset if Anamorphic is unchecked again */ - if (sender == fPARCheck) + of KeepAspect Ratio so it can be reset if Anamorphic is unchecked again */ + if (sender == fAnamorphicPopUp) { - keepAspectRatioPreviousState = [fRatioCheck state]; + keepAspectRatioPreviousState = [fRatioCheck state]; } [fRatioCheck setState:NSOffState]; [fRatioCheck setEnabled: NO]; - [fWidthStepper setEnabled: NO]; - [fWidthField setEnabled: NO]; + [fHeightStepper setEnabled: NO]; [fHeightField setEnabled: NO]; } else { + job->width = [fWidthStepper intValue]; + job->height = [fHeightStepper intValue]; + job->pixel_ratio = 0; [fWidthStepper setEnabled: YES]; [fWidthField setEnabled: YES]; [fHeightStepper setEnabled: YES]; [fHeightField setEnabled: YES]; [fRatioCheck setEnabled: YES]; /* if the sender is the Anamorphic checkbox, we return the - keep AR checkbox to its previous state */ - if (sender == fPARCheck) + keep AR checkbox to its previous state */ + if (sender == fAnamorphicPopUp) { - [fRatioCheck setState:keepAspectRatioPreviousState]; + [fRatioCheck setState:keepAspectRatioPreviousState]; } } - job->width = [fWidthStepper intValue]; - job->height = [fHeightStepper intValue]; + job->keep_ratio = ( [fRatioCheck state] == NSOnState ); fPictureFilterSettings.deinterlace = [fDeinterlacePopUp indexOfSelectedItem]; /* if the gui deinterlace settings are fast through slowest, the job->deinterlace - value needs to be set to one, for the job as well as the previews showing deinterlacing - otherwise set job->deinterlace to 0 or "off" */ + value needs to be set to one, for the job as well as the previews showing deinterlacing + otherwise set job->deinterlace to 0 or "off" */ if (fPictureFilterSettings.deinterlace > 0) { - job->deinterlace = 1; + job->deinterlace = 1; } else { - job->deinterlace = 0; + job->deinterlace = 0; } fPictureFilterSettings.denoise = [fDenoisePopUp indexOfSelectedItem]; fPictureFilterSettings.vfr = [fVFRCheck state]; if (fPictureFilterSettings.vfr > 0) { - [fDetelecineCheck setState:NSOnState]; - [fDetelecineCheck setEnabled: NO]; + [fDetelecineCheck setState:NSOnState]; + [fDetelecineCheck setEnabled: NO]; } else { - [fDetelecineCheck setEnabled: YES]; + [fDetelecineCheck setEnabled: YES]; } fPictureFilterSettings.detelecine = [fDetelecineCheck state]; fPictureFilterSettings.deblock = [fDeblockCheck state]; - job->pixel_ratio = ( [fPARCheck state] == NSOnState ); - + //job->pixel_ratio = ( [fPARCheck state] == NSOnState ); + autoCrop = ( [fCropMatrix selectedRow] == 0 ); [fCropTopStepper setEnabled: !autoCrop]; [fCropBottomStepper setEnabled: !autoCrop]; [fCropLeftStepper setEnabled: !autoCrop]; [fCropRightStepper setEnabled: !autoCrop]; - + if( autoCrop ) { memcpy( job->crop, fTitle->crop, 4 * sizeof( int ) ); @@ -338,11 +385,11 @@ are maintained across different sources */ job->crop[2] = [fCropLeftStepper intValue]; job->crop[3] = [fCropRightStepper intValue]; } - + if( job->keep_ratio ) { if( sender == fWidthStepper || sender == fRatioCheck || - sender == fCropTopStepper || sender == fCropBottomStepper ) + sender == fCropTopStepper || sender == fCropBottomStepper ) { hb_fix_aspect( job, HB_KEEP_WIDTH ); if( job->height > fTitle->height ) @@ -364,8 +411,11 @@ are maintained across different sources */ [fWidthStepper setIntValue: job->width]; [fWidthField setIntValue: job->width]; - [fHeightStepper setIntValue: job->height]; - [fHeightField setIntValue: job->height]; + if( [fAnamorphicPopUp indexOfSelectedItem] < 2 ) + { + [fHeightStepper setIntValue: job->height]; + [fHeightField setIntValue: job->height]; + } [fCropTopStepper setIntValue: job->crop[0]]; [fCropTopField setIntValue: job->crop[0]]; [fCropBottomStepper setIntValue: job->crop[1]]; @@ -375,9 +425,9 @@ are maintained across different sources */ [fCropRightStepper setIntValue: job->crop[3]]; [fCropRightField setIntValue: job->crop[3]]; /* Sanity Check Here for < 16 px preview to avoid - crashing hb_get_preview. In fact, just for kicks - lets getting previews at a min limit of 32, since - no human can see any meaningful detail below that */ + crashing hb_get_preview. In fact, just for kicks + lets getting previews at a min limit of 32, since + no human can see any meaningful detail below that */ if (job->width >= 64 && job->height >= 64) { [self Display: HB_ANIMATE_NONE]; @@ -422,6 +472,16 @@ are maintained across different sources */ autoCrop = setting; } +- (BOOL) allowLooseAnamorphic +{ + return allowLooseAnamorphic; +} + +- (void) setAllowLooseAnamorphic: (BOOL) setting +{ + allowLooseAnamorphic = setting; +} + - (int) detelecine { return fPictureFilterSettings.detelecine; |