diff --git a/app/src/compat.h b/app/src/compat.h index 00cb7204..e80a9dd2 100644 --- a/app/src/compat.h +++ b/app/src/compat.h @@ -25,6 +25,12 @@ # define SCRCPY_LAVF_REQUIRES_REGISTER_ALL #endif +// Not documented in ffmpeg/doc/APIchanges, but AV_CODEC_ID_AV1 has been added +// by FFmpeg commit d42809f9835a4e9e5c7c63210abb09ad0ef19cfb (included in tag +// n3.3). +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 89, 100) +# define SCRCPY_LAVC_HAS_AV1 +#endif // In ffmpeg/doc/APIchanges: // 2018-01-28 - ea3672b7d6 - lavf 58.7.100 - avformat.h diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 5a613505..4fcdd9ad 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -33,7 +33,12 @@ sc_demuxer_to_avcodec_id(uint32_t codec_id) { case SC_CODEC_ID_H265: return AV_CODEC_ID_HEVC; case SC_CODEC_ID_AV1: +#ifdef SCRCPY_LAVC_HAS_AV1 return AV_CODEC_ID_AV1; +#else + LOGE("AV1 not supported by this FFmpeg version"); + return AV_CODEC_ID_NONE; +#endif case SC_CODEC_ID_OPUS: return AV_CODEC_ID_OPUS; case SC_CODEC_ID_AAC: