Fix usage of deprecated ffmpeg APIs
cf. https://twitter.com/FFmpeg/status/1389618769262174209 and #18697 (closed)
VLC build is failing with upstream ffmpeg:
../../modules/codec/avcodec/audio.c:371:13: warning: ‘av_init_packet’ is deprecated [-Wdeprecated-declarations]
371 | av_init_packet( &pkt );
| ^~~~~~~~~~~~~~
In file included from /home/tom/work/out//include/libavcodec/bsf.h:30,
from /home/tom/work/out//include/libavcodec/avcodec.h:44,
from ../../modules/codec/avcodec/avcommon_compat.h:30,
from ../../modules/codec/avcodec/avcommon.h:37,
from ../../modules/codec/avcodec/avcodec.h:24,
from ../../modules/codec/avcodec/audio.c:38:
/home/tom/work/out//include/libavcodec/packet.h:474:6: note: declared here
474 | void av_init_packet(AVPacket *pkt);
| ^~~~~~~~~~~~~~
../../modules/codec/avcodec/va.c: In function ‘vlc_va_MightDecode’:
../../modules/codec/avcodec/va.c:37:14: error: ‘AV_PIX_FMT_VAAPI_VLD’ undeclared (first use in this function); did you mean ‘AV_PIX_FMT_VAAPI’?
37 | case AV_PIX_FMT_VAAPI_VLD:
| ^~~~~~~~~~~~~~~~~~~~
| AV_PIX_FMT_VAAPI
../../modules/codec/avcodec/va.c:37:14: note: each undeclared identifier is reported only once for each function it appears in
../../modules/codec/avcodec/video.c: In function ‘InitVideoDec’:
../../modules/codec/avcodec/video.c:539:5: warning: ‘thread_safe_callbacks’ is deprecated [-Wdeprecated-declarations]
539 | p_context->thread_safe_callbacks = true;
| ^~~~~~~~~
In file included from ../../modules/codec/avcodec/video.c:39:
/home/tom/work/out//include/libavcodec/avcodec.h:1585:9: note: declared here
1585 | int thread_safe_callbacks;
| ^~~~~~~~~~~~~~~~~~~~~
../../modules/codec/avcodec/encoder.c: In function ‘InitVideoEnc’:
../../modules/codec/avcodec/encoder.c:345:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
345 | p_codec = avcodec_find_encoder_by_name( psz_encoder );
| ^
../../modules/codec/avcodec/encoder.c:362:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
362 | p_codec = avcodec_find_encoder( i_codec_id );
| ^
../../modules/codec/avcodec/subtitle.c: In function ‘InitSubtitleDec’:
../../modules/codec/avcodec/subtitle.c:117:5: error: implicit declaration of function ‘av_codec_set_pkt_timebase’ [-Werror=implicit-function-declaration]
117 | av_codec_set_pkt_timebase(context, AV_TIME_BASE_Q);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
make[4]: *** [Makefile:25359: codec/avcodec/libavcodec_plugin_la-va.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
../../modules/codec/avcodec/subtitle.c: In function ‘DecodeBlock’:
../../modules/codec/avcodec/subtitle.c:219:5: warning: ‘av_init_packet’ is deprecated [-Wdeprecated-declarations]
219 | av_init_packet(&pkt);
| ^~~~~~~~~~~~~~
In file included from /home/tom/work/out//include/libavcodec/bsf.h:30,
from /home/tom/work/out//include/libavcodec/avcodec.h:44,
from ../../modules/codec/avcodec/subtitle.c:35:
/home/tom/work/out//include/libavcodec/packet.h:474:6: note: declared here
474 | void av_init_packet(AVPacket *pkt);
| ^~~~~~~~~~~~~~
../../modules/codec/avcodec/video.c: In function ‘DecodeBlock’:
../../modules/codec/avcodec/video.c:976:13: warning: ‘av_init_packet’ is deprecated [-Wdeprecated-declarations]
976 | av_init_packet( &pkt );
| ^~~~~~~~~~~~~~
In file included from /home/tom/work/out//include/libavcodec/bsf.h:30,
from /home/tom/work/out//include/libavcodec/avcodec.h:44,
from ../../modules/codec/avcodec/video.c:39:
/home/tom/work/out//include/libavcodec/packet.h:474:6: note: declared here
474 | void av_init_packet(AVPacket *pkt);
| ^~~~~~~~~~~~~~
../../modules/codec/avcodec/encoder.c: In function ‘encode_avframe’:
../../modules/codec/avcodec/encoder.c:1154:5: warning: ‘av_init_packet’ is deprecated [-Wdeprecated-declarations]
1154 | av_init_packet( &av_pkt );
| ^~~~~~~~~~~~~~
In file included from /home/tom/work/out//include/libavcodec/bsf.h:30,
from /home/tom/work/out//include/libavcodec/avcodec.h:44,
from ../../modules/codec/avcodec/encoder.c:44:
/home/tom/work/out//include/libavcodec/packet.h:474:6: note: declared here
474 | void av_init_packet(AVPacket *pkt);
| ^~~~~~~~~~~~~~
../../modules/codec/avcodec/encoder.c: In function ‘EncodeVideo’:
../../modules/codec/avcodec/encoder.c:1246:33: error: ‘AVCodecContext’ has no member named ‘coded_frame’
1246 | switch ( p_sys->p_context->coded_frame->pict_type )
| ^~
../../modules/codec/avcodec/vaapi.c:54:26: error: field ‘hw_ctx’ has incomplete type
54 | struct vaapi_context hw_ctx;
| ^~~~~~
../../modules/codec/avcodec/video.c: In function ‘ffmpeg_GetFormat’:
../../modules/codec/avcodec/video.c:1632:9: error: ‘AV_PIX_FMT_VAAPI_VLD’ undeclared (first use in this function); did you mean ‘AV_PIX_FMT_VAAPI’?
1632 | AV_PIX_FMT_VAAPI_VLD,
| ^~~~~~~~~~~~~~~~~~~~
| AV_PIX_FMT_VAAPI
../../modules/codec/avcodec/video.c:1632:9: note: each undeclared identifier is reported only once for each function it appears in
../../modules/codec/avcodec/vaapi.c: In function ‘Create’:
../../modules/codec/avcodec/vaapi.c:246:19: error: ‘AV_PIX_FMT_VAAPI_VLD’ undeclared (first use in this function); did you mean ‘AV_PIX_FMT_VAAPI’?
246 | if ( hwfmt != AV_PIX_FMT_VAAPI_VLD || dec_device == NULL ||
| ^~~~~~~~~~~~~~~~~~~~
| AV_PIX_FMT_VAAPI
../../modules/codec/avcodec/vaapi.c:246:19: note: each undeclared identifier is reported only once for each function it appears in
^~~~~~~~~~~~~
Fixing the vaapi error require to use a new avocodec HW API (and some work).