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

Steve Lhomme robux4 at videolabs.io
Wed Jun 21 14:15:08 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 c279568107..fa427de5ca 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)
@@ -151,12 +150,6 @@ static int DxCreateDecoderSurfaces(vlc_va_t *, int codec_id,
 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;
@@ -323,17 +316,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)
 {
@@ -396,8 +378,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
@@ -414,7 +394,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 7b2abe9e33..318aff89e9 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 e552a09bb2..7bc0cb7772 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->hwaccel_context);
-#endif
         va = NULL;
     }
     return va;
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 04986ec983..ec327f5a68 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