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

macosx: de-duplicate code by using the global libvlccore controller to handle video filters

(cherry picked from commit 5dff4d81394b2e043df1bbe3ae6b1cce1cf4797d)
Signed-off-by: default avatarDavid Fuhrmann <dfuhrmann@videolan.org>
parent 0b5419b5
......@@ -237,7 +237,6 @@
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification;
- (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)setRateControlsEnabled:(BOOL)b_enabled;
- (void)setupExtensionsMenu;
- (void)updateSidebarMenuItem;
- (IBAction)openAddonManager:(id)sender;
......
......@@ -961,60 +961,12 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)_disablePostProcessing
{
char *psz_name = "postprocess";
char *psz_string, *psz_parser;
psz_string = config_GetPsz(p_intf, "video-filter");
if (!psz_string)
return;
psz_parser = strstr(psz_string, psz_name);
if (psz_parser) {
if (*(psz_parser + strlen(psz_name)) == ':') {
memmove(psz_parser, psz_parser + strlen(psz_name) + 1,
strlen(psz_parser + strlen(psz_name) + 1) + 1);
} else
*psz_parser = '\0';
/* Remove trailing : : */
if (strlen(psz_string) > 0 && *(psz_string + strlen(psz_string) -1) == ':')
*(psz_string + strlen(psz_string) -1) = '\0';
} else {
free(psz_string);
return;
}
config_PutPsz(p_intf, "video-filter", psz_string);
/* Try to set on the fly */
vout_thread_t *p_vout = getVout();
if (p_vout) {
var_SetString(p_vout, "video-filter", psz_string);
vlc_object_release(p_vout);
}
[[VLCCoreInteraction sharedInstance] setVideoFilter:"postprocess" on:false];
}
- (void)_enablePostProcessing
{
char *psz_name = "postprocess";
char *psz_string, *psz_parser;
psz_string = config_GetPsz(p_intf, "video-filter");
if (psz_string == NULL)
psz_string = psz_name;
else if (strstr(psz_string, psz_name) == NULL) {
char *psz_tmp = strdup([[NSString stringWithFormat: @"%s:%s", psz_string, psz_name] UTF8String]);
free(psz_string);
psz_string = psz_tmp;
}
config_PutPsz(p_intf, "video-filter", psz_string);
/* Try to set on the fly */
vout_thread_t *p_vout = getVout();
if (p_vout) {
var_SetString(p_vout, "video-filter", psz_string);
vlc_object_release(p_vout);
}
[[VLCCoreInteraction sharedInstance] setVideoFilter:"postprocess" on:true];
}
- (IBAction)togglePostProcessing:(id)sender
......@@ -1031,23 +983,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[self _enablePostProcessing];
[sender setState:NSOnState];
vout_thread_t *p_vout = getVout();
vlc_object_t *p_filter;
config_PutInt(p_intf, "postproc-q", [sender tag]);
if (p_vout) {
p_filter = vlc_object_find_name(pl_Get(p_intf), psz_name);
if (!p_filter) {
msg_Warn(p_intf, "filter '%s' isn't enabled", psz_name);
vlc_object_release(p_vout);
return;
}
var_SetInteger(p_filter, "postproc-q", [sender tag]);
vlc_object_release(p_vout);
vlc_object_release(p_filter);
}
[[VLCCoreInteraction sharedInstance] setVideoFilterProperty:"postproc-q" forFilter:"postprocess" integer:[sender tag]];
}
}
......
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