From 3fef5ef60b7674d6431f4e1e4ba8c69b0c21c023 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 6 May 2023 22:26:07 -0400 Subject: [PATCH] Fix building with newer FFmpeg This has been build tested against FFmpeg 4.4 and 6.0. --- src/arch/MovieTexture/MovieTexture_FFMpeg.cpp | 4 ++-- src/arch/MovieTexture/MovieTexture_FFMpeg.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index 935ddf324b0..d4eed01d599 100644 --- a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -405,7 +405,7 @@ void MovieTexture_FFMpeg::RegisterProtocols() return; Done = true; -#if !FF_API_NEXT +#if LIBAVCODEC_VERSION_MAJOR < 58 avcodec::avcodec_register_all(); avcodec::av_register_all(); #endif @@ -508,7 +508,7 @@ RString MovieDecoder_FFMpeg::OpenCodec() if( m_pStreamCodec->codec ) avcodec::avcodec_close( m_pStreamCodec ); - avcodec::AVCodec *pCodec = avcodec::avcodec_find_decoder( m_pStreamCodec->codec_id ); + const avcodec::AVCodec *pCodec = avcodec::avcodec_find_decoder( m_pStreamCodec->codec_id ); if( pCodec == nullptr ) return ssprintf( "Couldn't find decoder %i", m_pStreamCodec->codec_id ); diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/src/arch/MovieTexture/MovieTexture_FFMpeg.h index c092b765fc2..99f5ffcb1be 100644 --- a/src/arch/MovieTexture/MovieTexture_FFMpeg.h +++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.h @@ -13,6 +13,7 @@ namespace avcodec #include #include #include + #include #if LIBAVCODEC_VERSION_MAJOR >= 58 #define av_free_packet av_packet_unref