Browse Source

lavfi/buffersrc: set channel layout if it is known.

If buffersrc was configured for frames with an unknown layout,
the incoming frames will have channel_layout = 0.
If the format negotiation has selected a known (and compatible)
channel layout for the link, the frame is assumed to have
that layout, the field must be set before injecting the frame
in the filters.
tags/n1.2
Nicolas George 12 years ago
parent
commit
01649c79c8
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavfilter/buffersrc.c

+ 4
- 0
libavfilter/buffersrc.c View File

@@ -121,6 +121,8 @@ int av_buffersrc_add_ref(AVFilterContext *s, AVFilterBufferRef *buf, int flags)
CHECK_VIDEO_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format); CHECK_VIDEO_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
if (!buf->audio->channel_layout)
buf->audio->channel_layout = c->channel_layout;
CHECK_AUDIO_PARAM_CHANGE(s, c, buf->audio->sample_rate, buf->audio->channel_layout, CHECK_AUDIO_PARAM_CHANGE(s, c, buf->audio->sample_rate, buf->audio->channel_layout,
buf->format); buf->format);
break; break;
@@ -370,6 +372,8 @@ static int config_props(AVFilterLink *link)
link->sample_aspect_ratio = c->pixel_aspect; link->sample_aspect_ratio = c->pixel_aspect;
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
if (!c->channel_layout)
c->channel_layout = link->channel_layout;
break; break;
default: default:
return AVERROR(EINVAL); return AVERROR(EINVAL);


Loading…
Cancel
Save