[vlc-devel] [PATCH 2/6] d3d9: include dxgi_fmt.h

Steve Lhomme robux4 at videolabs.io
Fri Dec 1 09:55:11 CET 2017


---
 modules/codec/Makefile.am              |  3 ++-
 modules/codec/avcodec/dxva2.c          | 10 +++++-----
 modules/video_chroma/d3d9_fmt.h        |  2 ++
 modules/video_output/win32/direct3d9.c | 18 +++++++++---------
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 6a8a72019c..267888a335 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -421,7 +421,8 @@ endif
 codec_LTLIBRARIES += libvaapi_plugin.la
 endif
 
-libd3d9_common_la_SOURCES = video_chroma/d3d9_fmt.c video_chroma/d3d9_fmt.h
+libd3d9_common_la_SOURCES = video_chroma/d3d9_fmt.c video_chroma/d3d9_fmt.h \
+	video_chroma/dxgi_fmt.h
 libd3d9_common_la_LDFLAGS = -static
 if HAVE_WIN32_DESKTOP
 noinst_LTLIBRARIES += libd3d9_common.la
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 197116a1bd..ef6b8a2a7e 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -87,9 +87,9 @@ typedef struct {
     const char   *name;
     D3DFORMAT    format;
     vlc_fourcc_t codec;
-} d3d_format_t;
+} d3d9_format_t;
 /* XXX Prefered format must come first */
-static const d3d_format_t d3d_formats[] = {
+static const d3d9_format_t d3d_formats[] = {
     { "YV12",   MAKEFOURCC('Y','V','1','2'),    VLC_CODEC_YV12 },
     { "NV12",   MAKEFOURCC('N','V','1','2'),    VLC_CODEC_NV12 },
     { "IMC3",   MAKEFOURCC('I','M','C','3'),    VLC_CODEC_YV12 },
@@ -98,7 +98,7 @@ static const d3d_format_t d3d_formats[] = {
     { NULL, 0, 0 }
 };
 
-static const d3d_format_t *D3dFindFormat(D3DFORMAT format)
+static const d3d9_format_t *D3dFindFormat(D3DFORMAT format)
 {
     for (unsigned i = 0; d3d_formats[i].name; i++) {
         if (d3d_formats[i].format == format)
@@ -530,7 +530,7 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
 
     for (unsigned j = 0; j < output_count; j++) {
         const D3DFORMAT f = output_list[j];
-        const d3d_format_t *format = D3dFindFormat(f);
+        const d3d9_format_t *format = D3dFindFormat(f);
         if (format) {
             msg_Dbg(va, "%s is supported for output", format->name);
         } else {
@@ -542,7 +542,7 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
     for (unsigned pass = 0; pass < 2 && err != VLC_SUCCESS; ++pass)
     {
         for (unsigned j = 0; d3d_formats[j].name; j++) {
-            const d3d_format_t *format = &d3d_formats[j];
+            const d3d9_format_t *format = &d3d_formats[j];
 
             /* */
             bool is_supported = false;
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 61f043b94b..63959bbcb2 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -27,6 +27,8 @@
 
 #include <d3d9.h>
 
+#include "dxgi_fmt.h"
+
 /* owned by the vout for VLC_CODEC_D3D9_OPAQUE */
 struct picture_sys_t
 {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 3fd47a1eee..7eaf2327f5 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -125,7 +125,7 @@ typedef struct
     uint32_t     rmask;
     uint32_t     gmask;
     uint32_t     bmask;
-} d3d_format_t;
+} d3d9_format_t;
 
 struct vout_display_sys_t
 {
@@ -151,7 +151,7 @@ struct vout_display_sys_t
     D3DFORMAT               d3dregion_format;    /* Backbuffer output format */
     int                     d3dregion_count;
     struct d3d_region_t     *d3dregion;
-    const d3d_format_t      *d3dtexture_format;  /* Rendering texture(s) format */
+    const d3d9_format_t      *d3dtexture_format;  /* Rendering texture(s) format */
 
     /* */
     bool                    reset_device;
@@ -165,12 +165,12 @@ struct vout_display_sys_t
     bool           desktop_requested;
 };
 
-static const d3d_format_t *Direct3DFindFormat(vout_display_t *vd, vlc_fourcc_t chroma, D3DFORMAT target);
+static const d3d9_format_t *Direct3DFindFormat(vout_display_t *vd, vlc_fourcc_t chroma, D3DFORMAT target);
 
 static int  Open(vlc_object_t *);
 
 static picture_pool_t *Direct3D9CreatePicturePool  (vlc_object_t *, d3d9_device_t *,
-     const d3d_format_t *, const video_format_t *, unsigned);
+     const d3d9_format_t *, const video_format_t *, unsigned);
 
 static void           Prepare(vout_display_t *, picture_t *, subpicture_t *subpicture);
 static void           Display(vout_display_t *, picture_t *, subpicture_t *subpicture);
@@ -398,7 +398,7 @@ static void Direct3D9UnlockSurface(picture_t *picture)
 
 /* */
 static picture_pool_t *Direct3D9CreatePicturePool(vlc_object_t *o,
-    d3d9_device_t *p_d3d9_dev, const d3d_format_t *default_d3dfmt, const video_format_t *fmt, unsigned count)
+    d3d9_device_t *p_d3d9_dev, const d3d9_format_t *default_d3dfmt, const video_format_t *fmt, unsigned count)
 {
     picture_pool_t*   pool = NULL;
     picture_t**       pictures = NULL;
@@ -769,7 +769,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
     /* Find the appropriate D3DFORMAT for the render chroma, the format will be the closest to
      * the requested chroma which is usable by the hardware in an offscreen surface, as they
      * typically support more formats than textures */
-    const d3d_format_t *d3dfmt = Direct3DFindFormat(vd, fmt->i_chroma, p_d3d9_dev->pp.BackBufferFormat);
+    const d3d9_format_t *d3dfmt = Direct3DFindFormat(vd, fmt->i_chroma, p_d3d9_dev->pp.BackBufferFormat);
     if (!d3dfmt) {
         msg_Err(vd, "surface pixel format is not supported.");
         goto error;
@@ -932,7 +932,7 @@ static int Direct3D9CheckConversion(vout_display_t *vd,
     return VLC_SUCCESS;
 }
 
-static const d3d_format_t d3d_formats[] = {
+static const d3d9_format_t d3d_formats[] = {
     /* YV12 is always used for planar 420, the planes are then swapped in Lock() */
     { "YV12",       MAKEFOURCC('Y','V','1','2'),    VLC_CODEC_YV12,  0,0,0 },
     { "YV12",       MAKEFOURCC('Y','V','1','2'),    VLC_CODEC_I420,  0,0,0 },
@@ -953,7 +953,7 @@ static const d3d_format_t d3d_formats[] = {
 
 /**
  * It returns the format (closest to chroma) that can be converted to target */
-static const d3d_format_t *Direct3DFindFormat(vout_display_t *vd, vlc_fourcc_t chroma, D3DFORMAT target)
+static const d3d9_format_t *Direct3DFindFormat(vout_display_t *vd, vlc_fourcc_t chroma, D3DFORMAT target)
 {
     vout_display_sys_t *sys = vd->sys;
     bool hardware_scale_ok = !(vd->fmt.i_visible_width & 1) && !(vd->fmt.i_visible_height & 1);
@@ -975,7 +975,7 @@ static const d3d_format_t *Direct3DFindFormat(vout_display_t *vd, vlc_fourcc_t c
 
         for (unsigned i = 0; list[i] != 0; i++) {
             for (unsigned j = 0; d3d_formats[j].name; j++) {
-                const d3d_format_t *format = &d3d_formats[j];
+                const d3d9_format_t *format = &d3d_formats[j];
 
                 if (format->fourcc != list[i])
                     continue;
-- 
2.14.2



More information about the vlc-devel mailing list