[vlc-devel] [PATCH 17/17] va: remove the deprecated setup() callback

Steve Lhomme robux4 at videolabs.io
Tue Jun 20 17:45:49 CEST 2017


Both DXVA2 and D3D11VA now only return opaque formats that are matching
vlc_va_GetChroma()
---
 modules/codec/avcodec/d3d11va.c | 21 ---------------------
 modules/codec/avcodec/dxva2.c   | 24 ------------------------
 modules/codec/avcodec/va.c      | 13 -------------
 modules/codec/avcodec/va.h      |  4 ----
 4 files changed, 62 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 2e30cab9c6..2e36f35cc6 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -109,7 +109,6 @@ DEFINE_GUID(DXVA2_NoEncrypt,                        0x1b81bed0, 0xa0c7, 0x11d3,
 struct vlc_va_sys_t
 {
     directx_sys_t                dx_sys;
-    vlc_fourcc_t                 i_chroma;
     UINT                         totalTextureSlices;
 
 #if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
@@ -150,12 +149,6 @@ static int DxCreateDecoderSurfaces(vlc_va_t *, int codec_id, const video_format_
 static void DxDestroySurfaces(vlc_va_t *);
 static void SetupAVCodecContext(vlc_va_t *);
 
-/* */
-static void Setup(vlc_va_t *va, vlc_fourcc_t *chroma)
-{
-    *chroma = va->sys->i_chroma;
-}
-
 void SetupAVCodecContext(vlc_va_t *va)
 {
     vlc_va_sys_t *sys = va->sys;
@@ -322,17 +315,6 @@ static void Close(vlc_va_t *va, void *ctx)
     free(sys);
 }
 
-static vlc_fourcc_t d3d11va_fourcc(enum PixelFormat swfmt)
-{
-    switch (swfmt)
-    {
-        case AV_PIX_FMT_YUV420P10LE:
-            return VLC_CODEC_D3D11_OPAQUE_10B;
-        default:
-            return VLC_CODEC_D3D11_OPAQUE;
-    }
-}
-
 static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
                 const es_format_t *fmt, picture_sys_t *p_sys)
 {
@@ -395,8 +377,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
         }
     }
 
-    sys->i_chroma = d3d11va_fourcc(ctx->sw_pix_fmt);
-
 #if VLC_WINSTORE_APP
     err = directx_va_Open(va, &sys->dx_sys, false);
 #else
@@ -413,7 +393,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
 
     /* TODO print the hardware name/vendor for debugging purposes */
     va->description = DxDescribe(dx_sys);
-    va->setup   = Setup;
     va->get     = Get;
 
     return VLC_SUCCESS;
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 026d3fed5c..d99af03e48 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -111,7 +111,6 @@ static const d3d_format_t *D3dFindFormat(D3DFORMAT format)
 struct vlc_va_sys_t
 {
     directx_sys_t         dx_sys;
-    vlc_fourcc_t          i_chroma;
 
     /* DLL */
     HINSTANCE             hd3d9_dll;
@@ -154,12 +153,6 @@ static void DxDestroyVideoDecoder(vlc_va_t *);
 static int DxResetVideoDecoder(vlc_va_t *);
 static void SetupAVCodecContext(vlc_va_t *);
 
-/* */
-static void Setup(vlc_va_t *va, vlc_fourcc_t *chroma)
-{
-    *chroma = va->sys->i_chroma;
-}
-
 void SetupAVCodecContext(vlc_va_t *va)
 {
     vlc_va_sys_t *sys = va->sys;
@@ -251,20 +244,6 @@ static void Close(vlc_va_t *va, void *ctx)
     free(sys);
 }
 
-static vlc_fourcc_t d3d9va_fourcc(enum PixelFormat swfmt)
-{
-    switch (swfmt)
-    {
-        case AV_PIX_FMT_YUV420P10LE:
-            return VLC_CODEC_D3D9_OPAQUE_10B;
-        case AV_PIX_FMT_YUVJ420P:
-        case AV_PIX_FMT_YUV420P:
-            return VLC_CODEC_D3D9_OPAQUE;
-        default:
-            return VLC_CODEC_D3D9_OPAQUE;
-    }
-}
-
 static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
                 const es_format_t *fmt, picture_sys_t *p_sys)
 {
@@ -314,8 +293,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
         IDirect3DSurface9_GetDevice(p_sys->surface, &dx_sys->d3ddev );
     }
 
-    sys->i_chroma = d3d9va_fourcc(ctx->sw_pix_fmt);
-
     err = directx_va_Open(va, &sys->dx_sys, true);
     if (err!=VLC_SUCCESS)
         goto error;
@@ -328,7 +305,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
 
     /* TODO print the hardware name/vendor for debugging purposes */
     va->description = DxDescribe(sys);
-    va->setup   = Setup;
     va->get     = Get;
     return VLC_SUCCESS;
 
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index ea43a57536..939edb956a 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -128,19 +128,6 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
     if (va->module == NULL)
     {
         vlc_object_release(va);
-#ifdef _WIN32
-        return NULL;
-    }
-
-    vlc_fourcc_t chroma;
-    vlc_fourcc_t expected = vlc_va_GetChroma( pix_fmt, avctx->sw_pix_fmt );
-    va->setup(va, &chroma);
-    if (chroma != expected)
-    {   /* Mismatch, cannot work, fail */
-        msg_Dbg( obj, "chroma mismatch %4.4s expected %4.4s",
-                 (const char*)&chroma, (const char*) &expected );
-        vlc_va_Delete(va, avctx);
-#endif
         va = NULL;
     }
     return va;
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 948a3aa901..cae27da4fb 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -36,10 +36,6 @@ struct vlc_va_t {
     module_t *module;
     const char *description;
 
-#ifdef _WIN32
-    VLC_DEPRECATED
-    void (*setup)(vlc_va_t *, vlc_fourcc_t *output);
-#endif
     int  (*get)(vlc_va_t *, picture_t *pic, uint8_t **data);
 };
 
-- 
2.12.1



More information about the vlc-devel mailing list