[vlc-commits] cli: remove special case for "f" command

Rémi Denis-Courmont git at videolan.org
Sat Oct 17 20:35:59 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 17 15:55:13 2020 +0300| [12b8c163cb11d25a1e7e9fbbc509985245a9c162] | committer: Rémi Denis-Courmont

cli: remove special case for "f" command

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

 modules/control/cli/cli.c    | 22 +++-------------------
 modules/control/cli/cli.h    |  1 +
 modules/control/cli/player.c | 17 +++++++++++++++++
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index 1453890bea..a945e36e3f 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -241,6 +241,9 @@ static const struct
     { "vtrack", Input },
     { "strack", Input },
     { "record", Input },
+    { "f", PlayerFullscreen },
+    { "fs", PlayerFullscreen },
+    { "fullscreen", PlayerFullscreen },
 
     /* video commands */
     { "vratio", VideoConfig },
@@ -256,13 +259,10 @@ static const struct
 
     { "key", KeyAction },
     { "hotkey", KeyAction },
-
 };
 
 static void Process(intf_thread_t *intf, const char *line)
 {
-    intf_sys_t *sys = intf->p_sys;
-
     /* Skip heading spaces */
     const char *cmd = line + strspn(line, " ");
 
@@ -297,22 +297,6 @@ static void Process(intf_thread_t *intf, const char *line)
     /* misc menu commands */
         switch (cmd[0])
         {
-            case 'f':
-            case 'F':
-            {
-                vlc_player_t *player = vlc_playlist_GetPlayer(sys->playlist);
-                bool fs;
-
-                if (strncasecmp(arg, "on", 2) == 0)
-                    fs = true;
-                else if (strncasecmp(arg, "off", 3) == 0)
-                    fs = false;
-                else
-                    fs = !vlc_player_vout_IsFullscreen(player);
-                vlc_player_vout_SetFullscreen(player, fs);
-                break;
-            }
-
             case 'h':
             case 'H':
             case '?':
diff --git a/modules/control/cli/cli.h b/modules/control/cli/cli.h
index 9b77862abc..ee8dd86f67 100644
--- a/modules/control/cli/cli.h
+++ b/modules/control/cli/cli.h
@@ -65,6 +65,7 @@ void PlayerGetTime(intf_thread_t *intf);
 void PlayerGetLength(intf_thread_t *intf);
 void PlayerGetTitle(intf_thread_t *intf);
 void PlayerVoutSnapshot(intf_thread_t *intf);
+void PlayerFullscreen(intf_thread_t *intf, const char *const *, size_t);
 void Volume(intf_thread_t *intf, const char *const *, size_t);
 void VolumeMove(intf_thread_t *intf, const char *const *, size_t);
 void VideoConfig(intf_thread_t *intf, const char *const *, size_t);
diff --git a/modules/control/cli/player.c b/modules/control/cli/player.c
index 0537750674..14557589e5 100644
--- a/modules/control/cli/player.c
+++ b/modules/control/cli/player.c
@@ -430,6 +430,23 @@ void PlayerVoutSnapshot(intf_thread_t *intf)
     PlayerDoVoid(intf, vlc_player_vout_Snapshot);
 }
 
+void PlayerFullscreen(intf_thread_t *intf, const char *const *args,
+                      size_t count)
+{
+    vlc_player_t *player = vlc_playlist_GetPlayer(intf->p_sys->playlist);
+    bool fs = !vlc_player_vout_IsFullscreen(player);
+
+    if (count > 1)
+    {
+        if (strncasecmp(args[1], "on", 2) == 0)
+            fs = true;
+        if (strncasecmp(args[1], "off", 3) == 0)
+            fs = false;
+    }
+
+    vlc_player_vout_SetFullscreen(player, fs);
+}
+
 void Volume(intf_thread_t *intf, const char *const *args, size_t count)
 {
     const char *arg = count > 1 ? args[1] : "";



More information about the vlc-commits mailing list