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

Steve Lhomme robux4 at ycbcr.xyz
Mon May 6 15:01:35 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 c3551ea575..51561c3281 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -760,6 +760,18 @@ int libvlc_video_surface_set_callbacks( libvlc_media_player_t *mp,
                                         libvlc_video_surface_start_rendering_cb makeCurrent_cb,
                                         void* opaque );
 
+/**
+ * Set the rendering size to use with \ref libvlc_video_surface_set_callbacks
+ *
+ * \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_surface_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 2a6bba09c2..b0e48b4850 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_surface_set_callbacks
+libvlc_video_surface_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 373e639bab..64d8a873fb 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -651,6 +651,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);
@@ -1235,6 +1238,14 @@ int libvlc_video_surface_set_callbacks( libvlc_media_player_t *mp,
     return 1;
 }
 
+void libvlc_video_surface_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