From 52cb146ab200e71204443c089ddba3723022a24e Mon Sep 17 00:00:00 2001 From: Martial Brasselet Date: Thu, 17 Oct 2024 18:26:49 +0200 Subject: [PATCH] use flag in filtering to push frames directly and remove it from buffer --- src/filter_graph.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/filter_graph.rs b/src/filter_graph.rs index 6135e44..6b3f047 100644 --- a/src/filter_graph.rs +++ b/src/filter_graph.rs @@ -250,9 +250,10 @@ impl FilterGraph { for input in &self.audio_inputs { if let Some(label) = &frame.name { if input.get_label() == *label { - check_result!(av_buffersrc_add_frame( + check_result!(av_buffersrc_add_frame_flags( input.context, - av_frame_clone(frame.frame) + av_frame_clone(frame.frame), + 4 )); } } @@ -262,9 +263,10 @@ impl FilterGraph { for input in &self.video_inputs { if let Some(label) = &frame.name { if input.get_label() == *label { - check_result!(av_buffersrc_add_frame( + check_result!(av_buffersrc_add_frame_flags( input.context, - av_frame_clone(frame.frame) + av_frame_clone(frame.frame), + 4 )); } } @@ -275,7 +277,7 @@ impl FilterGraph { let mut result = 0; while result >= 0 { let output_frame = av_frame_alloc(); - result = av_buffersink_get_frame(output_filter.context, output_frame); + result = av_buffersink_get_frame_flags(output_filter.context, output_frame, 2); if result == AVERROR(EAGAIN) || result == AVERROR_EOF { break; } else { @@ -293,7 +295,7 @@ impl FilterGraph { let mut result = 0; while result >= 0 { let output_frame = av_frame_alloc(); - result = av_buffersink_get_frame(output_filter.context, output_frame); + result = av_buffersink_get_frame_flags(output_filter.context, output_frame, 2); if result == AVERROR(EAGAIN) || result == AVERROR_EOF { break; } else {