ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Wed Jan 1 21:41:45 2025 -0300| [dd5696c19713096e72603de071eda3a67742c440] | committer: James Almer
avfilter/buffersrc: make channel_layout a CHLAYOUT type AVOption The string type is a remnant of the old channel layout API implementation. Reviewed-by: Nicolas George <geo...@nsup.org> Signed-off-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd5696c19713096e72603de071eda3a67742c440 --- libavfilter/buffersrc.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index c921803c67..117ac0cfa2 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -60,7 +60,6 @@ typedef struct BufferSourceContext { int sample_rate; enum AVSampleFormat sample_fmt; int channels; - char *channel_layout_str; AVChannelLayout ch_layout; int eof; @@ -370,7 +369,7 @@ static const AVOption abuffer_options[] = { { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, A }, { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A }, { "sample_fmt", NULL, OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, { .i64 = AV_SAMPLE_FMT_NONE }, .min = AV_SAMPLE_FMT_NONE, .max = INT_MAX, .flags = A }, - { "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A }, + { "channel_layout", NULL, OFFSET(ch_layout), AV_OPT_TYPE_CHLAYOUT, .flags = A }, { "channels", NULL, OFFSET(channels), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A }, { NULL }, }; @@ -388,18 +387,9 @@ static av_cold int init_audio(AVFilterContext *ctx) return AVERROR(EINVAL); } - if (s->channel_layout_str || s->ch_layout.nb_channels) { + if (av_channel_layout_check(&s->ch_layout)) { int n; - if (!s->ch_layout.nb_channels) { - ret = av_channel_layout_from_string(&s->ch_layout, s->channel_layout_str); - if (ret < 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n", - s->channel_layout_str); - return AVERROR(EINVAL); - } - } - n = s->ch_layout.nb_channels; av_channel_layout_describe(&s->ch_layout, buf, sizeof(buf)); if (s->channels) { _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".