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

David Fuhrmann git at videolan.org
Sat Aug 2 22:37:55 CEST 2014


vlc/vlc-2.2 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Wed Jul 30 11:09:41 2014 +0200| [691c2d312a2ddea0b212c138b1dbba27879d20e8] | committer: Jean-Baptiste Kempf

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

(cherry picked from commit 32693a7ecb132ce10ffe2d64f2d04806be60b861)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=691c2d312a2ddea0b212c138b1dbba27879d20e8
---

 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 af14317..0090a95 100644
--- a/modules/gui/macosx/VideoEffects.m
+++ b/modules/gui/macosx/VideoEffects.m
@@ -321,6 +321,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")]];
@@ -711,7 +712,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")),
@@ -743,7 +744,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
             ];
 }
 
@@ -801,6 +804,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;
@@ -866,6 +876,10 @@ static VLCVideoEffects *_o_sharedInstance = nil;
     [self setVideoFilterProperty:"wall-rows" forFilter:"wall" integer:[[items objectAtIndex:30] intValue]];
     [self 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