Commit a3c4d7c7 authored by David Fuhrmann's avatar David Fuhrmann

macosx: do not enable video filters which are not set in profile (fixes #9010)

parent 52babf6e
......@@ -484,31 +484,40 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_addlogo_transparency_lbl setEnabled: b_state];
}
- (void)setVideoFilter: (char *)psz_name on:(BOOL)b_on
- (const char *)getFilterType:(char *)psz_name
{
char *psz_string, *psz_parser;
const char *psz_filter_type;
module_t *p_obj = module_find(psz_name);
if (!p_obj) {
msg_Err(p_intf, "Unable to find filter module \"%s\".", psz_name);
return;
return NULL;
}
msg_Dbg(p_intf, "will set filter '%s'", psz_name);
if (module_provides(p_obj, "video splitter")) {
psz_filter_type = "video-splitter";
return "video-splitter";
} else if (module_provides(p_obj, "video filter2")) {
psz_filter_type = "video-filter";
return "video-filter";
} else if (module_provides(p_obj, "sub source")) {
psz_filter_type = "sub-source";
return "sub-source";
} else if (module_provides(p_obj, "sub filter")) {
psz_filter_type = "sub-filter";
return "sub-filter";
} else {
msg_Err(p_intf, "Unknown video filter type.");
return NULL;
}
}
- (void)setVideoFilter: (char *)psz_name on:(BOOL)b_on
{
char *psz_string, *psz_parser;
const char *psz_filter_type = [self getFilterType:psz_name];
if (!psz_filter_type) {
msg_Err(p_intf, "Unable to find filter module \"%s\".", psz_name);
return;
}
msg_Dbg(p_intf, "will set filter '%s'", psz_name);
psz_string = config_GetPsz(p_intf, psz_filter_type);
if (b_on) {
......@@ -563,6 +572,28 @@ static VLCVideoEffects *_o_sharedInstance = nil;
vlc_object_t *p_filter = vlc_object_find_name(pl_Get(p_intf), psz_filter);
if (p_filter) {
/* we cannot rely on the p_filter existence.
This filter might be just
disabled, but the object still exists. Therefore, the string
is checked, additionally.
*/
const char *psz_filter_type = [self getFilterType:psz_filter];
if (!psz_filter_type) {
msg_Err(p_intf, "Unable to find filter module \"%s\".", psz_name);
goto out;
}
char *psz_string = config_GetPsz(p_intf, psz_filter_type);
if (!psz_string) {
goto out;
}
if (strstr(psz_string, psz_filter) == NULL) {
free(psz_string);
goto out;
}
free(psz_string);
int i_type;
i_type = var_Type(p_filter, psz_name);
if (i_type == 0)
......@@ -570,11 +601,13 @@ static VLCVideoEffects *_o_sharedInstance = nil;
if (!(i_type & VLC_VAR_ISCOMMAND)) {
msg_Warn(p_intf, "Brute-restarting filter '%s', because the last changed option isn't a command", psz_name);
[self setVideoFilter: psz_filter on: NO];
[self setVideoFilter: psz_filter on: YES];
} else
msg_Dbg(p_intf, "restart not needed");
out:
vlc_object_release(p_filter);
}
}
......
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