]> granicus.if.org Git - handbrake/commitdiff
MacGui: reset the video encoder additional options when switching to a different...
authorDamiano Galassi <damiog@gmail.com>
Sat, 31 Dec 2016 08:06:58 +0000 (09:06 +0100)
committerDamiano Galassi <damiog@gmail.com>
Sat, 31 Dec 2016 08:09:35 +0000 (09:09 +0100)
(cherry picked from commit 7ba75322da188f3e44591908649df96af39fd3c3)

macosx/HBVideo.m

index 6dfc16325e2718d8beaed7cc5c02df8268d9c75d..31fcf4433723c117b602d3f02223d05bc88ea397 100644 (file)
@@ -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];