[vlc-commits] macosx: video effects: add brightness-threshold to the profiles string

David Fuhrmann git at videolan.org
Wed Jul 30 12:31:00 CEST 2014


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Wed Jul 30 11:09:41 2014 +0200| [32693a7ecb132ce10ffe2d64f2d04806be60b861] | committer: David Fuhrmann

macosx: video effects: add brightness-threshold to the profiles string

This is done in a backward-compatible manner: Once an existing profile is saved,
the new format is used.

Opening the new format with an old VLC version will work, too, but you will
lose changes from the new format.

refs #11643

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=32693a7ecb132ce10ffe2d64f2d04806be60b861
---

 modules/gui/macosx/VideoEffects.m |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/VideoEffects.m b/modules/gui/macosx/VideoEffects.m
index a514e0c..896018c 100644
--- a/modules/gui/macosx/VideoEffects.m
+++ b/modules/gui/macosx/VideoEffects.m
@@ -319,6 +319,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     [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")];
+    [o_adjust_brightness_ckb setState:(config_GetInt(p_intf, "brightness-threshold") != 0 ? NSOnState : NSOffState)];
     [o_adjust_gamma_sld setFloatValue: config_GetFloat(p_intf, "gamma")];
     [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")]];
@@ -483,7 +484,7 @@ 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",
+    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",
             B64EncAndFree(config_GetPsz(p_intf, "video-filter")),
             B64EncAndFree(config_GetPsz(p_intf, "sub-source")),
             B64EncAndFree(config_GetPsz(p_intf, "video-splitter")),
@@ -515,7 +516,9 @@ static VLCVideoEffects *_o_sharedInstance = nil;
             config_GetInt(p_intf, "logo-opacity"),
             config_GetInt(p_intf, "clone-count"),
             config_GetInt(p_intf, "wall-rows"),
-            config_GetInt(p_intf, "wall-cols")
+            config_GetInt(p_intf, "wall-cols"),
+            // version 2 of profile string:
+            config_GetInt(p_intf, "brightness-threshold") // index: 32
             ];
 }
 
@@ -574,6 +577,13 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     /* fetch preset */
     NSArray *items = [[[defaults objectForKey:@"VideoEffectProfiles"] objectAtIndex:selectedProfile] componentsSeparatedByString:@";"];
 
+    // version 1 of profile string has 32 entries
+    if ([items count] < 32) {
+        msg_Err(p_intf, "Error in parsing profile string");
+        [self resetValues];
+        return;
+    }
+
     /* filter handling */
     NSString *tempString = B64DecNSStr([items objectAtIndex:0]);
     NSArray *tempArray;
@@ -639,6 +649,10 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     [vci_si setVideoFilterProperty:"wall-rows" forFilter:"wall" integer:[[items objectAtIndex:30] intValue]];
     [vci_si setVideoFilterProperty:"wall-cols" forFilter:"wall" integer:[[items objectAtIndex:31] intValue]];
 
+    if ([items count] >= 33) { // version >=2 of profile string
+        [vci_si setVideoFilterProperty: "brightness-threshold" forFilter: "adjust" boolean: [[items objectAtIndex:32] intValue]];
+    }
+
     [defaults setInteger:selectedProfile forKey:@"VideoEffectSelectedProfile"];
     [defaults synchronize];
 



More information about the vlc-commits mailing list