[vlc-devel] [RFC v2 6/8] libvlc: add an API entry to set the new video area size

Steve Lhomme robux4 at ycbcr.xyz
Thu May 2 15:28:49 CEST 2019


---
 include/vlc/libvlc_media_player.h | 12 ++++++++++++
 lib/libvlc.sym                    |  1 +
 lib/media_player.c                | 11 +++++++++++
 3 files changed, 24 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index bde07e271e..233db673d6 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -775,6 +775,18 @@ int libvlc_video_set_rendering_callbacks( libvlc_media_player_t *mp,
                                           libvlc_video_control_cb control_cb,
                                           void* opaque );
 
+/**
+ * Set the rendering size to use with \ref libvlc_video_set_rendering_size
+ *
+ * \param mp the media player
+ * \param width the width of the available area to render
+ * \param height the height of the available area to render
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API
+void libvlc_video_set_rendering_size( libvlc_media_player_t *mp,
+                                      unsigned width, unsigned height );
+
 /**
  * Set the NSView handler where the media player should render its video output.
  *
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index f212088b30..f42c527d04 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -245,6 +245,7 @@ libvlc_video_set_format
 libvlc_video_set_format_callbacks
 libvlc_video_set_output_callbacks
 libvlc_video_set_rendering_callbacks
+libvlc_video_set_rendering_size
 libvlc_video_set_key_input
 libvlc_video_set_logo_int
 libvlc_video_set_logo_string
diff --git a/lib/media_player.c b/lib/media_player.c
index 26ad3d53eb..8a965c2bbb 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -652,6 +652,9 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "drawable-xid", VLC_VAR_INTEGER);
 #if defined (_WIN32) || defined (__OS2__)
     var_Create (mp, "drawable-hwnd", VLC_VAR_INTEGER);
+    var_Create( mp, "width", VLC_VAR_INTEGER );
+    var_Create( mp, "height", VLC_VAR_INTEGER );
+    var_Create( mp, "window-size", VLC_VAR_COORDS );
 #endif
 #ifdef __APPLE__
     var_Create (mp, "drawable-nsobject", VLC_VAR_ADDRESS);
@@ -1228,6 +1231,14 @@ int libvlc_video_set_rendering_callbacks( libvlc_media_player_t *mp,
     return 1;
 }
 
+void libvlc_video_set_rendering_size( libvlc_media_player_t *mp,
+                                      unsigned width, unsigned height )
+{
+    var_SetInteger( mp, "width", width );
+    var_SetInteger( mp, "height", height );
+    var_SetCoords( mp, "window-size", width, height );
+}
+
 /**************************************************************************
  * set_nsobject
  **************************************************************************/
-- 
2.17.1



More information about the vlc-devel mailing list