From 1e69b047b935ae2841f5d49c95e5c90521626341 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sun, 6 Oct 2019 13:23:54 +0200 Subject: MacGui: rework the way the encoder options views are swapped. --- macosx/Base.lproj/Video.xib | 706 ++++++++++++++++++++++---------------------- macosx/HBVideoController.m | 79 +++-- 2 files changed, 389 insertions(+), 396 deletions(-) (limited to 'macosx') diff --git a/macosx/Base.lproj/Video.xib b/macosx/Base.lproj/Video.xib index b38b993f0..60af4046e 100644 --- a/macosx/Base.lproj/Video.xib +++ b/macosx/Base.lproj/Video.xib @@ -1,35 +1,32 @@ - + - + - - - - - - - - - + + + + + + - + - + - + @@ -38,7 +35,7 @@ - + @@ -46,7 +43,7 @@ - + @@ -77,10 +74,10 @@ - + - + @@ -91,10 +88,10 @@ - + - + @@ -118,11 +115,11 @@ - + - + @@ -219,9 +216,9 @@ - + - + @@ -230,9 +227,9 @@ - + - + @@ -241,7 +238,7 @@ - + Constant Quality varies bitrate to ensure visual quality remains relatively consistent throughout the video. Adjust the quality slider to the right to increase quality or to the left to decrease quality, in small increments of plus or minus 1-2. @@ -250,7 +247,7 @@ Recommended values for the x264 and x265 encoders are RF 18-28. Higher quality s x264 is lossless at RF 0. - + @@ -274,9 +271,9 @@ x264 is lossless at RF 0. - + - + @@ -286,18 +283,11 @@ x264 is lossless at RF 0. - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HBTuneTransformer + + + + + HBTunesTransformer + + + + + + + Video encoder profile. Sets and ensures compliance with the specified video compression standard profile. Overrides all other settings. + + + + + + + + + + + auto + + + + + + + + Video encoder level. Sets and ensures compliance with the specified video compression standard level. Overrides all other settings. + + + + + + + + + + + auto + + + + + + + + + + + + + + + + + + + + Additional video encoder options. For advanced use only. + +Syntax: option-1=foo:opt2=bar,baz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Video encoder preset. Adjusts encoder settings to balance compression efficiency and encoding speed. Slower encoder presets may use settings that are less compatible with certain devices. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Additional video encoder options. For advanced use only. + +Syntax: option-1=foo:opt2=bar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -386,6 +686,7 @@ x264 is lossless at RF 0. + @@ -393,7 +694,6 @@ x264 is lossless at RF 0. - @@ -402,320 +702,22 @@ x264 is lossless at RF 0. + - - + - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HBTuneTransformer - - - - - - HBTunesTransformer - - - - - - - Video encoder profile. Sets and ensures compliance with the specified video compression standard profile. Overrides all other settings. - - - - - - - - - - - auto - - - - - - - - Video encoder level. Sets and ensures compliance with the specified video compression standard level. Overrides all other settings. - - - - - - - - - - - auto - - - - - - - - - - - - - - - - - - - - Additional video encoder options. For advanced use only. - -Syntax: option-1=foo:opt2=bar,baz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Video encoder preset. Adjusts encoder settings to balance compression efficiency and encoding speed. Slower encoder presets may use settings that are less compatible with certain devices. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Additional video encoder options. For advanced use only. - -Syntax: option-1=foo:opt2=bar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index ab359cf73..b2de5e644 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -11,28 +11,19 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; -@interface HBVideoController () { - // Framerate Radio Button Framerate Controls - IBOutlet NSButton *fFramerateVfrPfrButton; +@interface HBVideoController () - // Video Encoder - IBOutlet NSSlider *fVidQualitySlider; +@property (nonatomic, weak) IBOutlet NSButton *framerateVfrPfrButton; +@property (nonatomic, weak) IBOutlet NSSlider *vidQualitySlider; - // Encoder options views - IBOutlet NSView *fPresetView; - IBOutlet NSView *fSimplePresetView; +// Advanced encoder options +@property (nonatomic, weak) IBOutlet NSView *encoderOptionsView; +@property (nonatomic, weak) IBOutlet NSSlider *presetSlider; +// Text Field to show the expanded opts from unparse() +@property (nonatomic, weak) IBOutlet NSTextField *unparseTextField; - IBOutlet NSTextField *fEncoderOptionsLabel; - - // x264/x265 Presets Box - IBOutlet NSBox *fPresetsBox; - IBOutlet NSSlider *fPresetsSlider; - - // Text Field to show the expanded opts from unparse() - IBOutlet NSTextField *fDisplayX264PresetsUnparseTextField; -} - -@property (nonatomic, weak) IBOutlet NSTextField *additionalsOptions; +// Simple encoder options +@property (nonatomic, weak) IBOutlet NSView *encoderOptionsSimpleView; @property (nonatomic) BOOL presetViewEnabled; @property (nonatomic) NSColor *labelColor; @@ -65,6 +56,12 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; return self; } +- (void)viewDidLoad +{ + self.encoderOptionsView.hidden = YES; + self.encoderOptionsSimpleView.hidden = YES; +} + - (void)setVideo:(HBVideo *)video { _video = video; @@ -99,30 +96,30 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; // fFramerateVfrPfrCell if (self.video.frameRate == 0) // We are Same as Source { - [fFramerateVfrPfrButton setTitle:NSLocalizedString(@"Variable Framerate", @"Video -> Framerate")]; + [self.framerateVfrPfrButton setTitle:NSLocalizedString(@"Variable Framerate", @"Video -> Framerate")]; } else { - [fFramerateVfrPfrButton setTitle:NSLocalizedString(@"Peak Framerate (VFR)", @"Video -> Framerate")]; + [self.framerateVfrPfrButton setTitle:NSLocalizedString(@"Peak Framerate (VFR)", @"Video -> Framerate")]; } } else if ([keyPath isEqualToString:@"video.quality"]) { - fVidQualitySlider.accessibilityValueDescription = [NSString stringWithFormat:@"%@ %.2f", self.video.constantQualityLabel, self.video.quality];; + self.vidQualitySlider.accessibilityValueDescription = [NSString stringWithFormat:@"%@ %.2f", self.video.constantQualityLabel, self.video.quality];; } else if ([keyPath isEqualToString:@"video.preset"]) { - fPresetsSlider.accessibilityValueDescription = self.video.preset; + self.presetSlider.accessibilityValueDescription = self.video.preset; } else if ([keyPath isEqualToString:@"video.unparseOptions"]) { if ([self.video isUnparsedSupported:self.video.encoder]) { - fDisplayX264PresetsUnparseTextField.stringValue = [NSString stringWithFormat:@"x264 Unparse: %@", self.video.unparseOptions]; + self.unparseTextField.stringValue = [NSString stringWithFormat:@"x264 Unparse: %@", self.video.unparseOptions]; } else { - fDisplayX264PresetsUnparseTextField.stringValue = @""; + self.unparseTextField.stringValue = @""; } } else if ([keyPath isEqualToString:@"values.HBx264CqSliderFractional"]) @@ -155,17 +152,17 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; granularity = 1.0f / [NSUserDefaults.standardUserDefaults integerForKey:HBCqSliderFractional]; } - fVidQualitySlider.minValue = minValue; - fVidQualitySlider.maxValue = maxValue; + self.vidQualitySlider.minValue = minValue; + self.vidQualitySlider.maxValue = maxValue; NSInteger numberOfTickMarks = (NSInteger)((maxValue - minValue) * (1.0f / granularity)) + 1; - fVidQualitySlider.numberOfTickMarks = numberOfTickMarks; + self.vidQualitySlider.numberOfTickMarks = numberOfTickMarks; // Replace the slider transformer with a new one, // configured with the new max/min/direction values. - [fVidQualitySlider unbind:@"value"]; + [self.vidQualitySlider unbind:@"value"]; HBQualityTransformer *transformer = [[HBQualityTransformer alloc] initWithReversedDirection:(direction != 0) min:minValue max:maxValue]; - [fVidQualitySlider bind:@"value" toObject:self withKeyPath:@"self.video.quality" options:@{NSValueTransformerBindingOption: transformer}]; + [self.vidQualitySlider bind:@"value" toObject:self withKeyPath:@"self.video.quality" options:@{NSValueTransformerBindingOption: transformer}]; } #pragma mark - Video x264/x265 Presets @@ -175,19 +172,14 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; */ - (void)switchPresetView { + BOOL supportPresets = [self.video isPresetSystemSupported:self.video.encoder]; + self.encoderOptionsView.hidden = !supportPresets; + self.encoderOptionsSimpleView.hidden = !([self.video isSimpleOptionsPanelSupported:self.video.encoder] && !supportPresets); + if ([self.video isPresetSystemSupported:self.video.encoder]) { - fPresetsBox.contentView = fPresetView; [self setupPresetsSlider]; } - else if ([self.video isSimpleOptionsPanelSupported:self.video.encoder]) - { - fPresetsBox.contentView = fSimplePresetView; - } - else - { - fPresetsBox.contentView = nil; - } } /** @@ -205,15 +197,14 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; - (void)setupPresetsSlider { // setup the preset slider - [fPresetsSlider setMaxValue:self.video.presets.count - 1]; - [fPresetsSlider setNumberOfTickMarks:self.video.presets.count]; + self.presetSlider.maxValue = self.video.presets.count - 1; + self.presetSlider.numberOfTickMarks = self.video.presets.count; // Bind the slider value to a custom value transformer, // done here because it can't be done in IB. - [fPresetsSlider unbind:@"value"]; + [self.presetSlider unbind:@"value"]; HBPresetsTransformer *transformer = [[HBPresetsTransformer alloc] initWithEncoder:self.video.encoder]; - [fPresetsSlider bind:@"value" toObject:self withKeyPath:@"self.video.preset" options:@{NSValueTransformerBindingOption: transformer}]; + [self.presetSlider bind:@"value" toObject:self withKeyPath:@"self.video.preset" options:@{NSValueTransformerBindingOption: transformer}]; } - @end -- cgit v1.2.3