Commit 691c2d31 authored by David Fuhrmann's avatar David Fuhrmann Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7cd8acc9
......@@ -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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment