[FFmpeg-devel] [PATCH] lavfi/buffersrc: set channel layout if it is known.

Nicolas George nicolas.george at normalesup.org
Thu Mar 14 19:59:09 CET 2013


Introduced in 01649c7, lost in the API change.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavfilter/buffersrc.c |    2 ++
 1 file changed, 2 insertions(+)


With this patch and the other recent one:
"lavc: do not init frame with guessed layout."
it becomes possible to transcode files with unknown layout again.

Without this patch, init fails with the following error if the codec has a
list of supported layouts (see the explanations in the commit message for
01649c7):

Unable to find default channel layout for Input Stream #0.0

Without the other patch, buffersrc is inited for an unknown layout but
frames are added with a guessed layout, causing endless error messages about
"Changing frame properties on the fly is not supported.".


diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 80fd2be..d3f14cd 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -134,6 +134,8 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
                                  frame->format);
         break;
     case AVMEDIA_TYPE_AUDIO:
+        if (!frame->channel_layout)
+            frame->channel_layout = s->channel_layout;
         CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,
                                  frame->format);
         break;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list