[vlc-commits] libvlc: merge libvlc_video_render_cfg_t and libvlc_video_direct3d_cfg_t

Steve Lhomme git at videolan.org
Mon Feb 10 09:06:55 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb  4 13:38:17 2020 +0100| [abd53b120226b77ef6e0393c993771d54022acd0] | committer: Steve Lhomme

libvlc: merge libvlc_video_render_cfg_t and libvlc_video_direct3d_cfg_t

The OpenGL callbacks can now tell the bitdepth request, the full/studio range,
the color space/primary/transfer.

For now we only support 8-bits full range BT.709 rendering.

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

 doc/libvlc/d3d11_player.cpp                  |  2 +-
 doc/libvlc/d3d9_player.c                     |  2 +-
 include/vlc/libvlc_media_player.h            | 20 +++++++-------------
 modules/video_output/vgl.c                   |  4 +++-
 modules/video_output/win32/d3d11_swapchain.c |  6 +++---
 modules/video_output/win32/d3d11_swapchain.h |  2 +-
 modules/video_output/win32/direct3d11.c      |  2 +-
 modules/video_output/win32/direct3d9.c       |  4 ++--
 8 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/doc/libvlc/d3d11_player.cpp b/doc/libvlc/d3d11_player.cpp
index 78f06f22c3..85c2899dc6 100644
--- a/doc/libvlc/d3d11_player.cpp
+++ b/doc/libvlc/d3d11_player.cpp
@@ -346,7 +346,7 @@ static void release_direct3d(struct render_context *ctx)
     list_dxgi_leaks();
 }
 
-static bool UpdateOutput_cb( void *opaque, const libvlc_video_direct3d_cfg_t *cfg, libvlc_video_output_cfg_t *out )
+static bool UpdateOutput_cb( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out )
 {
     struct render_context *ctx = static_cast<struct render_context *>( opaque );
 
diff --git a/doc/libvlc/d3d9_player.c b/doc/libvlc/d3d9_player.c
index 99cabe8907..d2960d386b 100644
--- a/doc/libvlc/d3d9_player.c
+++ b/doc/libvlc/d3d9_player.c
@@ -236,7 +236,7 @@ static void Resize_cb( void *opaque,
     LeaveCriticalSection(&ctx->sizeLock);
 }
 
-static bool UpdateOutput_cb( void *opaque, const libvlc_video_direct3d_cfg_t *cfg, libvlc_video_output_cfg_t *out )
+static bool UpdateOutput_cb( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out )
 {
     struct render_context *ctx = opaque;
     return Resize(ctx, cfg->width, cfg->height, (IDirect3DDevice9*)cfg->device, out);
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 172cd963fd..975779c5ca 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -525,6 +525,12 @@ typedef struct
 {
     unsigned width;                        /** rendering video width in pixel */
     unsigned height;                      /** rendering video height in pixel */
+    unsigned bitdepth;      /** rendering video bit depth in bits per channel */
+    bool full_range;          /** video is full range or studio/limited range */
+    libvlc_video_color_space_t colorspace;              /** video color space */
+    libvlc_video_color_primaries_t primaries;       /** video color primaries */
+    libvlc_video_transfer_func_t transfer;        /** video transfer function */
+    void *device;   /** device used for rendering, IDirect3DDevice9* for D3D9 */
 } libvlc_video_render_cfg_t;
 
 typedef struct
@@ -734,18 +740,6 @@ typedef void( *libvlc_video_direct3d_set_resize_cb )( void *opaque,
                                                       void (*report_size_change)(void *report_opaque, unsigned width, unsigned height),
                                                       void *report_opaque );
 
-typedef struct
-{
-    unsigned width;                        /** rendering video width in pixel */
-    unsigned height;                      /** rendering video height in pixel */
-    unsigned bitdepth;      /** rendering video bit depth in bits per channel */
-    bool full_range;          /** video is full range or studio/limited range */
-    libvlc_video_color_space_t colorspace;              /** video color space */
-    libvlc_video_color_primaries_t primaries;       /** video color primaries */
-    libvlc_video_transfer_func_t transfer;        /** video transfer function */
-    void *device;   /** device used for rendering, IDirect3DDevice9* for D3D9 */
-} libvlc_video_direct3d_cfg_t;
-
 /** Update the rendering output setup.
  *
  * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
@@ -762,7 +756,7 @@ typedef struct
  * set in the output structure.
  */
 typedef bool( *libvlc_video_direct3d_update_output_cb )( void *opaque,
-                                                         const libvlc_video_direct3d_cfg_t *cfg,
+                                                         const libvlc_video_render_cfg_t *cfg,
                                                          libvlc_video_output_cfg_t *output );
 
 /** Tell the host the rendering for the given plane is about to start
diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c
index 3d2d08735a..c2e41c6d87 100644
--- a/modules/video_output/vgl.c
+++ b/modules/video_output/vgl.c
@@ -83,7 +83,9 @@ static void Resize(vlc_gl_t * gl, unsigned w, unsigned h)
 
     MakeCurrent(gl);
     libvlc_video_render_cfg_t output_cfg = {
-        w, h,
+        w, h, 8, true,
+        libvlc_video_colorspace_BT709, libvlc_video_primaries_BT709,
+        libvlc_video_transfer_func_SRGB, NULL,
     };
     libvlc_video_output_cfg_t render_cfg;
     sys->resizeCb(sys->opaque, &output_cfg, &render_cfg);
diff --git a/modules/video_output/win32/d3d11_swapchain.c b/modules/video_output/win32/d3d11_swapchain.c
index ec333c3854..7799b8cde0 100644
--- a/modules/video_output/win32/d3d11_swapchain.c
+++ b/modules/video_output/win32/d3d11_swapchain.c
@@ -141,7 +141,7 @@ static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_sp
 }
 #endif
 
-static void SelectSwapchainColorspace(struct d3d11_local_swapchain *display, const libvlc_video_direct3d_cfg_t *cfg)
+static void SelectSwapchainColorspace(struct d3d11_local_swapchain *display, const libvlc_video_render_cfg_t *cfg)
 {
     HRESULT hr;
     int best = 0;
@@ -314,7 +314,7 @@ static void CreateSwapchain(struct d3d11_local_swapchain *display, UINT width, U
 }
 #endif /* !VLC_WINSTORE_APP */
 
-static bool UpdateSwapchain( struct d3d11_local_swapchain *display, const libvlc_video_direct3d_cfg_t *cfg )
+static bool UpdateSwapchain( struct d3d11_local_swapchain *display, const libvlc_video_render_cfg_t *cfg )
 {
     ID3D11Texture2D* pBackBuffer;
     HRESULT hr;
@@ -470,7 +470,7 @@ void LocalSwapchainSwap( void *opaque )
     }
 }
 
-bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_direct3d_cfg_t *cfg, libvlc_video_output_cfg_t *out )
+bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out )
 {
     struct d3d11_local_swapchain *display = opaque;
     if ( !UpdateSwapchain( display, cfg ) )
diff --git a/modules/video_output/win32/d3d11_swapchain.h b/modules/video_output/win32/d3d11_swapchain.h
index 0469bef233..c754f10ec8 100644
--- a/modules/video_output/win32/d3d11_swapchain.h
+++ b/modules/video_output/win32/d3d11_swapchain.h
@@ -32,7 +32,7 @@ void *CreateLocalSwapchainHandle(vlc_object_t *, HWND, d3d11_device_t *d3d_dev);
 
 void LocalSwapchainCleanupDevice( void *opaque );
 void LocalSwapchainSwap( void *opaque );
-bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_direct3d_cfg_t *cfg, libvlc_video_output_cfg_t *out );
+bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out );
 bool LocalSwapchainStartEndRendering( void *opaque, bool enter );
 void LocalSwapchainSetMetadata( void *opaque, libvlc_video_metadata_type_t, const void * );
 bool LocalSwapchainSelectPlane( void *opaque, size_t plane );
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 0e83b844b5..c5a8acc1bd 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -213,7 +213,7 @@ static int UpdateDisplayFormat(vout_display_t *vd, libvlc_video_output_cfg_t *ou
 static int QueryDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
 {
     vout_display_sys_t *sys = vd->sys;
-    libvlc_video_direct3d_cfg_t cfg;
+    libvlc_video_render_cfg_t cfg;
 
     cfg.width  = sys->area.vdcfg.display.width;
     cfg.height = sys->area.vdcfg.display.height;
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 552e7dcef1..14445f8cd2 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -472,7 +472,7 @@ static void Direct3D9DestroyResources(vout_display_t *vd)
 static int UpdateOutput(vout_display_t *vd, const video_format_t *fmt)
 {
     vout_display_sys_t *sys = vd->sys;
-    libvlc_video_direct3d_cfg_t cfg;
+    libvlc_video_render_cfg_t cfg;
     cfg.width  = sys->area.vdcfg.display.width;
     cfg.height = sys->area.vdcfg.display.height;
 
@@ -1505,7 +1505,7 @@ static int FindShadersCallback(const char *name, char ***values, char ***descs)
 
 VLC_CONFIG_STRING_ENUM(FindShadersCallback)
 
-static bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_direct3d_cfg_t *cfg, libvlc_video_output_cfg_t *out )
+static bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out )
 {
     vout_display_t *vd = opaque;
     out->surface_format = vd->sys->d3d9_device->d3ddev.BufferFormat;



More information about the vlc-commits mailing list