]> git.sesse.net Git - vlc/commitdiff
macosx: video effects: fix hue slider and convert saved video effect profiles to...
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Wed, 10 Sep 2014 17:00:44 +0000 (19:00 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Wed, 10 Sep 2014 17:04:57 +0000 (19:04 +0200)
Upgrading old saved values is done automatically. This will unset (=0) this value
if opened with older VLC versions afterwards.

extras/package/macosx/Resources/English.lproj/VideoEffects.xib
modules/gui/macosx/VideoEffects.m

index e9f7889d5ba145fc8e28ef737916d229b95346f0..4f7bedd4c5e50492be39cdfd62d9bdb4999ba2bc 100644 (file)
@@ -2,7 +2,7 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
   <data>
     <int key="IBDocument.SystemTarget">1050</int>
-    <string key="IBDocument.SystemVersion">13E28</string>
+    <string key="IBDocument.SystemVersion">13F31</string>
     <string key="IBDocument.InterfaceBuilderVersion">851</string>
     <string key="IBDocument.AppKitVersion">1265.21</string>
     <string key="IBDocument.HIToolboxVersion">698.00</string>
@@ -21,7 +21,7 @@
     </object>
     <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
       <bool key="EncodedWithXMLCoder">YES</bool>
-      <integer value="6"/>
+      <integer value="48"/>
     </object>
     <object class="NSArray" key="IBDocument.PluginDependencies">
       <bool key="EncodedWithXMLCoder">YES</bool>
@@ -68,7 +68,7 @@
                 <object class="BGHUDTabViewItem" id="313931694">
                   <string key="NSIdentifier">basic</string>
                   <object class="NSView" key="NSView" id="1044285835">
-                    <nil key="NSNextResponder"/>
+                    <reference key="NSNextResponder" ref="898819366"/>
                     <int key="NSvFlags">274</int>
                     <object class="NSMutableArray" key="NSSubviews">
                       <bool key="EncodedWithXMLCoder">YES</bool>
                                   <int key="NSCellFlags2">131072</int>
                                   <string key="NSContents"/>
                                   <reference key="NSControlView" ref="1033837370"/>
-                                  <double key="NSMaxValue">360</double>
-                                  <double key="NSMinValue">0.0</double>
+                                  <double key="NSMaxValue">180</double>
+                                  <double key="NSMinValue">-180</double>
                                   <double key="NSValue">0.0</double>
                                   <double key="NSAltIncValue">0.0</double>
                                   <int key="NSNumberOfTickMarks">0</int>
                       </object>
                     </object>
                     <string key="NSFrame">{{10, 33}, {638, 197}}</string>
+                    <reference key="NSSuperview" ref="898819366"/>
                   </object>
                   <string key="NSLabel">Basic</string>
                   <reference key="NSColor" ref="279270326"/>
                 <object class="BGHUDTabViewItem" id="52756061">
                   <string key="NSIdentifier">crop</string>
                   <object class="NSView" key="NSView" id="838226260">
-                    <reference key="NSNextResponder" ref="898819366"/>
+                    <nil key="NSNextResponder"/>
                     <int key="NSvFlags">256</int>
                     <object class="NSMutableArray" key="NSSubviews">
                       <bool key="EncodedWithXMLCoder">YES</bool>
                       </object>
                     </object>
                     <string key="NSFrame">{{10, 33}, {638, 197}}</string>
-                    <reference key="NSSuperview" ref="898819366"/>
                   </object>
                   <string key="NSLabel">Crop</string>
                   <reference key="NSColor" ref="279270326"/>
                   <reference key="NSTabView" ref="898819366"/>
                 </object>
               </object>
-              <reference key="NSSelectedTabViewItem" ref="52756061"/>
+              <reference key="NSSelectedTabViewItem" ref="313931694"/>
               <object class="NSFont" key="NSFont">
                 <string key="NSName">LucidaGrande</string>
                 <double key="NSSize">13</double>
               <nil key="themeKey"/>
               <object class="NSMutableArray" key="NSSubviews">
                 <bool key="EncodedWithXMLCoder">YES</bool>
-                <reference ref="838226260"/>
+                <reference ref="1044285835"/>
               </object>
             </object>
             <object class="NSPopUpButton" id="1044210417">
index 46c9a155190b28d7782d634f75d72206f59e5e1d..2219a1f9907d90bfe0761c8e019e3f58a1b3f74a 100644 (file)
@@ -338,7 +338,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     }
 
     /* fetch and show the various values */
-    [o_adjust_hue_sld setIntValue: config_GetInt(p_intf, "hue")];
+    [o_adjust_hue_sld setFloatValue: config_GetFloat(p_intf, "hue")];
     [o_adjust_contrast_sld setFloatValue: config_GetFloat(p_intf, "contrast")];
     [o_adjust_brightness_sld setFloatValue: config_GetFloat(p_intf, "brightness")];
     [o_adjust_saturation_sld setFloatValue: config_GetFloat(p_intf, "saturation")];
@@ -347,7 +347,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     [o_adjust_brightness_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat(p_intf, "brightness")]];
     [o_adjust_contrast_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat(p_intf, "contrast")]];
     [o_adjust_gamma_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat(p_intf, "gamma")]];
-    [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt(p_intf, "hue")]];
+    [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%.0f", config_GetFloat(p_intf, "hue")]];
     [o_adjust_saturation_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat(p_intf, "saturation")]];
     b_state = [o_adjust_ckb state];
     [o_adjust_brightness_sld setEnabled: b_state];
@@ -507,11 +507,11 @@ static VLCVideoEffects *_o_sharedInstance = nil;
 
 - (NSString *)generateProfileString
 {
-    return [NSString stringWithFormat:@"%@;%@;%@;%lli;%f;%f;%f;%f;%f;%lli;%f;%@;%lli;%lli;%lli;%lli;%lli;%lli;%@;%lli;%lli;%lli;%lli;%lli;%@;%lli;%@;%lli;%lli;%lli;%lli;%lli;%lli",
+    return [NSString stringWithFormat:@"%@;%@;%@;%lli;%f;%f;%f;%f;%f;%lli;%f;%@;%lli;%lli;%lli;%lli;%lli;%lli;%@;%lli;%lli;%lli;%lli;%lli;%@;%lli;%@;%lli;%lli;%lli;%lli;%lli;%lli;%f",
             B64EncAndFree(config_GetPsz(p_intf, "video-filter")),
             B64EncAndFree(config_GetPsz(p_intf, "sub-source")),
             B64EncAndFree(config_GetPsz(p_intf, "video-splitter")),
-            config_GetInt(p_intf, "hue"),
+            0, // former "hue" value, deprecated since 3.0.0
             config_GetFloat(p_intf, "contrast"),
             config_GetFloat(p_intf, "brightness"),
             config_GetFloat(p_intf, "saturation"),
@@ -541,7 +541,9 @@ static VLCVideoEffects *_o_sharedInstance = nil;
             config_GetInt(p_intf, "wall-rows"),
             config_GetInt(p_intf, "wall-cols"),
             // version 2 of profile string:
-            config_GetInt(p_intf, "brightness-threshold") // index: 32
+            config_GetInt(p_intf, "brightness-threshold"), // index: 32
+            // version 3 of profile string: (vlc-3.0.0)
+            config_GetFloat(p_intf, "hue") // index: 33
             ];
 }
 
@@ -629,7 +631,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     }
 
     /* try to set filter values on-the-fly and store them appropriately */
-    [vci_si setVideoFilterProperty:"hue" forFilter:"adjust" integer:[[items objectAtIndex:3] intValue]];
+    // index 3 is deprecated
     [vci_si setVideoFilterProperty:"contrast" forFilter:"adjust" float:[[items objectAtIndex:4] floatValue]];
     [vci_si setVideoFilterProperty:"brightness" forFilter:"adjust" float:[[items objectAtIndex:5] floatValue]];
     [vci_si setVideoFilterProperty:"saturation" forFilter:"adjust" float:[[items objectAtIndex:6] floatValue]];
@@ -663,6 +665,16 @@ static VLCVideoEffects *_o_sharedInstance = nil;
         [vci_si setVideoFilterProperty: "brightness-threshold" forFilter: "adjust" boolean: [[items objectAtIndex:32] intValue]];
     }
 
+    float hueValue;
+    if ([items count] >= 34) { // version >=3 of profile string
+        hueValue = [[items objectAtIndex:33] floatValue];
+    } else {
+        hueValue = [[items objectAtIndex:3] intValue]; // deprecated since 3.0.0
+        // convert to new scale ([0,360] --> [-180,180])
+        hueValue -= 180;
+    }
+    [vci_si setVideoFilterProperty:"hue" forFilter:"adjust" float:hueValue];
+
     [defaults setInteger:selectedProfile forKey:@"VideoEffectSelectedProfile"];
     [defaults synchronize];
 
@@ -808,12 +820,12 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     else if (sender == o_adjust_gamma_sld)
         [[VLCCoreInteraction sharedInstance] setVideoFilterProperty: "gamma" forFilter: "adjust" float: [o_adjust_gamma_sld floatValue]];
     else if (sender == o_adjust_hue_sld)
-        [[VLCCoreInteraction sharedInstance] setVideoFilterProperty: "hue" forFilter: "adjust" integer: [o_adjust_hue_sld intValue]];
+        [[VLCCoreInteraction sharedInstance] setVideoFilterProperty: "hue" forFilter: "adjust" float: [o_adjust_hue_sld floatValue]];
     else if (sender == o_adjust_saturation_sld)
         [[VLCCoreInteraction sharedInstance] setVideoFilterProperty: "saturation" forFilter: "adjust" float: [o_adjust_saturation_sld floatValue]];
 
     if (sender == o_adjust_hue_sld)
-        [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%i", [o_adjust_hue_sld intValue]]];
+        [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%.0f", [o_adjust_hue_sld floatValue]]];
     else
         [sender setToolTip: [NSString stringWithFormat:@"%0.3f", [sender floatValue]]];
 }
@@ -826,17 +838,17 @@ static VLCVideoEffects *_o_sharedInstance = nil;
         [o_adjust_brightness_sld setFloatValue: 1.0];
         [o_adjust_contrast_sld setFloatValue: 1.0];
         [o_adjust_gamma_sld setFloatValue: 1.0];
-        [o_adjust_hue_sld setIntValue: 0];
+        [o_adjust_hue_sld setFloatValue: 0];
         [o_adjust_saturation_sld setFloatValue: 1.0];
         [o_adjust_brightness_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
         [o_adjust_contrast_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
         [o_adjust_gamma_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
-        [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%i", 0]];
+        [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%.0f", 0.0]];
         [o_adjust_saturation_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
         [vci_si setVideoFilterProperty: "brightness" forFilter: "adjust" float: 1.0];
         [vci_si setVideoFilterProperty: "contrast" forFilter: "adjust" float: 1.0];
         [vci_si setVideoFilterProperty: "gamma" forFilter: "adjust" float: 1.0];
-        [vci_si setVideoFilterProperty: "hue" forFilter: "adjust" integer: 0.0];
+        [vci_si setVideoFilterProperty: "hue" forFilter: "adjust" float: 0.0];
         [vci_si setVideoFilterProperty: "saturation" forFilter: "adjust" float: 1.0];
     } else
         [vci_si setVideoFilterProperty: "brightness-threshold" forFilter: "adjust" boolean: [o_adjust_brightness_ckb state]];