diff mbox

[FFmpeg-devel] lavc/dxva2_internal: Cast dxva2 and d3d11 decoders and cfgs to (void *)

Message ID CAB0OVGo99Ub0ZKim95Z=OaXbbr9B=itf-vvtmy+gHkoB0=useg@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos April 15, 2018, 10 p.m. UTC
Hi!

Attached patch is supposed to silence several user-reported warnings,
I cannot currently test here.

Please review, Carl Eugen

Comments

James Almer April 15, 2018, 11:08 p.m. UTC | #1
On 4/15/2018 7:00 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch is supposed to silence several user-reported warnings,
> I cannot currently test here.
> 
> Please review, Carl Eugen
> 
> 
> 0001-lavc-dxva2_internal-Cast-the-dxva2-and-d3d11-decoder.patch
> 
> 
> From 6fb20352568dc5abe61c28247bfce9e04e7494c1 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Sun, 15 Apr 2018 23:57:24 +0200
> Subject: [PATCH] lavc/dxva2_internal: Cast the dxva2 and d3d11 decoders and
>  cfgs to (void *).
> 
> Silences several warnings:
> libavcodec/dxva2_internal.h:107:98: warning: pointer type mismatch in conditional expression
> libavcodec/dxva2_internal.h:109:94: warning: pointer type mismatch in conditional expression
> ---
>  libavcodec/dxva2_internal.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h
> index 8bb3344..b822af5 100644
> --- a/libavcodec/dxva2_internal.h
> +++ b/libavcodec/dxva2_internal.h
> @@ -104,9 +104,9 @@ typedef struct FFDXVASharedContext {
>  #if CONFIG_D3D11VA && CONFIG_DXVA2
>  #define DXVA_CONTEXT_WORKAROUND(avctx, ctx)     (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.workaround : ctx->dxva2.workaround)
>  #define DXVA_CONTEXT_COUNT(avctx, ctx)          (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.surface_count : ctx->dxva2.surface_count)
> -#define DXVA_CONTEXT_DECODER(avctx, ctx)        (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.decoder : ctx->dxva2.decoder)
> +#define DXVA_CONTEXT_DECODER(avctx, ctx)        (ff_dxva2_is_d3d11(avctx) ? (void *)ctx->d3d11va.decoder : (void *)ctx->dxva2.decoder)
>  #define DXVA_CONTEXT_REPORT_ID(avctx, ctx)      (*(ff_dxva2_is_d3d11(avctx) ? &ctx->d3d11va.report_id : &ctx->dxva2.report_id))
> -#define DXVA_CONTEXT_CFG(avctx, ctx)            (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg : ctx->dxva2.cfg)
> +#define DXVA_CONTEXT_CFG(avctx, ctx)            (ff_dxva2_is_d3d11(avctx) ? (void *)ctx->d3d11va.cfg : (void *)ctx->dxva2.cfg)
>  #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx)  (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg->ConfigBitstreamRaw : ctx->dxva2.cfg->ConfigBitstreamRaw)
>  #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg->ConfigIntraResidUnsigned : ctx->dxva2.cfg->ConfigIntraResidUnsigned)
>  #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator : ctx->dxva2.cfg->ConfigResidDiffAccelerator)
> -- 1.7.10.4

Can also confirm it removes the warnings (Which were really annoying for
that matter), so LGTM.

Thanks.
Carl Eugen Hoyos April 18, 2018, 6:29 p.m. UTC | #2
2018-04-16 1:08 GMT+02:00, James Almer <jamrial@gmail.com>:
> On 4/15/2018 7:00 PM, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch is supposed to silence several user-reported warnings,
>> I cannot currently test here.
>>
>> Please review, Carl Eugen
>>
>>
>> 0001-lavc-dxva2_internal-Cast-the-dxva2-and-d3d11-decoder.patch
>>
>>
>> From 6fb20352568dc5abe61c28247bfce9e04e7494c1 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
>> Date: Sun, 15 Apr 2018 23:57:24 +0200
>> Subject: [PATCH] lavc/dxva2_internal: Cast the dxva2 and d3d11 decoders
>> and
>>  cfgs to (void *).
>>
>> Silences several warnings:
>> libavcodec/dxva2_internal.h:107:98: warning: pointer type mismatch in
>> conditional expression
>> libavcodec/dxva2_internal.h:109:94: warning: pointer type mismatch in
>> conditional expression
>> ---
>>  libavcodec/dxva2_internal.h |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h
>> index 8bb3344..b822af5 100644
>> --- a/libavcodec/dxva2_internal.h
>> +++ b/libavcodec/dxva2_internal.h
>> @@ -104,9 +104,9 @@ typedef struct FFDXVASharedContext {
>>  #if CONFIG_D3D11VA && CONFIG_DXVA2
>>  #define DXVA_CONTEXT_WORKAROUND(avctx, ctx)     (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.workaround : ctx->dxva2.workaround)
>>  #define DXVA_CONTEXT_COUNT(avctx, ctx)          (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.surface_count : ctx->dxva2.surface_count)
>> -#define DXVA_CONTEXT_DECODER(avctx, ctx)        (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.decoder : ctx->dxva2.decoder)
>> +#define DXVA_CONTEXT_DECODER(avctx, ctx)        (ff_dxva2_is_d3d11(avctx)
>> ? (void *)ctx->d3d11va.decoder : (void *)ctx->dxva2.decoder)
>>  #define DXVA_CONTEXT_REPORT_ID(avctx, ctx)
>> (*(ff_dxva2_is_d3d11(avctx) ? &ctx->d3d11va.report_id :
>> &ctx->dxva2.report_id))
>> -#define DXVA_CONTEXT_CFG(avctx, ctx)            (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.cfg : ctx->dxva2.cfg)
>> +#define DXVA_CONTEXT_CFG(avctx, ctx)            (ff_dxva2_is_d3d11(avctx)
>> ? (void *)ctx->d3d11va.cfg : (void *)ctx->dxva2.cfg)
>>  #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx)  (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.cfg->ConfigBitstreamRaw :
>> ctx->dxva2.cfg->ConfigBitstreamRaw)
>>  #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.cfg->ConfigIntraResidUnsigned :
>> ctx->dxva2.cfg->ConfigIntraResidUnsigned)
>>  #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ff_dxva2_is_d3d11(avctx)
>> ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator :
>> ctx->dxva2.cfg->ConfigResidDiffAccelerator)
>> -- 1.7.10.4
>
> Can also confirm it removes the warnings (Which were really annoying for
> that matter), so LGTM.

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From 6fb20352568dc5abe61c28247bfce9e04e7494c1 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 15 Apr 2018 23:57:24 +0200
Subject: [PATCH] lavc/dxva2_internal: Cast the dxva2 and d3d11 decoders and
 cfgs to (void *).

Silences several warnings:
libavcodec/dxva2_internal.h:107:98: warning: pointer type mismatch in conditional expression
libavcodec/dxva2_internal.h:109:94: warning: pointer type mismatch in conditional expression
---
 libavcodec/dxva2_internal.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h
index 8bb3344..b822af5 100644
--- a/libavcodec/dxva2_internal.h
+++ b/libavcodec/dxva2_internal.h
@@ -104,9 +104,9 @@  typedef struct FFDXVASharedContext {
 #if CONFIG_D3D11VA && CONFIG_DXVA2
 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx)     (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.workaround : ctx->dxva2.workaround)
 #define DXVA_CONTEXT_COUNT(avctx, ctx)          (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.surface_count : ctx->dxva2.surface_count)
-#define DXVA_CONTEXT_DECODER(avctx, ctx)        (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.decoder : ctx->dxva2.decoder)
+#define DXVA_CONTEXT_DECODER(avctx, ctx)        (ff_dxva2_is_d3d11(avctx) ? (void *)ctx->d3d11va.decoder : (void *)ctx->dxva2.decoder)
 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx)      (*(ff_dxva2_is_d3d11(avctx) ? &ctx->d3d11va.report_id : &ctx->dxva2.report_id))
-#define DXVA_CONTEXT_CFG(avctx, ctx)            (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg : ctx->dxva2.cfg)
+#define DXVA_CONTEXT_CFG(avctx, ctx)            (ff_dxva2_is_d3d11(avctx) ? (void *)ctx->d3d11va.cfg : (void *)ctx->dxva2.cfg)
 #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx)  (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg->ConfigBitstreamRaw : ctx->dxva2.cfg->ConfigBitstreamRaw)
 #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg->ConfigIntraResidUnsigned : ctx->dxva2.cfg->ConfigIntraResidUnsigned)
 #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ff_dxva2_is_d3d11(avctx) ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator : ctx->dxva2.cfg->ConfigResidDiffAccelerator)
-- 
1.7.10.4