try attached fix?

mashed together from ffmpeg examples and
https://stackoverflow.com/questions/76080651/how-do-we-get-the-channel-layout-syntax-from-new-ffmpeg-avcodecparameters

чт, 18 апр. 2024 г., 11:10 Andrew Randrianasulu <[email protected]>:

>
>
> чт, 18 апр. 2024 г., 11:07 Andrea paz via Cin <[email protected]
> >:
>
>> @Andrew Randrianasulu
>>
>> Complete failure with ffmpeg audio filters.
>> One premise, setting the audio driver to "pulse" the audio does not
>> work. Setting it to "alsa" works normally. I do not have Pulseaudio in
>> my system, but Pipewire takes pulse signals as if it were there. In
>> ffmpeg6 I do not have this problem.
>>
>> None of the ffmpeg filters I have tried work.
>> The typical error is as follows:
>>
>> PluginFAClient::activate: F_adynamicequalizer failed
>>   err: Option not found
>> PluginFAClient::process_buffer() F_adynamicequalizer
>>   err: Operation not permitted
>>
>> The old CinGG with ffmpeg 6 works normally.
>>
>> LV2 and native filters work fine, of course.
>>
>
> Ahh, thanks! something still wrong then ... I'll look into this.
>
>
>
> --
>> Cin mailing list
>> [email protected]
>> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>>
>
From 95be2bfbc168816bfe89282e619062195fe6fa07 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Fri, 19 Apr 2024 02:29:03 +0300
Subject: [PATCH] May be fix audio filters in ffmpeg 7.0

---
 cinelerra-5.1/cinelerra/pluginfclient.C | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/pluginfclient.C b/cinelerra-5.1/cinelerra/pluginfclient.C
index 5d4fb659..9cf6407f 100644
--- a/cinelerra-5.1/cinelerra/pluginfclient.C
+++ b/cinelerra-5.1/cinelerra/pluginfclient.C
@@ -845,14 +845,21 @@ int PluginFAClient::activate()
 	}
 	AVSampleFormat sample_fmt = AV_SAMPLE_FMT_FLTP;
 	int channels = PluginClient::total_in_buffers;
-	uint64_t layout = (((uint64_t)1)<<channels) - 1;
+	//uint64_t layout = (((uint64_t)1)<<channels) - 1;
+	AVChannelLayout layout;
+	
+	av_channel_layout_default(&layout, channels);
+	
+	char chLayoutDescription[128];
+	av_channel_layout_describe(&layout, chLayoutDescription, sizeof(chLayoutDescription));
+    
 	AVFilterGraph *graph = !ffilt ? 0 : ffilt->graph;
 	int ret = !graph ? -1 : 0;
 	if( ret >= 0 && ffilt->filter->inputs ) {
 		char args[BCTEXTLEN];
 		snprintf(args, sizeof(args),
-			"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%jx",
-			1, sample_rate, sample_rate, av_get_sample_fmt_name(sample_fmt), layout);
+			"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s",
+			1, sample_rate, sample_rate, av_get_sample_fmt_name(sample_fmt), chLayoutDescription);
 		ret = avfilter_graph_create_filter(&fsrc, avfilter_get_by_name("abuffer"),
 			"in", args, NULL, graph);
 	}
@@ -863,7 +870,7 @@ int PluginFAClient::activate()
 		ret = av_opt_set_bin(fsink, "sample_fmts",
 			(uint8_t*)&sample_fmt, sizeof(sample_fmt), AV_OPT_SEARCH_CHILDREN);
 	if( ret >= 0 )
-		ret = av_opt_set_bin(fsink, "channel_layouts",
+		ret = av_opt_set_bin(fsink, "channel_layout",
 			(uint8_t*)&layout, sizeof(layout), AV_OPT_SEARCH_CHILDREN);
 	if( ret >= 0 )
 		ret = av_opt_set_bin(fsink, "sample_rates",
@@ -990,10 +997,16 @@ int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start
 	if( ret >= 0 ) {
 		in_channels = get_inchannels();
 		out_channels = get_outchannels();
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,24,100)
+		AVChannelLayout in_ch_layout;
+		AVFilterContext *fctx = ffilt->fctx;
+		AVFilterLink **links = !fctx->nb_outputs ? 0 : fctx->outputs;
+		av_channel_layout_copy(&in_ch_layout, &links[0]->ch_layout);
+#endif
 		frame->nb_samples = size;
 		frame->format = AV_SAMPLE_FMT_FLTP;
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61,3,100)
-		frame->ch_layout.u.mask = (1<<in_channels)-1;
+		av_channel_layout_copy(&frame->ch_layout, &in_ch_layout);
 #else
 		frame->channel_layout = (1<<in_channels)-1;
 #endif
-- 
2.44.0

-- 
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to