Control: tags 1144330 + patch
Control: tags 1144330 + pending

Dear maintainer,

I've prepared an NMU for libopenshot (versioned as 0.5.0+dfsg1-2.1) and 
uploaded it to DELAYED/2. Please feel free to tell me if I should cancel it.

cu
Adrian
diffstat for libopenshot-0.5.0+dfsg1 libopenshot-0.5.0+dfsg1

 changelog             |    7 ++
 patches/ffmpeg9.patch |  134 ++++++++++++++++++++++++++++++++++++++++++++++++++
 patches/series        |    1 
 3 files changed, 142 insertions(+)

diff -Nru libopenshot-0.5.0+dfsg1/debian/changelog libopenshot-0.5.0+dfsg1/debian/changelog
--- libopenshot-0.5.0+dfsg1/debian/changelog	2026-03-05 01:13:40.000000000 +0200
+++ libopenshot-0.5.0+dfsg1/debian/changelog	2026-10-16 21:38:30.000000000 +0300
@@ -1,3 +1,10 @@
+libopenshot (0.5.0+dfsg1-2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add fix for FTBFS with FFmpeg 9. (Closes: #1144330)
+
+ -- Adrian Bunk <[email protected]>  Fri, 16 Oct 2026 21:38:30 +0300
+
 libopenshot (0.5.0+dfsg1-2) unstable; urgency=medium
 
   * Team upload
diff -Nru libopenshot-0.5.0+dfsg1/debian/patches/ffmpeg9.patch libopenshot-0.5.0+dfsg1/debian/patches/ffmpeg9.patch
--- libopenshot-0.5.0+dfsg1/debian/patches/ffmpeg9.patch	1970-01-01 02:00:00.000000000 +0200
+++ libopenshot-0.5.0+dfsg1/debian/patches/ffmpeg9.patch	2026-10-16 21:38:30.000000000 +0300
@@ -0,0 +1,134 @@
+--- libopenshot-0.7.0/src/FFmpegWriter.cpp	2026-04-03 01:34:37.000000000 +0200
++++ libopenshot-0.7.0/src/FFmpegWriter.cpp	2026-08-13 19:59:55.020084338 +0200
+@@ -1042,38 +1042,60 @@
+ #endif
+ 
+ 	// Set valid sample rate (or throw error)
+-	if (codec->supported_samplerates) {
+-		int i;
+-		for (i = 0; codec->supported_samplerates[i] != 0; i++)
+-			if (info.sample_rate == codec->supported_samplerates[i]) {
+-				// Set the valid sample rate
+-				c->sample_rate = info.sample_rate;
+-				break;
+-			}
+-		if (codec->supported_samplerates[i] == 0)
+-			throw InvalidSampleRate("An invalid sample rate was detected for this codec.", path);
+-	} else
+-		// Set sample rate
+-		c->sample_rate = info.sample_rate;
++	// AVCodec.supported_samplerates removed in FFmpeg 9+
++	{
++		const int *supported_samplerates = NULL;
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
++		if (avcodec_get_supported_config(NULL, codec, AV_CODEC_CONFIG_SAMPLE_RATE, 0,
++						 (const void **)&supported_samplerates, NULL) < 0)
++			supported_samplerates = NULL;
++#else
++		supported_samplerates = codec->supported_samplerates;
++#endif
++		if (supported_samplerates) {
++			int i;
++			for (i = 0; supported_samplerates[i] != 0; i++)
++				if (info.sample_rate == supported_samplerates[i]) {
++					// Set the valid sample rate
++					c->sample_rate = info.sample_rate;
++					break;
++				}
++			if (supported_samplerates[i] == 0)
++				throw InvalidSampleRate("An invalid sample rate was detected for this codec.", path);
++		} else
++			// Set sample rate
++			c->sample_rate = info.sample_rate;
++	}
+ 
+ 	uint64_t channel_layout = info.channel_layout;
+ #if HAVE_CH_LAYOUT
+ 	// Set a valid number of channels (or throw error)
++	// AVCodec.ch_layouts removed in FFmpeg 9+
+ 	AVChannelLayout ch_layout;
+ 	av_channel_layout_from_mask(&ch_layout, info.channel_layout);
+-	if (codec->ch_layouts) {
+-		int i;
+-		for (i = 0; av_channel_layout_check(&codec->ch_layouts[i]); i++)
+-			if (av_channel_layout_compare(&ch_layout, &codec->ch_layouts[i])) {
+-				// Set valid channel layout
+-				av_channel_layout_copy(&c->ch_layout, &ch_layout);
+-				break;
+-			}
+-		if (!av_channel_layout_check(&codec->ch_layouts[i]))
+-			throw InvalidChannels("An invalid channel layout was detected (i.e. MONO / STEREO).", path);
+-	} else
+-		// Set valid channel layout
+-		av_channel_layout_copy(&c->ch_layout, &ch_layout);
++	{
++		const AVChannelLayout *ch_layouts = NULL;
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
++		if (avcodec_get_supported_config(NULL, codec, AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
++						 (const void **)&ch_layouts, NULL) < 0)
++			ch_layouts = NULL;
++#else
++		ch_layouts = codec->ch_layouts;
++#endif
++		if (ch_layouts) {
++			int i;
++			for (i = 0; av_channel_layout_check(&ch_layouts[i]); i++)
++				if (av_channel_layout_compare(&ch_layout, &ch_layouts[i])) {
++					// Set valid channel layout
++					av_channel_layout_copy(&c->ch_layout, &ch_layout);
++					break;
++				}
++			if (!av_channel_layout_check(&ch_layouts[i]))
++				throw InvalidChannels("An invalid channel layout was detected (i.e. MONO / STEREO).", path);
++		} else
++			// Set valid channel layout
++			av_channel_layout_copy(&c->ch_layout, &ch_layout);
++	}
+ #else
+ 	// Set a valid number of channels (or throw error)
+ 	if (codec->channel_layouts) {
+@@ -1092,11 +1114,22 @@
+ #endif
+ 
+ 	// Choose a valid sample_fmt
+-	if (codec->sample_fmts) {
+-		for (int i = 0; codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
+-			// Set sample format to 1st valid format (and then exit loop)
+-			c->sample_fmt = codec->sample_fmts[i];
+-			break;
++	// AVCodec.sample_fmts removed in FFmpeg 9+
++	{
++		const enum AVSampleFormat *sample_fmts = NULL;
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
++		if (avcodec_get_supported_config(NULL, codec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
++						 (const void **)&sample_fmts, NULL) < 0)
++			sample_fmts = NULL;
++#else
++		sample_fmts = codec->sample_fmts;
++#endif
++		if (sample_fmts) {
++			for (int i = 0; sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
++				// Set sample format to 1st valid format (and then exit loop)
++				c->sample_fmt = sample_fmts[i];
++				break;
++			}
+ 		}
+ 	}
+ 	if (c->sample_fmt == AV_SAMPLE_FMT_NONE) {
+@@ -1297,7 +1330,15 @@
+ #endif
+ 
+ 	// Find all supported pixel formats for this codec
+-	const PixelFormat *supported_pixel_formats = codec->pix_fmts;
++	// AVCodec.pix_fmts removed in FFmpeg 9+
++	const PixelFormat *supported_pixel_formats = NULL;
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
++	if (avcodec_get_supported_config(NULL, codec, AV_CODEC_CONFIG_PIX_FORMAT, 0,
++					 (const void **)&supported_pixel_formats, NULL) < 0)
++		supported_pixel_formats = NULL;
++#else
++	supported_pixel_formats = codec->pix_fmts;
++#endif
+ 	while (supported_pixel_formats != NULL && *supported_pixel_formats != PIX_FMT_NONE) {
+ 		// Assign the 1st valid pixel format (if one is missing)
+ 		if (c->pix_fmt == PIX_FMT_NONE)
diff -Nru libopenshot-0.5.0+dfsg1/debian/patches/series libopenshot-0.5.0+dfsg1/debian/patches/series
--- libopenshot-0.5.0+dfsg1/debian/patches/series	2026-03-05 01:12:12.000000000 +0200
+++ libopenshot-0.5.0+dfsg1/debian/patches/series	2026-10-16 21:38:30.000000000 +0300
@@ -1,3 +1,4 @@
 0001-Include-SOVERSION-in-VERSION.patch
 fix_examples.patch
 0002-fix-ffmpeg8.patch
+ffmpeg9.patch

Reply via email to