Commit 65cc3915 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/avf_showvolume: support unknown channel layouts too

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 14925072
...@@ -102,7 +102,7 @@ static int query_formats(AVFilterContext *ctx) ...@@ -102,7 +102,7 @@ static int query_formats(AVFilterContext *ctx)
if ((ret = ff_formats_ref(formats, &inlink->out_formats)) < 0) if ((ret = ff_formats_ref(formats, &inlink->out_formats)) < 0)
return ret; return ret;
layouts = ff_all_channel_layouts(); layouts = ff_all_channel_counts();
if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0) if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0)
return ret; return ret;
...@@ -242,9 +242,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) ...@@ -242,9 +242,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
} }
} }
if (outlink->h > 40 && s->draw_text) if (outlink->h > 40 && s->draw_text) {
drawtext(s->out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, const char *channel_name = av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c));
av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c)), 1); if (!channel_name)
continue;
drawtext(s->out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, channel_name, 1);
}
} }
} else { } else {
for (c = 0; c < inlink->channels; c++) { for (c = 0; c < inlink->channels; c++) {
...@@ -270,9 +273,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) ...@@ -270,9 +273,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
} }
} }
if (s->h >= 8 && s->draw_text) if (s->h >= 8 && s->draw_text) {
drawtext(s->out, 2, c * (s->h + s->b) + (s->h - 8) / 2, const char *channel_name = av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c));
av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c)), 0); if (!channel_name)
continue;
drawtext(s->out, 2, c * (s->h + s->b) + (s->h - 8) / 2, channel_name, 0);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment