[vlc-commits] libvlc: use a different name for each variant of the host surface format
Steve Lhomme
git at videolan.org
Mon Feb 10 09:07:14 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb 6 08:20:50 2020 +0100| [c819fb26f80ac2462d0841c8eac79f5c0c3b8572] | committer: Steve Lhomme
libvlc: use a different name for each variant of the host surface format
Now that we use a union we can differentiate each properly.
In particular the D3D9 is an unsigned FourCC.
It's still not as strongly typed as it could be (no DXGI_FORMAT for example).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c819fb26f80ac2462d0841c8eac79f5c0c3b8572
---
doc/libvlc/QtGL/qtvlcwidget.cpp | 2 +-
doc/libvlc/d3d11_player.cpp | 2 +-
doc/libvlc/d3d9_player.c | 2 +-
doc/libvlc/sdl_opengl_player.cpp | 2 +-
include/vlc/libvlc_media_player.h | 6 +++---
modules/video_output/vgl.c | 2 +-
modules/video_output/win32/d3d11_swapchain.c | 2 +-
modules/video_output/win32/direct3d11.c | 2 +-
modules/video_output/win32/direct3d9.c | 2 +-
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index bf62116791..59eca34fe8 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -54,7 +54,7 @@ public:
that->mBuffers[that->m_idx_render]->bind();
- render_cfg->surface_format = GL_RGBA;
+ render_cfg->opengl_format = GL_RGBA;
render_cfg->full_range = true;
render_cfg->colorspace = libvlc_video_colorspace_BT709;
render_cfg->primaries = libvlc_video_primaries_BT709;
diff --git a/doc/libvlc/d3d11_player.cpp b/doc/libvlc/d3d11_player.cpp
index 19244408dd..97e1dbd97a 100644
--- a/doc/libvlc/d3d11_player.cpp
+++ b/doc/libvlc/d3d11_player.cpp
@@ -402,7 +402,7 @@ static bool UpdateOutput_cb( void *opaque, const libvlc_video_render_cfg_t *cfg,
ctx->d3dctxVLC->OMSetRenderTargets( 1, &ctx->resized.textureRenderTarget, NULL );
- out->surface_format = renderFormat;
+ out->dxgi_format = renderFormat;
out->full_range = true;
out->colorspace = libvlc_video_colorspace_BT709;
out->primaries = libvlc_video_primaries_BT709;
diff --git a/doc/libvlc/d3d9_player.c b/doc/libvlc/d3d9_player.c
index 6ce3318130..4b925df52a 100644
--- a/doc/libvlc/d3d9_player.c
+++ b/doc/libvlc/d3d9_player.c
@@ -134,7 +134,7 @@ static bool Resize(struct render_context *ctx, unsigned width, unsigned height,
hr = IDirect3DDevice9_SetRenderTarget(ctx->libvlc_d3d, 0, ctx->sharedRenderSurface);
if (FAILED(hr)) return false;
- out->surface_format = d3ddm.Format;
+ out->d3d9_format = d3ddm.Format;
out->full_range = true;
out->colorspace = libvlc_video_colorspace_BT709;
out->primaries = libvlc_video_primaries_BT709;
diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index ba6b4be872..bb1c0a303d 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -150,7 +150,7 @@ public:
glBindFramebuffer(GL_FRAMEBUFFER, that->m_fbo[that->m_idx_render]);
- render_cfg->surface_format = GL_RGBA;
+ render_cfg->opengl_format = GL_RGBA;
render_cfg->full_range = true;
render_cfg->colorspace = libvlc_video_colorspace_BT709;
render_cfg->primaries = libvlc_video_primaries_BT709;
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index a0ac7a1e9f..fa5147a2ae 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -565,9 +565,9 @@ typedef struct
typedef struct
{
union {
- int surface_format; /** the rendering DXGI_FORMAT for \ref libvlc_video_direct3d_engine_d3d11,
- D3DFORMAT for \ref libvlc_video_direct3d_engine_d3d9,
- GL_RGBA or GL_RGB for \ref libvlc_video_engine_opengl and
+ int dxgi_format; /** the rendering DXGI_FORMAT for \ref libvlc_video_direct3d_engine_d3d11*/
+ uint32_t d3d9_format; /** the rendering D3DFORMAT for \ref libvlc_video_direct3d_engine_d3d9 */
+ int opengl_format; /** the rendering GLint GL_RGBA or GL_RGB for \ref libvlc_video_engine_opengl and
for \ref libvlc_video_engine_gles2 */
void *p_surface; /** currently unused */
};
diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c
index 5f03498e68..7602ef309e 100644
--- a/modules/video_output/vgl.c
+++ b/modules/video_output/vgl.c
@@ -90,7 +90,7 @@ static void Resize(vlc_gl_t * gl, unsigned w, unsigned h)
libvlc_video_output_cfg_t render_cfg;
sys->resizeCb(sys->opaque, &output_cfg, &render_cfg);
ReleaseCurrent(gl);
- assert(render_cfg.surface_format == GL_RGBA);
+ assert(render_cfg.opengl_format == GL_RGBA);
assert(render_cfg.full_range == true);
assert(render_cfg.colorspace == libvlc_video_colorspace_BT709);
assert(render_cfg.primaries == libvlc_video_primaries_BT709);
diff --git a/modules/video_output/win32/d3d11_swapchain.c b/modules/video_output/win32/d3d11_swapchain.c
index 7799b8cde0..bb4206f496 100644
--- a/modules/video_output/win32/d3d11_swapchain.c
+++ b/modules/video_output/win32/d3d11_swapchain.c
@@ -475,7 +475,7 @@ bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_render_cfg_t *
struct d3d11_local_swapchain *display = opaque;
if ( !UpdateSwapchain( display, cfg ) )
return false;
- out->surface_format = display->pixelFormat->formatTexture;
+ out->dxgi_format = display->pixelFormat->formatTexture;
out->full_range = display->colorspace->b_full_range;
out->colorspace = (libvlc_video_color_space_t) display->colorspace->color;
out->primaries = (libvlc_video_color_primaries_t) display->colorspace->primaries;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 32b477e211..f0bf80b131 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -158,7 +158,7 @@ static int UpdateDisplayFormat(vout_display_t *vd, libvlc_video_output_cfg_t *ou
for (const d3d_format_t *output_format = GetRenderFormatList();
output_format->name != NULL; ++output_format)
{
- if (output_format->formatTexture == (DXGI_FORMAT)out->surface_format &&
+ if (output_format->formatTexture == (DXGI_FORMAT)out->dxgi_format &&
!is_d3d11_opaque(output_format->fourcc))
{
new_display.pixelFormat = output_format;
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index ed047ef30d..60be882aa5 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1508,7 +1508,7 @@ VLC_CONFIG_STRING_ENUM(FindShadersCallback)
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;
+ out->d3d9_format = vd->sys->d3d9_device->d3ddev.BufferFormat;
return true;
}
More information about the vlc-commits
mailing list