Commit 5dff4d81 authored by Felix Paul Kühne's avatar Felix Paul Kühne

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

parent c16ab7a4
...@@ -237,7 +237,6 @@ ...@@ -237,7 +237,6 @@
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification; - (void)refreshVoutDeviceMenu:(NSNotification *)o_notification;
- (void)setSubmenusEnabled:(BOOL)b_enabled; - (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)setRateControlsEnabled:(BOOL)b_enabled; - (void)setRateControlsEnabled:(BOOL)b_enabled;
- (void)setupExtensionsMenu;
- (void)updateSidebarMenuItem; - (void)updateSidebarMenuItem;
- (IBAction)openAddonManager:(id)sender; - (IBAction)openAddonManager:(id)sender;
......
...@@ -940,60 +940,12 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -940,60 +940,12 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)_disablePostProcessing - (void)_disablePostProcessing
{ {
char *psz_name = "postprocess"; [[VLCCoreInteraction sharedInstance] setVideoFilter:"postprocess" on:false];
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);
}
} }
- (void)_enablePostProcessing - (void)_enablePostProcessing
{ {
char *psz_name = "postprocess"; [[VLCCoreInteraction sharedInstance] setVideoFilter:"postprocess" on:true];
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);
}
} }
- (IBAction)togglePostProcessing:(id)sender - (IBAction)togglePostProcessing:(id)sender
...@@ -1010,23 +962,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1010,23 +962,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[self _enablePostProcessing]; [self _enablePostProcessing];
[sender setState:NSOnState]; [sender setState:NSOnState];
vout_thread_t *p_vout = getVout(); [[VLCCoreInteraction sharedInstance] setVideoFilterProperty:"postproc-q" forFilter:"postprocess" integer:[sender tag]];
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);
}
} }
} }
......
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