Is there a reason not to go with the upstram fix for this? See https://github.com/audaspace/audaspace/commit/8841635 On Mon, 10 Aug 2026, Kirill A. Korinsky wrote: > ports@, > > I'd like to commit a fix for graphics/blender which switches it away from > deprecated API in ffmpeg which prevents it to build against ffmpeg 9.0 > > Build tested against ffmpeg-9.0 and ffmpeg-8.1.2 > > Tests? Ok? > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/graphics/blender/Makefile,v > diff -u -p -r1.151 Makefile > --- Makefile 2 Mar 2026 15:00:23 -0000 1.151 > +++ Makefile 10 Aug 2026 19:59:40 -0000 > @@ -9,7 +9,7 @@ COMMENT = 3D creation software > VERSION = 4.5.3 > V = ${VERSION:R} > DISTNAME = blender-${VERSION} > -REVISION = 3 > +REVISION = 4 > > CATEGORIES = graphics > > Index: patches/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter_cpp > =================================================================== > RCS file: patches/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter_cpp > diff -N patches/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter_cpp 10 Aug 2026 19:59:40 -0000 > @@ -0,0 +1,105 @@ > +Index: extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp > +--- extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp.orig > ++++ extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp > +@@ -179,6 +179,10 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename > + m_input_samples(0), > + m_deinterleave(false) > + { > ++ const enum AVSampleFormat* sample_fmts; > ++ const int* supported_samplerates; > ++ int num_sample_fmts, num_supported_samplerates, ret; > ++ > + static const char* formats[] = { nullptr, "ac3", "flac", "matroska", "mp2", "mp3", "ogg", "wav", "adts" }; > + > + if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0) > +@@ -303,6 +307,11 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename > + if(!m_codecCtx) > + AUD_THROW(FileException, "File couldn't be written, context creation failed with ffmpeg."); > + > ++ ret = avcodec_get_supported_config(m_codecCtx, nullptr, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, > ++ (const void**)&sample_fmts, &num_sample_fmts); > ++ if(ret < 0) > ++ AUD_THROW(FileException, "File couldn't be written, sample formats couldn't be queried with ffmpeg."); > ++ > + switch(m_specs.format) > + { > + case FORMAT_U8: > +@@ -330,25 +339,28 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename > + if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER) > + m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; > + > +- bool format_supported = false; > ++ bool format_supported = !sample_fmts; > + > +- for(int i = 0; codec->sample_fmts[i] != -1; i++) > ++ if(sample_fmts) > + { > +- if(av_get_alt_sample_fmt(codec->sample_fmts[i], false) == m_codecCtx->sample_fmt) > ++ for(int i = 0; i < num_sample_fmts; i++) > + { > +- m_deinterleave = av_sample_fmt_is_planar(codec->sample_fmts[i]); > +- m_codecCtx->sample_fmt = codec->sample_fmts[i]; > +- format_supported = true; > ++ if(av_get_alt_sample_fmt(sample_fmts[i], false) == m_codecCtx->sample_fmt) > ++ { > ++ m_deinterleave = av_sample_fmt_is_planar(sample_fmts[i]); > ++ m_codecCtx->sample_fmt = sample_fmts[i]; > ++ format_supported = true; > ++ } > + } > + } > + > + if(!format_supported) > + { > + int chosen_index = 0; > +- auto chosen = av_get_alt_sample_fmt(codec->sample_fmts[chosen_index], false); > +- for(int i = 1; codec->sample_fmts[i] != -1; i++) > ++ auto chosen = av_get_alt_sample_fmt(sample_fmts[chosen_index], false); > ++ for(int i = 1; i < num_sample_fmts; i++) > + { > +- auto fmt = av_get_alt_sample_fmt(codec->sample_fmts[i], false); > ++ auto fmt = av_get_alt_sample_fmt(sample_fmts[i], false); > + if((fmt > chosen && chosen < m_codecCtx->sample_fmt) || (fmt > m_codecCtx->sample_fmt && fmt < chosen)) > + { > + chosen = fmt; > +@@ -356,7 +368,7 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename > + } > + } > + > +- m_codecCtx->sample_fmt = codec->sample_fmts[chosen_index]; > ++ m_codecCtx->sample_fmt = sample_fmts[chosen_index]; > + m_deinterleave = av_sample_fmt_is_planar(m_codecCtx->sample_fmt); > + switch(av_get_alt_sample_fmt(m_codecCtx->sample_fmt, false)) > + { > +@@ -387,19 +399,24 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename > + > + m_codecCtx->sample_rate = 0; > + > +- if(codec->supported_samplerates) > ++ ret = avcodec_get_supported_config(m_codecCtx, nullptr, AV_CODEC_CONFIG_SAMPLE_RATE, 0, > ++ (const void**)&supported_samplerates, &num_supported_samplerates); > ++ if(ret < 0) > ++ AUD_THROW(FileException, "File couldn't be written, sample rates couldn't be queried with ffmpeg."); > ++ > ++ if(supported_samplerates) > + { > +- for(int i = 0; codec->supported_samplerates[i]; i++) > ++ for(int i = 0; i < num_supported_samplerates; i++) > + { > +- if(codec->supported_samplerates[i] == m_specs.rate) > ++ if(supported_samplerates[i] == m_specs.rate) > + { > +- m_codecCtx->sample_rate = codec->supported_samplerates[i]; > ++ m_codecCtx->sample_rate = supported_samplerates[i]; > + break; > + } > +- else if((codec->supported_samplerates[i] > m_codecCtx->sample_rate && m_specs.rate > m_codecCtx->sample_rate) || > +- (codec->supported_samplerates[i] < m_codecCtx->sample_rate && m_specs.rate < codec->supported_samplerates[i])) > ++ else if((supported_samplerates[i] > m_codecCtx->sample_rate && m_specs.rate > m_codecCtx->sample_rate) || > ++ (supported_samplerates[i] < m_codecCtx->sample_rate && m_specs.rate < supported_samplerates[i])) > + { > +- m_codecCtx->sample_rate = codec->supported_samplerates[i]; > ++ m_codecCtx->sample_rate = supported_samplerates[i]; > + } > + } > + } > > > -- > wbr, Kirill > >
No comments:
Post a Comment