]> git.sesse.net Git - vlc/commitdiff
macosx: video effects: only set video splitters when needed
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 31 Aug 2014 13:16:57 +0000 (15:16 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 31 Aug 2014 18:58:05 +0000 (20:58 +0200)
Avoids setting this variable multiple times, as each time vout
restart is requested. Also avoids unnecessary vout restarts at
start and when changing profiles.

refs #12063

modules/gui/macosx/VideoEffects.m

index 55e7f9de6008bd44fca23d1d9d1286a4536bacc6..df9ac85caaeb5d6cd0ff587a83cf14ba285b11ef 100644 (file)
@@ -594,9 +594,6 @@ static VLCVideoEffects *_o_sharedInstance = nil;
         vlc_object_release(p_vout);
     }
 
-    // video-splitter needs to be set via playlist var
-    var_SetString(pl_Get(p_intf), "video-splitter", "");
-
     /* fetch preset */
     NSArray *items = [[[defaults objectForKey:@"VideoEffectProfiles"] objectAtIndex:selectedProfile] componentsSeparatedByString:@";"];
 
@@ -633,12 +630,13 @@ static VLCVideoEffects *_o_sharedInstance = nil;
 
     tempString = B64DecNSStr([items objectAtIndex:2]);
     /* enable another round of new filters */
-    config_PutPsz(p_intf,"video-splitter", "");
-    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];
+    char *psz_current_splitter = var_GetString(pl_Get(p_intf), "video-splitter");
+    bool b_filter_changed = ![tempString isEqual:toNSStr(psz_current_splitter)];
+    free(psz_current_splitter);
+
+    if (b_filter_changed) {
+        config_PutPsz(p_intf, "video-splitter", [tempString UTF8String]);
+        var_SetString(pl_Get(p_intf), "video-splitter", [tempString UTF8String]);
     }
 
     /* try to set filter values on-the-fly and store them appropriately */