]> granicus.if.org Git - handbrake/commitdiff
MacGui: more safe kvo removal, use libhb function to get the quaility name, fix some...
authorDamiano Galassi <damiog@gmail.com>
Sat, 3 Nov 2018 13:22:40 +0000 (14:22 +0100)
committerDamiano Galassi <damiog@gmail.com>
Sat, 3 Nov 2018 13:22:40 +0000 (14:22 +0100)
macosx/Base.lproj/Video.xib
macosx/HBSummaryViewController.m
macosx/HBVideo+UIAdditions.m

index f216a228c1056e348e47995c2aed31f85b5c8965..8f69b26bb6c408ad4f47c4b9748d5a91093f1acf 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.30.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.30.1"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -289,6 +289,11 @@ x264 is lossless at RF 0.</string>
                         <font key="font" metaFont="smallSystem"/>
                     </buttonCell>
                     <connections>
+                        <binding destination="-2" name="enabled" keyPath="self.video" id="Ewd-OO-T3Z">
+                            <dictionary key="options">
+                                <string key="NSValueTransformerName">NSIsNotNil</string>
+                            </dictionary>
+                        </binding>
                         <binding destination="-2" name="value" keyPath="self.video.qualityType" id="X1H-PE-sRI"/>
                     </connections>
                 </button>
@@ -299,6 +304,11 @@ x264 is lossless at RF 0.</string>
                         <font key="font" metaFont="smallSystem"/>
                     </buttonCell>
                     <connections>
+                        <binding destination="-2" name="enabled" keyPath="self.video" id="Lf0-yc-zAF">
+                            <dictionary key="options">
+                                <string key="NSValueTransformerName">NSIsNotNil</string>
+                            </dictionary>
+                        </binding>
                         <binding destination="-2" name="value" keyPath="self.video.qualityType" id="SE7-YP-gRu">
                             <dictionary key="options">
                                 <string key="NSValueTransformerName">NSNegateBoolean</string>
@@ -313,6 +323,11 @@ x264 is lossless at RF 0.</string>
                         <font key="font" metaFont="smallSystem"/>
                     </buttonCell>
                     <connections>
+                        <binding destination="-2" name="enabled" keyPath="self.video" id="CRn-MS-g4d">
+                            <dictionary key="options">
+                                <string key="NSValueTransformerName">NSIsNotNil</string>
+                            </dictionary>
+                        </binding>
                         <binding destination="-2" name="value" keyPath="self.video.frameRateMode" id="Jy2-df-VQy">
                             <dictionary key="options">
                                 <string key="NSValueTransformerName">NSNegateBoolean</string>
@@ -327,6 +342,11 @@ x264 is lossless at RF 0.</string>
                         <font key="font" metaFont="smallSystem"/>
                     </buttonCell>
                     <connections>
+                        <binding destination="-2" name="enabled" keyPath="self.video" id="pSp-Yq-ng6">
+                            <dictionary key="options">
+                                <string key="NSValueTransformerName">NSIsNotNil</string>
+                            </dictionary>
+                        </binding>
                         <binding destination="-2" name="value" keyPath="self.video.frameRateMode" id="aEW-Di-Bkn"/>
                     </connections>
                 </button>
index 4437677257a580eeb6797ac25f9e02584197be22..21128a38c405cd19ef2af4130cb1f6fb4882bbea 100644 (file)
@@ -154,8 +154,8 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo
 {
     for (HBAudioTrack *track in tracks)
     {
-        [track removeObserver:self forKeyPath:@"encoder"];
-        [track removeObserver:self forKeyPath:@"mixdown"];
+        [track removeObserver:self forKeyPath:@"encoder" context:HBSummaryViewControllerAudioContext];
+        [track removeObserver:self forKeyPath:@"mixdown" context:HBSummaryViewControllerAudioContext];
     }
 }
 
@@ -171,7 +171,7 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo
 {
     for (HBSubtitlesTrack *track in tracks)
     {
-        [track removeObserver:self forKeyPath:@"burnedIn"];
+        [track removeObserver:self forKeyPath:@"burnedIn" context:HBSummaryViewControllerSubsContext];
     }
 }
 
@@ -205,16 +205,16 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo
         [[NSNotificationCenter defaultCenter] removeObserver:self name:HBPictureChangedNotification object:_job.picture];
         [[NSNotificationCenter defaultCenter] removeObserver:self name:HBFiltersChangedNotification object:_job.filters];
 
-        [_job removeObserver:self forKeyPath:@"container"];
-        [_job removeObserver:self forKeyPath:@"chaptersEnabled"];
-        [_job removeObserver:self forKeyPath:@"video.encoder"];
-        [_job removeObserver:self forKeyPath:@"video.frameRate"];
-        [_job removeObserver:self forKeyPath:@"video.frameRateMode"];
-        [_job removeObserver:self forKeyPath:@"filters.deinterlace"];
-        [_job removeObserver:self forKeyPath:@"filters.rotate"];
-        [_job removeObserver:self forKeyPath:@"filters.flip"];
-        [_job removeObserver:self forKeyPath:@"audio.tracks"];
-        [_job removeObserver:self forKeyPath:@"subtitles.tracks"];
+        [_job removeObserver:self forKeyPath:@"container" context:HBSummaryViewControllerContainerContext];
+        [_job removeObserver:self forKeyPath:@"chaptersEnabled" context:HBSummaryViewControllerVideoContext];
+        [_job removeObserver:self forKeyPath:@"video.encoder" context:HBSummaryViewControllerVideoContext];
+        [_job removeObserver:self forKeyPath:@"video.frameRate" context:HBSummaryViewControllerVideoContext];
+        [_job removeObserver:self forKeyPath:@"video.frameRateMode" context:HBSummaryViewControllerVideoContext];
+        [_job removeObserver:self forKeyPath:@"filters.deinterlace" context:HBSummaryViewControllerFiltersContext];
+        [_job removeObserver:self forKeyPath:@"filters.rotate" context:HBSummaryViewControllerFiltersContext];
+        [_job removeObserver:self forKeyPath:@"filters.flip" context:HBSummaryViewControllerFiltersContext];
+        [_job removeObserver:self forKeyPath:@"audio.tracks" context:HBSummaryViewControllerAudioContext];
+        [_job removeObserver:self forKeyPath:@"subtitles.tracks" context:HBSummaryViewControllerSubsContext];
 
         [self removeAudioTracksObservers:_job.audio.tracks];
         [self removeSubtitlesTracksObservers:_job.subtitles.tracks];
index f330e352622c937f23f302e87885f7fc0ee5fc56..e23c1ab72fc6e0387fcc94e15048316d6f71a760 100644 (file)
 
 - (NSString *)constantQualityLabel
 {
-    if ((self.encoder & HB_VCODEC_X264_MASK) ||
-        (self.encoder & HB_VCODEC_X265_MASK))
-    {
-        return @"RF:";
-    }
-    else if (self.encoder == HB_VCODEC_FFMPEG_VP8 ||
-             self.encoder == HB_VCODEC_FFMPEG_VP9)
-    {
-        return @"CQ:";
-    }
-    else
-    {
-        return @"QP:";
-    }
+    return @(hb_video_quality_get_name(self.encoder));
 }
 
 + (NSSet<NSString *> *)keyPathsForValuesAffectingUnparseOptions