diff --git a/src/plugins/score-plugin-gfx/Gfx/Libav/LibavEncoder.cpp b/src/plugins/score-plugin-gfx/Gfx/Libav/LibavEncoder.cpp index 8809ad9532..5102831a7b 100644 --- a/src/plugins/score-plugin-gfx/Gfx/Libav/LibavEncoder.cpp +++ b/src/plugins/score-plugin-gfx/Gfx/Libav/LibavEncoder.cpp @@ -109,6 +109,7 @@ int LibavEncoder::start() int LibavEncoder::add_frame(tcb::span vec) { +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 24, 100) if(!m_formatContext) return 1; @@ -152,6 +153,8 @@ int LibavEncoder::add_frame(tcb::span vec) stream.encoder->add_frame(*next_frame, resample_outf); } return stream.write_audio_frame(m_formatContext, next_frame); +#endif + return 1; } int LibavEncoder::add_frame( diff --git a/src/plugins/score-plugin-gfx/Gfx/Libav/LibavOutputStream.hpp b/src/plugins/score-plugin-gfx/Gfx/Libav/LibavOutputStream.hpp index 2f33b25312..46f90cd7ab 100644 --- a/src/plugins/score-plugin-gfx/Gfx/Libav/LibavOutputStream.hpp +++ b/src/plugins/score-plugin-gfx/Gfx/Libav/LibavOutputStream.hpp @@ -123,6 +123,7 @@ struct OutputStream void init_audio(const LibavOutputSettings& set, AVCodecContext* c) { +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 24, 100) c->sample_fmt = av_get_sample_fmt(set.audio_converted_smpfmt.toStdString().c_str()); if(codec->supported_samplerates) @@ -148,6 +149,7 @@ struct OutputStream c->time_base = AVRational{1, c->sample_rate}; c->framerate = AVRational{c->sample_rate, 1}; qDebug() << "Opening audio encoder with: rate: " << c->sample_rate; +#endif } void init_video(const LibavOutputSettings& set, AVCodecContext* c) @@ -460,6 +462,7 @@ struct OutputStream int write_video_frame(AVFormatContext* fmt_ctx, AVFrame* input_frame) { +#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(7, 5, 100) // scale the frame int ret = sws_scale_frame(sws_ctx, tmp_frame, input_frame); if(ret < 0) @@ -505,6 +508,8 @@ struct OutputStream } return ret == AVERROR_EOF ? 1 : 0; +#endif + return 1; } // #define SRC_RATE SAMPLE_RATE_TEST diff --git a/src/plugins/score-plugin-gfx/score_plugin_gfx.cpp b/src/plugins/score-plugin-gfx/score_plugin_gfx.cpp index 932f7f0101..55535f0012 100644 --- a/src/plugins/score-plugin-gfx/score_plugin_gfx.cpp +++ b/src/plugins/score-plugin-gfx/score_plugin_gfx.cpp @@ -64,8 +64,11 @@ std::vector score_plugin_gfx::factories( { return instantiate_factories< score::ApplicationContext, - FW= AV_VERSION_INT(57, 24, 100) + , Gfx::LibavOutputProtocolFactory +#endif #if defined(SCORE_HAS_SHMDATA) , Gfx::Shmdata::InputFactory, Gfx::ShmdataOutputProtocolFactory