From abfd603adac74e6bc916dee2079625d235f22b8d Mon Sep 17 00:00:00 2001 From: jbrjake Date: Wed, 11 Feb 2009 22:56:00 +0000 Subject: MacGui: Adds a widget for adaptive b-frames to the x264 advanced tab. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2144 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/English.lproj/AdvancedView.xib | 236 ++++++++++++++++++++++++++++++++-- macosx/HBAdvancedController.h | 2 + macosx/HBAdvancedController.m | 57 +++++++- 3 files changed, 281 insertions(+), 14 deletions(-) (limited to 'macosx') diff --git a/macosx/English.lproj/AdvancedView.xib b/macosx/English.lproj/AdvancedView.xib index e3149a04c..3b01a8907 100644 --- a/macosx/English.lproj/AdvancedView.xib +++ b/macosx/English.lproj/AdvancedView.xib @@ -149,7 +149,7 @@ 256 - {{20, 214}, {128, 13}} + {{94, 210}, {54, 17}} YES @@ -162,6 +162,22 @@ + + + 256 + {{48, 179}, {100, 26}} + + YES + + 67239424 + 71303168 + Adaptive B-Frames: + + + + + + 256 @@ -232,6 +248,76 @@ 1 + + + 256 + {{150, 191}, {84, 15}} + + YES + + -2076049856 + 264704 + + + 109199615 + 1 + + + + + + 400 + 75 + + + Item1 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + + OtherViews + + + YES + + + + Item2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 3 + YES + YES + 1 + + 256 @@ -639,7 +725,7 @@ 256 - {{20, 172}, {128, 13}} + {{46, 144}, {102, 17}} YES @@ -655,7 +741,7 @@ 256 - {{20, 151}, {128, 13}} + {{43, 126}, {105, 14}} YES @@ -687,7 +773,7 @@ 256 - {{20, 193}, {128, 13}} + {{60, 165}, {88, 17}} YES @@ -703,7 +789,7 @@ 256 - {{150, 192}, {84, 15}} + {{150, 168}, {84, 15}} YES @@ -968,7 +1054,7 @@ 256 - {{148, 171}, {22, 16}} + {{148, 147}, {22, 16}} YES @@ -989,7 +1075,7 @@ 256 - {{148, 150}, {22, 16}} + {{148, 126}, {22, 16}} YES @@ -1895,6 +1981,30 @@ 395 + + + fX264optBAdaptLabel + + + + 404 + + + + fX264optBAdaptPopUp + + + + 405 + + + + X264AdvancedOptionsChanged: + + + + 406 + @@ -1972,6 +2082,8 @@ + + x264 @@ -2900,6 +3012,64 @@ + + 396 + + + YES + + + + + + 397 + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + YES + + + + + + + + 401 + + + + + 402 + + + + + 403 + + + @@ -2997,8 +3167,22 @@ 39.IBPluginDependency 39.ImportedFromIB2 390.IBPluginDependency + 396.IBAttributePlaceholdersKey + 396.IBPluginDependency + 396.ImportedFromIB2 + 398.IBAttributePlaceholdersKey + 398.IBPluginDependency + 398.ImportedFromIB2 40.IBPluginDependency 40.ImportedFromIB2 + 400.IBPluginDependency + 400.ImportedFromIB2 + 401.IBPluginDependency + 401.ImportedFromIB2 + 402.IBPluginDependency + 402.ImportedFromIB2 + 403.IBPluginDependency + 403.ImportedFromIB2 41.IBPluginDependency 41.ImportedFromIB2 42.IBPluginDependency @@ -3328,6 +3512,36 @@ cnQgb2YgdGhlIGltYWdlLg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + YES + + YES + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3402,7 +3616,7 @@ Lg com.apple.InterfaceBuilder.CocoaPlugin - {{319, 354}, {700, 290}} + {{388, 201}, {700, 290}} com.apple.InterfaceBuilder.CocoaPlugin {{692, 501}, {700, 290}} @@ -3781,7 +3995,7 @@ Yml0cmF0ZSB0byBhY2hpZXZlIHRoZSBzYW1lIHF1YWxpdHkgYXMgQ0FCQUMuA - 395 + 406 @@ -3828,6 +4042,8 @@ Yml0cmF0ZSB0byBhY2hpZXZlIHRoZSBzYW1lIHF1YWxpdHkgYXMgQ0FCQUMuA fX264optAlphaDeblockPopUp fX264optAnalyseLabel fX264optAnalysePopUp + fX264optBAdaptLabel + fX264optBAdaptPopUp fX264optBPyramidLabel fX264optBPyramidSwitch fX264optBetaDeblockPopUp @@ -3874,6 +4090,8 @@ Yml0cmF0ZSB0byBhY2hpZXZlIHRoZSBzYW1lIHF1YWxpdHkgYXMgQ0FCQUMuA NSTextField NSPopUpButton NSTextField + NSPopUpButton + NSTextField NSButton NSPopUpButton NSTextField diff --git a/macosx/HBAdvancedController.h b/macosx/HBAdvancedController.h index 8b3638284..d7b6a20ee 100644 --- a/macosx/HBAdvancedController.h +++ b/macosx/HBAdvancedController.h @@ -53,6 +53,8 @@ IBOutlet NSTextField * fX264optPsyRDLabel; IBOutlet NSSlider * fX264optPsyTrellisSlider; IBOutlet NSTextField * fX264optPsyTrellisLabel; + IBOutlet NSPopUpButton * fX264optBAdaptPopUp; + IBOutlet NSTextField * fX264optBAdaptLabel; } // x264 Advanced Panel Methods diff --git a/macosx/HBAdvancedController.m b/macosx/HBAdvancedController.m index b1c269f6e..ac0e0a5df 100644 --- a/macosx/HBAdvancedController.m +++ b/macosx/HBAdvancedController.m @@ -71,7 +71,7 @@ fX264optWeightBLabel,fX264optWeightBSwitch, fX264optBPyramidLabel,fX264optBPyramidSwitch, fX264optDirectPredLabel,fX264optDirectPredPopUp,fX264optDeblockLabel,fX264optAnalyseLabel, fX264optAnalysePopUp,fX264opt8x8dctLabel,fX264opt8x8dctSwitch,fX264optCabacLabel,fX264optCabacSwitch, - fX264optAlphaDeblockPopUp,fX264optBetaDeblockPopUp, fX264optPsyRDSlider, fX264optPsyRDLabel, fX264optPsyTrellisSlider, fX264optPsyTrellisLabel }; + fX264optAlphaDeblockPopUp,fX264optBetaDeblockPopUp, fX264optPsyRDSlider, fX264optPsyRDLabel, fX264optPsyTrellisSlider, fX264optPsyTrellisLabel, fX264optBAdaptPopUp, fX264optBAdaptLabel }; for( i = 0; i < sizeof( controls ) / sizeof( NSControl * ); i++ ) { @@ -182,6 +182,14 @@ [fX264optDirectPredPopUp addItemWithTitle:@"Automatic"]; [fX264optDirectPredPopUp setWantsLayer:YES]; + /* Adaptive B-Frames Mode fX264optBAdaptPopUp */ + [fX264optBAdaptPopUp removeAllItems]; + [fX264optBAdaptPopUp addItemWithTitle:@"Default (1)"]; + [fX264optBAdaptPopUp addItemWithTitle:@"0"]; + [fX264optBAdaptPopUp addItemWithTitle:@"1"]; + [fX264optBAdaptPopUp addItemWithTitle:@"2"]; + [fX264optBAdaptPopUp setWantsLayer:YES]; + /*Alpha Deblock*/ [fX264optAlphaDeblockPopUp removeAllItems]; [fX264optAlphaDeblockPopUp addItemWithTitle:@"Default (0)"]; @@ -400,22 +408,30 @@ that can only be used when b-frames are enabled. */ [[fX264optWeightBSwitch animator] setHidden:YES]; [[fX264optWeightBLabel animator] setHidden:YES]; - if ( [fX264optWeightBSwitch state] == 1 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp) + if ( [fX264optWeightBSwitch state] == 1 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp && sender != fX264optBAdaptPopUp ) [fX264optWeightBSwitch performClick:self]; [[fX264optBPyramidSwitch animator] setHidden:YES]; [[fX264optBPyramidLabel animator] setHidden:YES]; - if ( [fX264optBPyramidSwitch state] == 1 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp) + if ( [fX264optBPyramidSwitch state] == 1 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp && sender != fX264optBAdaptPopUp ) [fX264optBPyramidSwitch performClick:self]; [[fX264optDirectPredPopUp animator] setHidden:YES]; [[fX264optDirectPredLabel animator] setHidden:YES]; - if ( [fX264optDirectPredPopUp indexOfSelectedItem] > 0 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp) + if ( [fX264optDirectPredPopUp indexOfSelectedItem] > 0 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp && sender != fX264optBAdaptPopUp ) { [fX264optDirectPredPopUp selectItemAtIndex: 0]; [[fX264optDirectPredPopUp cell] performClick:self]; } + + [[fX264optBAdaptPopUp animator] setHidden:YES]; + [[fX264optBAdaptLabel animator] setHidden:YES]; + if ( [fX264optDirectPredPopUp indexOfSelectedItem] > 0 && sender != fX264optWeightBSwitch && sender != fX264optBPyramidSwitch && sender != fX264optDirectPredPopUp && sender != fX264optBAdaptPopUp ) + { + [fX264optBAdaptPopUp selectItemAtIndex: 0]; + [[fX264optBAdaptPopUp cell] performClick:self]; + } } else if ( [fX264optBframesPopUp indexOfSelectedItem ] == 2) { @@ -430,6 +446,9 @@ [[fX264optDirectPredPopUp animator] setHidden:NO]; [[fX264optDirectPredLabel animator] setHidden:NO]; + + [[fX264optBAdaptPopUp animator] setHidden:NO]; + [[fX264optBAdaptLabel animator] setHidden:NO]; } else { @@ -441,6 +460,9 @@ [[fX264optDirectPredPopUp animator] setHidden:NO]; [[fX264optDirectPredLabel animator] setHidden:NO]; + + [[fX264optBAdaptPopUp animator] setHidden:NO]; + [[fX264optBAdaptLabel animator] setHidden:NO]; } if ( [fX264optCabacSwitch state] == false) @@ -667,6 +689,11 @@ { [fX264optMERangePopUp selectItemAtIndex:[optValue intValue]-3]; } + /* Adaptive B-Frames NSPopUpButton*/ + if ([optName isEqualToString:@"b-adapt"]) + { + [fX264optBAdaptPopUp selectItemAtIndex:[optValue intValue]+1]; + } /*Weighted B-Frames NSButton*/ if ([optName isEqualToString:@"weightb"]) { @@ -821,6 +848,10 @@ { optNameToChange = @"merange"; } + if (sender == fX264optBAdaptPopUp) + { + optNameToChange = @"b-adapt"; + } if (sender == fX264optWeightBSwitch) { optNameToChange = @"weightb"; @@ -1079,6 +1110,11 @@ because merange can't go below 4. So it has to be handled separately. */ thisOpt = [NSString stringWithFormat:@"%@=%d",optName,[sender indexOfSelectedItem]+3]; } + else if ([optNameToChange isEqualToString:@"b-adapt"]) + { + /* B-adapt starts at index 0 with default then goes 0, 1, 2)*/ + thisOpt = [NSString stringWithFormat:@"%@=%d", optName, [sender indexOfSelectedItem]-1]; + } else // we have a valid value to change, so change it { if ( [sender indexOfSelectedItem] != 0 ) @@ -1208,7 +1244,6 @@ break; } } - else if ([optNameToChange isEqualToString:@"merange"]) { /* Special case for motion estimation range, which uses @@ -1217,6 +1252,12 @@ [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@=%@", [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d",[sender indexOfSelectedItem]+3]]]; } + else if ([optNameToChange isEqualToString:@"b-adapt"]) + { + /* 0 is default, index 1 is 0*/ + [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@=%@", + [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d",[sender indexOfSelectedItem]-1]]]; + } else if ([optNameToChange isEqualToString:@"deblock"]) { /* Very special case for deblock. Uses a weird widget index offset @@ -1384,6 +1425,12 @@ [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@:%@=%@",[NSString stringWithFormat:[fDisplayX264Options stringValue]], [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d",[sender indexOfSelectedItem]+3]]]; } + else if ([optNameToChange isEqualToString:@"b-adapt"]) + { + /* 0 is default, index 1 is 0*/ + [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@:%@=%@",[NSString stringWithFormat:[fDisplayX264Options stringValue]], + [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d",[sender indexOfSelectedItem]-1]]]; + } else if ([optNameToChange isEqualToString:@"deblock"]) { /* Deblock is really weird because it has two values, and if only one is default, both -- cgit v1.2.3