[vlc-commits] macosx: Switch to new playlist_SetRenderer API

Marvin Scholz git at videolan.org
Fri Jan 5 15:49:26 CET 2018


vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Jan  2 20:15:29 2018 +0100| [3fdef8bfec4a81ecf19d6b01f0910f15db9a8404] | committer: Jean-Baptiste Kempf

macosx: Switch to new playlist_SetRenderer API

(cherry picked from commit 8859a288f1424119d6bb91d6e634741681d92b68)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=3fdef8bfec4a81ecf19d6b01f0910f15db9a8404
---

 modules/gui/macosx/VLCRendererItem.h           | 26 +++-----------------
 modules/gui/macosx/VLCRendererItem.m           | 34 ++------------------------
 modules/gui/macosx/VLCRendererMenuController.m | 15 +++---------
 3 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/modules/gui/macosx/VLCRendererItem.h b/modules/gui/macosx/VLCRendererItem.h
index c034d9abc7..421c88a42c 100644
--- a/modules/gui/macosx/VLCRendererItem.h
+++ b/modules/gui/macosx/VLCRendererItem.h
@@ -64,29 +64,11 @@
 - (int)capabilityFlags;
 
 /**
- Checks if the Item’s sout string is equivalent to the given
- sout string. If output is YES, it's checked if it's an
- output sout as well.
+ Sets the renderer represented by this \c VLCRendererItem as active
+ for the given playlist.
 
- \param sout    The sout c string to compare with
- \param output  Indicates wether to check if sout is an output
-
- \return YES if souts match the given sout and output, NO otherwise
- */
-- (bool)isSoutEqualTo:(const char*)sout asOutput:(bool)output;
-
-/**
- Sets the passed playlist’s sout to the sout of the \c VLCRendererItem.
-
- \param playlist The playlist for which to set the sout
- */
-- (void)setSoutForPlaylist:(playlist_t*)playlist;
-
-/**
- Sets the passed playlist’s demux filter to the demux filter of the \c VLCRendererItem.
-
- \param playlist The playlist for which to set the demux filter
+ \param playlist The playlist for which to set the renderer
  */
-- (void)setDemuxFilterForPlaylist:(playlist_t*)playlist;
+- (void)setRendererForPlaylist:(playlist_t*)playlist;
 
 @end
diff --git a/modules/gui/macosx/VLCRendererItem.m b/modules/gui/macosx/VLCRendererItem.m
index 813cec267b..428929afb6 100644
--- a/modules/gui/macosx/VLCRendererItem.m
+++ b/modules/gui/macosx/VLCRendererItem.m
@@ -68,39 +68,9 @@
     return vlc_renderer_item_flags(_rendererItem);
 }
 
-- (bool)isSoutEqualTo:(const char*)sout asOutput:(bool)output
+- (void)setRendererForPlaylist:(playlist_t*)playlist
 {
-    NSString *temp_sout;
-    NSString *prefix;
-    NSString *self_sout;
-
-    prefix = (output) ? @"#" : @"";
-    self_sout = [prefix stringByAppendingString:toNSStr(vlc_renderer_item_sout(_rendererItem))];
-    temp_sout = toNSStr(sout);
-
-    return [temp_sout isEqualToString:self_sout];
-}
-
-- (void)setSoutForPlaylist:(playlist_t*)playlist
-{
-    NSString *sout;
-    const char *item_sout = vlc_renderer_item_sout(_rendererItem);
-
-    if (!playlist || !item_sout)
-        return;
-
-    sout = [[NSString alloc] initWithFormat:@"#%s", item_sout];
-    var_SetString(playlist , "sout", sout.UTF8String);
-}
-
-- (void)setDemuxFilterForPlaylist:(playlist_t*)playlist
-{
-    const char *item_demux_filter = vlc_renderer_item_demux_filter(_rendererItem);
-
-    if (!playlist || !item_demux_filter)
-        return;
-
-    var_SetString(playlist, "demux-filter", item_demux_filter);
+    playlist_SetRenderer(playlist, _rendererItem);
 }
 
 - (BOOL)isEqual:(id)object
diff --git a/modules/gui/macosx/VLCRendererMenuController.m b/modules/gui/macosx/VLCRendererMenuController.m
index d27328af72..bedfb38fa9 100644
--- a/modules/gui/macosx/VLCRendererMenuController.m
+++ b/modules/gui/macosx/VLCRendererMenuController.m
@@ -169,22 +169,15 @@
         return;
 
     if (item) {
-        [item setSoutForPlaylist:playlist];
-        [item setDemuxFilterForPlaylist:playlist];
+        [item setRendererForPlaylist:playlist];
     } else {
-        [self unsetSoutForPlaylist:playlist];
-        [self unsetDemuxFilterForPlaylist:playlist];
+        [self unsetRendererForPlaylist:playlist];
     }
 }
 
-- (void)unsetSoutForPlaylist:(playlist_t*)playlist
+- (void)unsetRendererForPlaylist:(playlist_t*)playlist
 {
-    var_SetString(playlist, "sout", "");
-}
-
-- (void)unsetDemuxFilterForPlaylist:(playlist_t*)playlist
-{
-    var_SetString(playlist, "demux-filter", "");
+    playlist_SetRenderer(playlist, NULL);
 }
 
 #pragma mark VLCRendererDiscovery delegate methods



More information about the vlc-commits mailing list