Commit 32693a7e authored by David Fuhrmann's avatar 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
parent 1f06d03e
......@@ -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];
......
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