From 7ba75322da188f3e44591908649df96af39fd3c3 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sat, 31 Dec 2016 09:06:58 +0100 Subject: [PATCH] MacGui: reset the video encoder additional options when switching to a different encoder. --- macosx/HBVideo.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index 26a45c239..5cb7d642d 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -94,6 +94,8 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; - (void)setEncoder:(int)encoder { + int previousEncoder = _encoder; + if (encoder != _encoder) { [[self.undo prepareWithInvocationTarget:self] setEncoder:_encoder]; @@ -105,6 +107,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; { [self validatePresetsSettings]; [self validateAdvancedOptions]; + [self validateVideoOptionExtra:previousEncoder]; } [self postChangedNotification]; @@ -310,6 +313,17 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; } } +- (void)validateVideoOptionExtra:(int)previousEncoder +{ + if (!((previousEncoder & HB_VCODEC_X264_MASK && + self.encoder & HB_VCODEC_X264_MASK) || + (previousEncoder & HB_VCODEC_X265_MASK && + self.encoder & HB_VCODEC_X265_MASK))) + { + self.videoOptionExtra = @""; + } +} + - (void)setNilValueForKey:(NSString *)key { [self setValue:@0 forKey:key]; -- 2.40.0