avcodec_decode_audio4() and AVStream::codec are deprecated in FFmpeg 3.1
Hi Lukas,
The FFmpegAudioReader class uses two FFmpeg deprecated API: 'AVStream::codec': was declared deprecated in chromaprint\src\audio\ffmpeg_audio_reader.h 179 'avcodec_decode_audio4': was declared deprecated in chromaprint\src\audio\ffmpeg_audio_reader.h 295
More info at: https://ffmpeg.org/doxygen/3.1/group__lavc__encdec.html
Regards
I'm aware of this. However, it's not easy to replace them while keeping backwards compatibility with older versions. Even the internal FFmpeg tools use these deprecated functions. I'll wait a bit longer with replacing them.
Hi Lukas, FFmpeg 4.0 is now released and there are many more deprecated API: https://fossies.org/linux/ffmpeg/doc/APIchanges Maybe it's time to update chromaprint to ensure compatibility with future versions of FFmpeg. What do you think of that? Thanks.
ffmpeg 5.0 has been released, and removes avcodec_decode_audio4 for good.
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:102:2: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
av_init_packet(&m_packet);
^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
# define attribute_deprecated __attribute__((deprecated))
^
In file included from /home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/cmd/fpcalc.cpp:7:
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:117:16: error: assigning to 'AVInputFormat *' from 'const AVInputFormat *' discards qualifiers
m_input_fmt = av_find_input_format(name);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:138:5: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
av_init_packet(&m_packet);
^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
# define attribute_deprecated __attribute__((deprecated))
^
In file included from /home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/cmd/fpcalc.cpp:7:
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:157:8: error: no matching function for call to 'av_find_best_stream'
ret = av_find_best_stream(m_format_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0);
^~~~~~~~~~~~~~~~~~~
/usr/include/libavformat/avformat.h:2157:5: note: candidate function not viable: no known conversion from 'AVCodec **' to 'const AVCodec **' for 5th argument
int av_find_best_stream(AVFormatContext *ic,
^
In file included from /home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/cmd/fpcalc.cpp:7:
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:164:55: error: no member named 'codec' in 'AVStream'
m_codec_ctx = m_format_ctx->streams[m_stream_index]->codec;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:259:4: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
av_init_packet(&m_packet);
^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
# define attribute_deprecated __attribute__((deprecated))
^
In file included from /home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/cmd/fpcalc.cpp:7:
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:281:9: error: use of undeclared identifier 'avcodec_decode_audio4'; did you mean 'avcodec_decode_subtitle2'?
ret = avcodec_decode_audio4(m_codec_ctx, m_frame, &m_got_frame, &m_packet);
^~~~~~~~~~~~~~~~~~~~~
avcodec_decode_subtitle2
/usr/include/libavcodec/avcodec.h:2531:5: note: 'avcodec_decode_subtitle2' declared here
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
^
In file included from /home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/cmd/fpcalc.cpp:7:
/home/bero/abf/chromaprint/BUILD/chromaprint-1.5.1/src/audio/ffmpeg_audio_reader.h:281:44: error: cannot initialize a parameter of type 'AVSubtitle *' with an lvalue of type 'AVFrame *'
ret = avcodec_decode_audio4(m_codec_ctx, m_frame, &m_got_frame, &m_packet);
^~~~~~~
/usr/include/libavcodec/avcodec.h:2531:65: note: passing argument to parameter 'sub' here
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
^
3 warnings and 5 errors generated.
ninja: build stopped: subcommand failed.
Hi Lukas, FFmpeg 4.0 is now released and there are many more deprecated API: https://fossies.org/linux/ffmpeg/doc/APIchanges Maybe it's time to update chromaprint to ensure compatibility with future versions of FFmpeg. What do you think of that? Thanks.
I think so... but... nothing changed after four 4.x minor releases and the latest 5.x major release...