From: dynaflash Date: Mon, 13 Aug 2007 17:02:37 +0000 (+0000) Subject: MacGui: Detelecine initial implementation X-Git-Tag: 0.9.0~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d03e655fbc53a95e56ebd28d367175a0202a8c6;p=handbrake MacGui: Detelecine initial implementation - Added -VideoFramerateChanged method to controller.mm to detect NTSC Film content to error check detelecine. - Auto detected or manually choosing 23.967 (NTSC Film) disables detelecine checkbox in the picture preview window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@800 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/macosx/Controller.h b/macosx/Controller.h index c415f98b6..68df8913b 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -99,6 +99,9 @@ IBOutlet NSTextField * fPicSettingAutoCrop; IBOutlet NSTextField * fPicSettingAutoCropDsply; IBOutlet NSTextField * fPicSettingDeinterlaceDsply; + IBOutlet NSTextField * fPicSettingDetelecine; + IBOutlet NSTextField * fPicSettingDetelecineLabel; + IBOutlet NSTextField * fPicLabelAnamorphic; IBOutlet NSTextField * fPicLabelPAROutp; IBOutlet NSTextField * fPicLabelPAROutputX; @@ -245,6 +248,7 @@ - (IBAction) CodecsPopUpChanged: (id) sender; - (IBAction) EncoderPopUpChanged: (id) sender; - (IBAction) TwoPassCheckboxChanged: (id) sender; +- (IBAction ) VideoFrameRateChanged: (id) sender; - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender; - (IBAction) AddAllAudioTracksToPopUp: (id) sender; - (IBAction) SelectAudioTrackInPopUp: (id) sender searchPrefixString: (NSString *) searchPrefixString selectIndexIfNotFound: (int) selectIndexIfNotFound; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 964254c0c..2c59450b0 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -263,7 +263,10 @@ static NSString* ChooseSourceIdentifier = @"Choose Source Item Identifie [fPicSettingPARWidth setStringValue: @""]; [fPicSettingPARHeight setStringValue: @""]; - /* Audio bitrate */ + /*Set detelecine to Off upon launch */ + [fPicSettingDetelecine setStringValue: @"No"]; + + /* Audio bitrate */ [fAudBitratePopUp removeAllItems]; for( int i = 0; i < hb_audio_bitrates_count; i++ ) { @@ -1082,7 +1085,7 @@ list = hb_get_titles( fHandle ); fX264optDirectPredLabel,fX264optDirectPredPopUp,fX264optDeblockLabel,fX264optAnalyseLabel, fX264optAnalysePopUp,fX264opt8x8dctLabel,fX264opt8x8dctSwitch,fX264optCabacLabel,fX264optCabacSwitch, fX264optAlphaDeblockPopUp,fX264optBetaDeblockPopUp,fVidTurboPassCheck,fDstMpgLargeFileCheck,fPicSettingAutoCropLabel, - fPicSettingAutoCropDsply}; + fPicSettingAutoCropDsply,fPicSettingDetelecine,fPicSettingDetelecineLabel}; for( unsigned i = 0; i < sizeof( controls ) / sizeof( NSControl * ); i++ ) @@ -1409,6 +1412,13 @@ list = hb_get_titles( fHandle ); } job->filters = hb_list_init(); + /* Detelecine */ + if ([[fPicSettingDetelecine stringValue] isEqualToString: @"Yes"]) + { + hb_list_add( job->filters, &hb_filter_detelecine ); + } + + /* Deinterlace */ if( job->deinterlace == 1) { if ([fPicSettingDeinterlace intValue] == 1) @@ -2000,6 +2010,15 @@ list = hb_get_titles( fHandle ); [self CustomSettingUsed: sender]; } +- (IBAction ) VideoFrameRateChanged: (id) sender +{ +/* We call method method to CalculatePictureSizing to error check detelecine*/ +[self CalculatePictureSizing: sender]; + +/* We call method method to change UI to reflect whether a preset is used or not*/ + [self CustomSettingUsed: sender]; +} + - (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender { @@ -2468,6 +2487,13 @@ list = hb_get_titles( fHandle ); { [fPicSettingAutoCropDsply setStringValue: @"Auto"]; } + /* check video framerate and turn off detelecine if necessary */ + if (fTitle->rate_base == 1126125 || [[fVidRatePopUp titleOfSelectedItem] isEqualToString: @"23.976 (NTSC Film)"]) + { + [fPicSettingDetelecine setStringValue: @"No"]; + } + + /* below will trigger the preset, if selected, to be changed to "Custom". Lets comment out for now until diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 56978b1c7..0fb334d92 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -39,6 +39,7 @@ ShowScanPanel = id; TitlePopUpChanged = id; TwoPassCheckboxChanged = id; + VideoFrameRateChanged = id; VideoMatrixChanged = id; X264AdvancedOptionsChanged = id; X264AdvancedOptionsSet = id; @@ -94,6 +95,8 @@ fPicSettingAutoCropLabel = NSTextField; fPicSettingDeinterlace = NSTextField; fPicSettingDeinterlaceDsply = NSTextField; + fPicSettingDetelecine = NSTextField; + fPicSettingDetelecineLabel = NSTextField; fPicSettingHeight = NSTextField; fPicSettingPAR = NSTextField; fPicSettingPARDsply = NSTextField; @@ -229,6 +232,8 @@ fCropTopStepper = NSStepper; fDeinterlaceLevelMainWindow = NSTextField; fDeinterlacePopUp = NSPopUpButton; + fDetelecineCheck = NSButton; + fDetelecineMainWindow = NSTextField; fEffectsCheck = NSButton; fHeightField = NSTextField; fHeightStepper = NSStepper; @@ -245,6 +250,7 @@ fPictureGLView = HBPictureGLView; fPrevButton = NSButton; fRatioCheck = NSButton; + fVidFrameRatePopUpMainWindow = NSPopUpButton; fWidthField = NSTextField; fWidthStepper = NSStepper; }; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index fb661e2d8..9d18815dc 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 87 46 558 375 0 0 1440 878 + -2 463 763 415 0 0 1440 878 IBEditorPositions 1843 @@ -28,9 +28,8 @@ IBOpenObjects 2436 + 365 21 - 29 - 1843 IBSystem Version 8R2218 diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index e6539fd7b..a4fcb87b5 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/macosx/PictureController.h b/macosx/PictureController.h index b7c93c79d..5e876b555 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -37,6 +37,7 @@ IBOutlet NSTextField * fCropRightField; IBOutlet NSStepper * fCropRightStepper; IBOutlet NSPopUpButton * fDeinterlacePopUp; + IBOutlet NSButton * fDetelecineCheck; IBOutlet NSButton * fPARCheck; IBOutlet NSButton * fEffectsCheck; IBOutlet NSButton * fPrevButton; @@ -51,6 +52,9 @@ /* widgets in main window */ IBOutlet NSTextField * fAutoCropMainWindow; IBOutlet NSTextField * fDeinterlaceLevelMainWindow; + IBOutlet NSTextField * fDetelecineMainWindow; + IBOutlet NSPopUpButton * fVidFrameRatePopUpMainWindow; + } diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index afdb6f6cc..0cf80da05 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -117,6 +117,31 @@ static int GetAlignedSize( int size ) { [fCropMatrix selectCellAtRow: 0 column:0]; } + + /* set the detelecine state according to the state in main window */ + /* if framerate is 23.976 we do not allow detelecine, otherwise, enable and set according to fDetelecineMainWindow outlet */ + if (fTitle->rate_base == 1126125 || [[fVidFrameRatePopUpMainWindow titleOfSelectedItem] isEqualToString: @"23.976 (NTSC Film)"]) + { + [fDetelecineMainWindow setStringValue: @"No"]; + [fDetelecineCheck setEnabled: NO]; + [fDetelecineCheck setState: NSOffState]; + + } + else + { + [fDetelecineCheck setEnabled: YES]; + if ([[fDetelecineMainWindow stringValue] isEqualToString: @"Yes"]) + { + [fDetelecineCheck setState: NSOnState]; + } + else + { + [fDetelecineCheck setState: NSOffState]; + } + + } + + MaxOutputWidth = job->width; MaxOutputHeight = job->height; fPicture = 0; @@ -245,6 +270,16 @@ static int GetAlignedSize( int size ) job->deinterlace = 1; } + /* set the detelecine state according to the integer set in the main window field */ + if ([fDetelecineCheck state] == 1) + { + [fDetelecineMainWindow setStringValue: @"Yes"]; + } + else + { + [fDetelecineMainWindow setStringValue: @"No"]; + } + job->pixel_ratio = ( [fPARCheck state] == NSOnState );