Skip to content

Display and control your Android device

Retrieve icon decoder directly

Romain Vimont24b9e0a9705a
diff --git a/app/src/icon.c b/app/src/icon.c
index a9aad875..0dddefa3 100644
--- a/app/src/icon.c
+++ b/app/src/icon.c
@@ -78,7 +78,19 @@ decode_image(const char *path) {
goto close_input;
}
- int stream = av_find_best_stream(ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
+
+// In ffmpeg/doc/APIchanges:
+// 2021-04-27 - 46dac8cf3d - lavf 59.0.100 - avformat.h
+// av_find_best_stream now uses a const AVCodec ** parameter
+// for the returned decoder.
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 0, 100)
+ const AVCodec *codec;
+#else
+ AVCodec *codec;
+#endif
+
+ int stream =
+ av_find_best_stream(ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);
if (stream < 0 ) {
LOGE("Could not find best image stream");
goto close_input;
@@ -86,12 +98,6 @@ decode_image(const char *path) {
AVCodecParameters *params = ctx->streams[stream]->codecpar;
- const AVCodec *codec = avcodec_find_decoder(params->codec_id);
- if (!codec) {
- LOGE("Could not find image decoder");
- goto close_input;
- }
-
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
if (!codec_ctx) {
LOG_OOM();