[vlc-devel] [PATCH 2/3] player: add a QT window context

Thomas Guillem thomas at gllm.fr
Mon Apr 1 13:21:43 CEST 2019


This will be used by the future QT interface in order to store the legacy
"qt4-iface" context.

This context is currently stored on the legacy playlist. We don't want to store
this context into libvlc because a second player, not linked to the QT
interface, could use this context in that case. The only common parent between
the intf_thread_t and the vout_window_t is the new player but it is not exposed
as a vlc object. Therefore we must use the vlc_player_SetWindowContext
function.
---
 include/vlc_player.h | 2 ++
 src/input/player.c   | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index 7eddd8ef88..1b9d1d0534 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -345,6 +345,8 @@ enum vlc_vout_filter_type
  */
 enum vlc_player_window_context
 {
+    /** The context is a pointer to the QT intf_thread_t */
+    VLC_PLAYER_WINDOW_CONTEXT_QT,
     /** The context is a X11 window ID (uint32_t) */
     VLC_PLAYER_WINDOW_CONTEXT_XWINDOW,
     /** The context is a pointer to a android window handler */
diff --git a/src/input/player.c b/src/input/player.c
index 010beea468..b21fe0b721 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -3365,6 +3365,10 @@ vlc_player_SetWindowContext(vlc_player_t *player,
     assert(player);
     switch (type)
     {
+        case VLC_PLAYER_WINDOW_CONTEXT_QT:
+            var_SetAddress(player, "qt-iface", context);
+            var_SetString(player, "window", context ? "qt,any" : "");
+            break;
         case VLC_PLAYER_WINDOW_CONTEXT_XWINDOW:
             var_SetAddress(player, "drawable-xid", context);
             var_SetString(player, "vout", "");
@@ -3401,6 +3405,8 @@ vlc_vout_window_GetPlayerContext(vout_window_t *window,
     assert(window);
     switch (type)
     {
+        case VLC_PLAYER_WINDOW_CONTEXT_QT:
+            return var_InheritAddress(window, "qt-iface");
         case VLC_PLAYER_WINDOW_CONTEXT_XWINDOW:
             return var_InheritAddress(window, "drawable-xid");
 #ifdef __ANDROID__
@@ -3614,6 +3620,7 @@ vlc_player_New(vlc_object_t *parent,
     /* Context variables */
     VAR_CREATE("vout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
     VAR_CREATE("window", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+    VAR_CREATE("qt-iface", VLC_VAR_ADDRESS);
     VAR_CREATE("drawable-xid", VLC_VAR_ADDRESS);
 #if defined (_WIN32) || defined (__OS2__)
     VAR_CREATE("drawable-hwnd", VLC_VAR_ADDRESS);
-- 
2.20.1



More information about the vlc-devel mailing list