Commit 8a341b03 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx: video effects: simplify restoring video-filter and sub-source

(cherry picked from commit 677511e79bdc42bddec1b57977973b2489772099)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent df0f9924
......@@ -586,14 +586,6 @@ static VLCVideoEffects *_o_sharedInstance = nil;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSUInteger selectedProfile = [o_profile_pop indexOfSelectedItem];
/* disable all current video filters, if a vout is available */
vout_thread_t *p_vout = getVout();
if (p_vout) {
var_SetString(p_vout, "video-filter", "");
var_SetString(p_vout, "sub-source", "");
vlc_object_release(p_vout);
}
/* fetch preset */
NSArray *items = [[[defaults objectForKey:@"VideoEffectProfiles"] objectAtIndex:selectedProfile] componentsSeparatedByString:@";"];
......@@ -606,26 +598,23 @@ static VLCVideoEffects *_o_sharedInstance = nil;
/* filter handling */
NSString *tempString = B64DecNSStr([items objectAtIndex:0]);
NSArray *tempArray;
NSUInteger count;
vout_thread_t *p_vout = getVout();
/* enable the new filters */
config_PutPsz(p_intf, "video-filter", "");
if ([tempString length] > 0) {
tempArray = [tempString componentsSeparatedByString:@":"];
count = [tempArray count];
for (NSUInteger x = 0; x < count; x++)
[vci_si setVideoFilter:[[tempArray objectAtIndex:x] UTF8String] on:YES];
config_PutPsz(p_intf, "video-filter", [tempString UTF8String]);
if (p_vout) {
var_SetString(p_vout, "video-filter", [tempString UTF8String]);
}
tempString = B64DecNSStr([items objectAtIndex:1]);
/* enable another round of new filters */
config_PutPsz(p_intf,"sub-source", "");
if ([tempString length] > 0) {
tempArray = [tempString componentsSeparatedByString:@":"];
count = [tempArray count];
for (NSUInteger x = 0; x < count; x++)
[vci_si setVideoFilter:[[tempArray objectAtIndex:x] UTF8String] on:YES];
config_PutPsz(p_intf, "sub-source", [tempString UTF8String]);
if (p_vout) {
var_SetString(p_vout, "sub-source", [tempString UTF8String]);
}
if (p_vout) {
vlc_object_release(p_vout);
}
tempString = B64DecNSStr([items objectAtIndex:2]);
......
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