diff options
author | jbrjake <[email protected]> | 2009-02-11 22:56:00 +0000 |
---|---|---|
committer | jbrjake <[email protected]> | 2009-02-11 22:56:00 +0000 |
commit | abfd603adac74e6bc916dee2079625d235f22b8d (patch) | |
tree | d67e5f74ae59d884ed51ffae0a7c8ff03d1c6246 /macosx/HBAdvancedController.m | |
parent | 167a208d331e3c376ad8c672de4f308ea2d58394 (diff) |
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
Diffstat (limited to 'macosx/HBAdvancedController.m')
-rw-r--r-- | macosx/HBAdvancedController.m | 57 |
1 files changed, 52 insertions, 5 deletions
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 |