[FFmpeg-devel] [PATCH 16/41] avcodec/mpegvideo: Use typedefs for MPV(Main)?(Dec|Enc)?Context

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Jan 31 01:05:11 EET 2022


Michael Niedermayer:
> On Sun, Jan 30, 2022 at 07:27:24AM +0100, Andreas Rheinhardt wrote:
>> This is in preparation for actually adding such contexts
>> and e.g. moving fields only used by the main thread to
>> the corresponding "Main" context.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> 
> This breaks build on mingw64
> 
> src/libavcodec/dxva2_mpeg2.c:42:50: warning: ‘struct MPVDecContext’ declared inside parameter list will not be visible outside of this definition or declaration
>                                      const struct MPVDecContext *s,
>                                                   ^~~~~~~~~~~~~
> src/libavcodec/dxva2_mpeg2.c: In function ‘fill_picture_parameters’:
> src/libavcodec/dxva2_mpeg2.c:45:39: error: dereferencing pointer to incomplete type ‘const struct MPVDecContext’
>      const Picture *current_picture = s->current_picture_ptr;
>                                        ^~
> src/libavcodec/dxva2_mpeg2.c: At top level:
> src/libavcodec/dxva2_mpeg2.c:108:53: warning: ‘struct MPVDecContext’ declared inside parameter list will not be visible outside of this definition or declaration
>                                         const struct MPVDecContext *s,
>                                                      ^~~~~~~~~~~~~
> src/libavcodec/dxva2_mpeg2.c: In function ‘fill_quantization_matrices’:
> src/libavcodec/dxva2_mpeg2.c:115:18: error: dereferencing pointer to incomplete type ‘const struct MPVDecContext’
>          int n = s->idsp.idct_permutation[ff_zigzag_direct[i]];
>                   ^~
> src/libavcodec/dxva2_mpeg2.c:115:13: warning: variable ‘n’ set but not used [-Wunused-but-set-variable]
>          int n = s->idsp.idct_permutation[ff_zigzag_direct[i]];
>              ^
> src/libavcodec/dxva2_mpeg2.c: At top level:
> src/libavcodec/dxva2_mpeg2.c:124:37: warning: ‘struct MPVDecContext’ declared inside parameter list will not be visible outside of this definition or declaration
>                         const struct MPVDecContext *s,
>                                      ^~~~~~~~~~~~~
> src/libavcodec/dxva2_mpeg2.c: In function ‘fill_slice’:
> src/libavcodec/dxva2_mpeg2.c:129:21: error: dereferencing pointer to incomplete type ‘const struct MPVDecContext’
>      int is_field = s->picture_structure != PICT_FRAME;
>                      ^~
> src/libavcodec/dxva2_mpeg2.c: In function ‘commit_bitstream_and_slice_buffer’:
> src/libavcodec/dxva2_mpeg2.c:157:10: error: dereferencing pointer to incomplete type ‘const struct MPVDecContext’
>          s->current_picture_ptr->hwaccel_picture_private;
>           ^~
> src/libavcodec/dxva2_mpeg2.c: In function ‘dxva2_mpeg2_start_frame’:
> src/libavcodec/dxva2_mpeg2.c:260:10: error: dereferencing pointer to incomplete type ‘const struct MPVDecContext’
>          s->current_picture_ptr->hwaccel_picture_private;
>           ^~
> src/libavcodec/dxva2_mpeg2.c:266:41: warning: passing argument 3 of ‘fill_picture_parameters’ from incompatible pointer type [-Wincompatible-pointer-types]
>      fill_picture_parameters(avctx, ctx, s, &ctx_pic->pp);
>                                          ^
> src/libavcodec/dxva2_mpeg2.c:40:13: note: expected ‘const struct MPVDecContext *’ but argument is of type ‘const struct MPVDecContext * const’
>  static void fill_picture_parameters(AVCodecContext *avctx,
>              ^~~~~~~~~~~~~~~~~~~~~~~
> src/libavcodec/dxva2_mpeg2.c:267:44: warning: passing argument 3 of ‘fill_quantization_matrices’ from incompatible pointer type [-Wincompatible-pointer-types]
>      fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
>                                             ^
> src/libavcodec/dxva2_mpeg2.c:106:13: note: expected ‘const struct MPVDecContext *’ but argument is of type ‘const struct MPVDecContext * const’
>  static void fill_quantization_matrices(AVCodecContext *avctx,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~
> src/libavcodec/dxva2_mpeg2.c: In function ‘dxva2_mpeg2_decode_slice’:
> src/libavcodec/dxva2_mpeg2.c:280:10: error: dereferencing pointer to incomplete type ‘const struct MPVDecContext’
>          s->current_picture_ptr->hwaccel_picture_private;
>           ^~
> src/libavcodec/dxva2_mpeg2.c:293:23: warning: passing argument 2 of ‘fill_slice’ from incompatible pointer type [-Wincompatible-pointer-types]
>      fill_slice(avctx, s, &ctx_pic->slice[ctx_pic->slice_count++], position,
>                        ^
> src/libavcodec/dxva2_mpeg2.c:123:13: note: expected ‘const struct MPVDecContext *’ but argument is of type ‘const struct MPVDecContext * const’
>  static void fill_slice(AVCodecContext *avctx,
>              ^~~~~~~~~~
> src/libavcodec/dxva2_mpeg2.c: In function ‘dxva2_mpeg2_end_frame’:
> src/libavcodec/dxva2_mpeg2.c:302:10: error: dereferencing pointer to incomplete type ‘struct MPVDecContext’
>          s->current_picture_ptr->hwaccel_picture_private;
>           ^~
> src/libavcodec/dxva2_mpeg2.c:312:33: warning: passing argument 1 of ‘ff_mpeg_draw_horiz_band’ from incompatible pointer type [-Wincompatible-pointer-types]
>          ff_mpeg_draw_horiz_band(s, 0, avctx->height);
>                                  ^
> In file included from src/libavcodec/dxva2_mpeg2.c:27:0:
> src/libavcodec/mpegvideo.h:606:6: note: expected ‘MPVContext * {aka struct MPVContext *}’ but argument is of type ‘struct MPVDecContext * const’
>  void ff_mpeg_draw_horiz_band(MPVContext *s, int y, int h);
>       ^~~~~~~~~~~~~~~~~~~~~~~
> src/ffbuild/common.mak:78: recipe for target 'libavcodec/dxva2_mpeg2.o' failed
> make: *** [libavcodec/dxva2_mpeg2.o] Error 1
> make: *** Waiting for unfinished jobs....
> 
> [...]
> 

Thanks, fixed in https://github.com/mkver/FFmpeg/commits/mpegvideo (as
well as the commit message of #2 and the missing documentation for the
typedefs and some smaller stuff, too). I don't think it is worth
resending it now.
I am btw very interested into whether I should split all relevant
headers into decoder- and encoder-only parts; I only did it for those
for which there is enough stuff for the new headers and for example not
for flv.h, but splitting all headers would have the advantage that e.g.
the decoders never have the encoder headers included.

- Andreas


More information about the ffmpeg-devel mailing list