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

Felix Paul Kühne git at videolan.org
Tue Aug 5 19:02:09 CEST 2014


vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Jun 16 12:43:41 2014 +0200| [c2ceef83fd36fe009c1ef5b4eae239c27538673a] | committer: David Fuhrmann

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

(cherry picked from commit 5dff4d81394b2e043df1bbe3ae6b1cce1cf4797d)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=c2ceef83fd36fe009c1ef5b4eae239c27538673a
---

 modules/gui/macosx/MainMenu.h |    1 -
 modules/gui/macosx/MainMenu.m |   70 ++---------------------------------------
 2 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/modules/gui/macosx/MainMenu.h b/modules/gui/macosx/MainMenu.h
index 5ddb2e8..7e126f0 100644
--- a/modules/gui/macosx/MainMenu.h
+++ b/modules/gui/macosx/MainMenu.h
@@ -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;
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index 5331b2b..53bd04e 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -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]];
     }
 }
 



More information about the vlc-commits mailing list