Repository: goldendict/goldendict (language: cpp)

Issue:
Error when compiling goldendict
```
ffmpegaudio.cc: In member function ‘bool Ffmpeg::DecoderContext::openCodec(QString&)’:
ffmpegaudio.cc:226:32: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
  226 |   codec_ = avcodec_find_decoder( audioStream_->codecpar->codec_id );
      |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                |
      |                                const AVCodec*
ffmpegaudio.cc: In member function ‘bool Ffmpeg::DecoderContext::play(QString&)’:
ffmpegaudio.cc:412:17: warning: ‘void av_init_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
  412 |   av_init_packet( &packet );
      |   ~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/libavcodec/avcodec.h:45,
                 from ffmpegaudio.cc:19:
/usr/include/libavcodec/packet.h:506:6: note: declared here
  506 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
ffmpegaudio.cc:472:17: warning: ‘void av_init_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
  472 |   av_init_packet( &packet );
      |   ~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/libavcodec/avcodec.h:45,
                 from ffmpegaudio.cc:19:
/usr/include/libavcodec/packet.h:506:6: note: declared here
  506 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
make: *** [Makefile:3957: build/ffmpegaudio.o] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: goldendict-git
yay -S goldendict-git  594.50s user 38.67s system 77% cpu 13:37.46 total
```
How do I fix this?


Discussion / hints:
Same error here.
seems like ffmpeg version is too new?
https://github.com/goldendict/goldendict/issues/1449
do you use ffmpeg 5.0?

Fix patch:
diff --git a/ffmpegaudio.cc b/ffmpegaudio.cc
index d550f4a77..7948d2187 100644
--- a/ffmpegaudio.cc
+++ b/ffmpegaudio.cc
@@ -94,7 +94,11 @@ struct DecoderContext
   QByteArray audioData_;
   QDataStream audioDataStream_;
   AVFormatContext * formatContext_;
+#if LIBAVCODEC_VERSION_MAJOR < 59
   AVCodec * codec_;
+#else
+  const AVCodec * codec_;
+#endif
   AVCodecContext * codecContext_;
   AVIOContext * avioContext_;
   AVStream * audioStream_;


Test patch: