diff --git a/multimedia/olive/Makefile b/multimedia/olive/Makefile index 8711c8d6d04d..13417c671856 100644 --- a/multimedia/olive/Makefile +++ b/multimedia/olive/Makefile @@ -1,52 +1,49 @@ PORTNAME= olive DISTVERSION= 0.2.0 DISTVERSIONSUFFIX= -nightly -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= multimedia PKGNAMESUFFIX= -video-editor -PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ -PATCHFILES= 311eeb72944f93f873d1cd1784ee2bf423e1e7c2.patch:-p1 # https://github.com/olive-editor/olive/pull/2294, OpenColorIO 2.3 compatibility - MAINTAINER= yuri@FreeBSD.org COMMENT= Non-linear video editor WWW= https://olivevideoeditor.org/ \ https://github.com/olive-editor/olive LICENSE= GPLv3 LICENSE_FILE= ${WRKSRC}/LICENSE -BROKEN= Fails to build with FFmpeg 9 #BROKEN_armv7= compilation fails: error: unknown type name '__m128' #BROKEN_i386= compilation fails, see https://github.com/olive-editor/olive/issues/2364 #BROKEN_powerpc=compilation fails, see https://github.com/olive-editor/olive/issues/2364 BUILD_DEPENDS= frei0r>0:graphics/frei0r LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg \ libImath.so:math/Imath \ libOpenColorIO.so:graphics/opencolorio \ libOpenEXR.so:graphics/openexr \ libOpenImageIO.so:graphics/openimageio \ - libportaudio.so:audio/portaudio + libportaudio.so:audio/portaudio \ + libxkbcommon.so:x11/libxkbcommon RUN_DEPENDS= frei0r>0:graphics/frei0r # libopentimelineio.so:multimedia/opentimelineio USES= cmake compiler:c++17-lang desktop-file-utils gl pkgconfig qt:6 shared-mime-info USE_QT= base multimedia svg \ tools:build USE_GL= gl CMAKE_ON= BUILD_QT6 USE_GITHUB= yes GH_ACCOUNT= olive-editor GH_TUPLE= olive-editor:core:2777928:core/ext/core \ KDAB:KDDockWidgets:8d2d0a5:KDDockWidgets/ext/KDDockWidgets CXXFLAGS_i386= -msse -msse2 PORTSCOUT= limit:^.*[1-9]\..* # prevent tags like 20181223 CONFLICTS_BUILD= opentimelineio # fails to build with the opentimelineio optional dependency, see https://github.com/olive-editor/olive/issues/2201 .include diff --git a/multimedia/olive/distinfo b/multimedia/olive/distinfo index c53ecf53e1ad..48df272a0523 100644 --- a/multimedia/olive/distinfo +++ b/multimedia/olive/distinfo @@ -1,9 +1,7 @@ -TIMESTAMP = 1733649622 +TIMESTAMP = 1789503696 SHA256 (olive-editor-olive-0.2.0-nightly_GH0.tar.gz) = 0c82e35b862f8eb2afcf30e6529b155f709c59668d1f13d475b9aa32a62fa8b6 SIZE (olive-editor-olive-0.2.0-nightly_GH0.tar.gz) = 8155942 SHA256 (olive-editor-core-2777928_GH0.tar.gz) = 2a7f57fcf782d62d9a40a3c51a1cb7d5f87aaf20952402d9d52bdbafddbaec6c SIZE (olive-editor-core-2777928_GH0.tar.gz) = 76380 SHA256 (KDAB-KDDockWidgets-8d2d0a5_GH0.tar.gz) = 5d6d40c8a3f128ce61769c2bcb01b89dfd92460779e63cde40d8068647157705 SIZE (KDAB-KDDockWidgets-8d2d0a5_GH0.tar.gz) = 3930847 -SHA256 (311eeb72944f93f873d1cd1784ee2bf423e1e7c2.patch) = 776c164ae6b4fb1a861b56b78b7277cde9cb8d52ef759dba8fe3981832783add -SIZE (311eeb72944f93f873d1cd1784ee2bf423e1e7c2.patch) = 1547 diff --git a/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp b/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp index 943c59accca8..dfe7c0ee288d 100644 --- a/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp +++ b/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp @@ -1,108 +1,174 @@ ---- app/codec/ffmpeg/ffmpegencoder.cpp.orig 2024-12-04 17:13:33 UTC +-- Fix build with FFmpeg 9 (libavcodec 61+) where AVCodec::pix_fmts and +-- AVCodec::sample_fmts are no longer directly accessible. Use the new +-- avcodec_get_supported_config() API instead. +-- See: https://github.com/olive-editor/olive/issues/2387 + +--- app/codec/ffmpeg/ffmpegencoder.cpp.orig +++ app/codec/ffmpeg/ffmpegencoder.cpp +@@ -55,6 +55,22 @@ QStringList FFmpegEncoder::GetPixelFormatsForCodec(ExportCodec::Codec c) const + const AVCodec* codec_info = GetEncoder(c, SampleFormat::INVALID); + + if (codec_info) { ++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100) ++ const AVPixelFormat* supported_pix_fmts = nullptr; ++ if (avcodec_get_supported_config(nullptr, codec_info, AV_CODEC_CONFIG_PIX_FORMAT, 0, ++ reinterpret_cast(&supported_pix_fmts), nullptr) >= 0 ++ && supported_pix_fmts) { ++ for (int i=0; supported_pix_fmts[i]!=AV_PIX_FMT_NONE; i++) { ++ if (FFmpegUtils::ConvertJPEGSpaceToRegularSpace(supported_pix_fmts[i]) != supported_pix_fmts[i]) { ++ // This is a deprecated "JPEG" space, skip it ++ continue; ++ } ++ ++ const char* pix_fmt_name = av_get_pix_fmt_name(supported_pix_fmts[i]); ++ pix_fmts.append(pix_fmt_name); ++ } ++ } ++#else + for (int i=0; codec_info->pix_fmts[i]!=-1; i++) { + if (FFmpegUtils::ConvertJPEGSpaceToRegularSpace(codec_info->pix_fmts[i]) != codec_info->pix_fmts[i]) { + // This is a deprecated "JPEG" space, skip it +@@ -64,6 +80,7 @@ QStringList FFmpegEncoder::GetPixelFormatsForCodec(ExportCodec::Codec c) const + const char* pix_fmt_name = av_get_pix_fmt_name(codec_info->pix_fmts[i]); + pix_fmts.append(pix_fmt_name); + } ++#endif + } + + return pix_fmts; +@@ -88,6 +105,21 @@ std::vector FFmpegEncoder::GetSampleFormatsForCodec(ExportCodec::Co + } else { + const AVCodec* codec_info = GetEncoder(c, SampleFormat::INVALID); + ++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100) ++ if (codec_info) { ++ const AVSampleFormat* supported_sample_fmts = nullptr; ++ if (avcodec_get_supported_config(nullptr, codec_info, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, ++ reinterpret_cast(&supported_sample_fmts), nullptr) >= 0 ++ && supported_sample_fmts) { ++ for (int i=0; supported_sample_fmts[i]!=AV_SAMPLE_FMT_NONE; i++) { ++ SampleFormat this_format = FFmpegUtils::GetNativeSampleFormat(supported_sample_fmts[i]); ++ if (this_format != SampleFormat::INVALID) { ++ f.push_back(this_format); ++ } ++ } ++ } ++ } ++#else + if (codec_info && codec_info->sample_fmts) { + for (int i=0; codec_info->sample_fmts[i]!=-1; i++) { + SampleFormat this_format = FFmpegUtils::GetNativeSampleFormat(static_cast(codec_info->sample_fmts[i])); +@@ -96,6 +128,7 @@ std::vector FFmpegEncoder::GetSampleFormatsForCodec(ExportCodec::Co + } + } + } ++#endif + } + + return f; @@ -334,7 +334,11 @@ bool FFmpegEncoder::WriteAudioData(const AudioParams & int output_sample_count = input_sample_count ? swr_get_out_samples(audio_resample_ctx_, input_sample_count) : 102400; uint8_t** output_data = nullptr; int output_linesize; +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) + av_samples_alloc_array_and_samples(&output_data, &output_linesize, audio_stream_->codecpar->ch_layout.nb_channels, +#else av_samples_alloc_array_and_samples(&output_data, &output_linesize, audio_stream_->codecpar->channels, +#endif output_sample_count, static_cast(audio_stream_->codecpar->format), 0); // Perform conversion @@ -349,7 +353,11 @@ bool FFmpegEncoder::WriteAudioData(const AudioParams & av_samples_copy(audio_frame_->data, output_data, audio_frame_offset_, i, copy_length, +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) + audio_frame_->ch_layout.nb_channels, static_cast(audio_frame_->format)); +#else audio_frame_->channels, static_cast(audio_frame_->format)); +#endif audio_frame_offset_ += copy_length; i += copy_length; @@ -690,8 +698,12 @@ bool FFmpegEncoder::InitializeStream(AVMediaType type, // Assume audio stream codec_ctx->sample_rate = params().audio_params().sample_rate(); +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) + av_channel_layout_from_mask(&codec_ctx->ch_layout, params().audio_params().channel_layout()); +#else codec_ctx->channel_layout = params().audio_params().channel_layout(); codec_ctx->channels = av_get_channel_layout_nb_channels(codec_ctx->channel_layout); +#endif codec_ctx->sample_fmt = FFmpegUtils::GetFFmpegSampleFormat(params().audio_params().format()); codec_ctx->time_base = {1, codec_ctx->sample_rate}; @@ -787,12 +799,19 @@ void FFmpegEncoder::FlushEncoders() } if (fmt_ctx_) { +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 0, 100) + // AVFMT_ALLOW_FLUSH removed in ffmpeg 7+, always allow flush now + int r = av_interleaved_write_frame(fmt_ctx_, nullptr); +#else if (fmt_ctx_->oformat->flags & AVFMT_ALLOW_FLUSH) { int r = av_interleaved_write_frame(fmt_ctx_, nullptr); +#endif if (r < 0) { FFmpegError(tr("Failed to write interleaved packet"), r); } +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59, 0, 100) } +#endif } } @@ -829,6 +848,28 @@ bool FFmpegEncoder::InitializeResampleContext(const Au } // Create resample context +#if LIBSWRESAMPLE_VERSION_INT >= AV_VERSION_INT(4, 5, 100) + AVChannelLayout out_ch_layout = AV_CHANNEL_LAYOUT_MASK(0, 0); + AVChannelLayout in_ch_layout = AV_CHANNEL_LAYOUT_MASK(0, 0); + av_channel_layout_from_mask(&out_ch_layout, audio_codec_ctx_->ch_layout.u.mask ? audio_codec_ctx_->ch_layout.u.mask : AV_CH_LAYOUT_STEREO); + av_channel_layout_from_mask(&in_ch_layout, audio.channel_layout()); + + int ret = swr_alloc_set_opts2(&audio_resample_ctx_, + &out_ch_layout, + audio_codec_ctx_->sample_fmt, + audio_codec_ctx_->sample_rate, + &in_ch_layout, + FFmpegUtils::GetFFmpegSampleFormat(audio.format()), + audio.sample_rate(), + 0, + nullptr); + av_channel_layout_uninit(&out_ch_layout); + av_channel_layout_uninit(&in_ch_layout); + + if (ret < 0) { + return false; + } +#else audio_resample_ctx_ = swr_alloc_set_opts(nullptr, static_cast(audio_codec_ctx_->channel_layout), audio_codec_ctx_->sample_fmt, @@ -838,6 +879,7 @@ bool FFmpegEncoder::InitializeResampleContext(const Au audio.sample_rate(), 0, nullptr); +#endif if (!audio_resample_ctx_) { return false; } @@ -865,7 +907,11 @@ bool FFmpegEncoder::InitializeResampleContext(const Au return false; } +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) + av_channel_layout_copy(&audio_frame_->ch_layout, &audio_codec_ctx_->ch_layout); +#else audio_frame_->channel_layout = audio_codec_ctx_->channel_layout; +#endif audio_frame_->format = audio_codec_ctx_->sample_fmt; audio_frame_->nb_samples = audio_max_samples_; diff --git a/multimedia/olive/files/patch-app_render_renderer.cpp b/multimedia/olive/files/patch-app_render_renderer.cpp new file mode 100644 index 000000000000..54430d0c53d8 --- /dev/null +++ b/multimedia/olive/files/patch-app_render_renderer.cpp @@ -0,0 +1,25 @@ +-- OpenColorIO 2.3+ changed GpuShaderDesc::getTexture to require a +-- TextureDimensions argument. Add it with a version guard. +-- Upstream: https://github.com/olive-editor/olive/pull/2294 + +--- app/render/renderer.cpp.orig ++++ app/render/renderer.cpp +@@ -240,9 +240,17 @@ bool Renderer::GetColorContext(const ColorTransformJob &color_job, Renderer::Co + const char* sampler_name = nullptr; + unsigned int width = 0, height = 0; + OCIO::GpuShaderDesc::TextureType channel = OCIO::GpuShaderDesc::TEXTURE_RGB_CHANNEL; ++#if OCIO_VERSION_HEX >= 0x02030000 ++ OCIO::GpuShaderDesc::TextureDimensions dimensions = OCIO::GpuShaderDesc::TEXTURE_2D; ++#endif + OCIO::Interpolation interpolation = OCIO::INTERP_LINEAR; + +- shader_desc->getTexture(i, tex_name, sampler_name, width, height, channel, interpolation); ++ shader_desc->getTexture(i, tex_name, sampler_name, width, height, channel, ++#if OCIO_VERSION_HEX >= 0x02030000 ++ // OCIO::GpuShaderDesc::TextureDimensions ++ dimensions, ++#endif ++ interpolation); + + if (!tex_name || !*tex_name + || !sampler_name || !*sampler_name