[vlc-devel] [PATCH] vmem: client should get display resolution too

sergey radionov rsatom at gmail.com
Fri Apr 26 18:05:25 CEST 2019


to be able display frames correctly
---
 include/vlc/libvlc_media_player.h |  8 ++++++--
 modules/video_output/vmem.c       | 11 ++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index e1d758956e..ca72a550d3 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -346,13 +346,17 @@ typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
  * \param opaque pointer to the private pointer passed to
  *               libvlc_video_set_callbacks() [IN/OUT]
  * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
- * \param width pointer to the pixel width [IN/OUT]
- * \param height pointer to the pixel height [IN/OUT]
+ * \param width pointer to the buffer width in pixels[IN/OUT]
+ * \param height pointer to the buffer height in pixels[IN/OUT]
  * \param pitches table of scanline pitches in bytes for each pixel plane
  *                (the table is allocated by LibVLC) [OUT]
  * \param lines table of scanlines count for each plane [OUT]
  * \return the number of picture buffers allocated, 0 indicates failure
  *
+ * \version LibVLC 4.0.0 and later.
+ * \param (width+1) - pointer to display width in pixels[IN]
+ * \param (height+1) - pointer to display height in pixels[IN]
+ *
  * \note
  * For each pixels plane, the scanline pitch must be bigger than or equal to
  * the number of bytes per pixel multiplied by the pixel width.
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 87ea3244f4..ee5e544656 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -144,13 +144,22 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         memset(sys->pitches, 0, sizeof(sys->pitches));
         memset(sys->lines, 0, sizeof(sys->lines));
 
-        if (setup(&sys->opaque, chroma, &fmt.i_width, &fmt.i_height,
+        unsigned widths[2], heights[2];
+        widths[0] = fmt.i_width;
+        widths[1] = fmt.i_visible_width;
+
+        heights[0] = fmt.i_height;
+        heights[1] = fmt.i_visible_height;
+
+        if (setup(&sys->opaque, chroma, widths, heights,
                            sys->pitches, sys->lines) == 0) {
             msg_Err(vd, "video format setup failure (no pictures)");
             free(sys);
             return VLC_EGENERIC;
         }
         fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
+        fmt.i_width = widths[0];
+        fmt.i_height = heights[0];
 
     } else {
         char *chroma = var_InheritString(vd, "vmem-chroma");
-- 
2.19.1



More information about the vlc-devel mailing list