diff options
author | Paul B Mahol <onemda@gmail.com> | 2016-02-28 22:52:44 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-02-28 23:18:31 +0100 |
commit | 65cc3915db66f39cb717636ac2355a398641694f (patch) | |
tree | 8fa02df366f386d82211746af11f3d7836f2b9bf | |
parent | 1492507208786e03732a604e1a797d5e90bbeae3 (diff) | |
download | ffmpeg-65cc3915db66f39cb717636ac2355a398641694f.tar.gz |
avfilter/avf_showvolume: support unknown channel layouts too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavfilter/avf_showvolume.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 0414b0732e..bcdbccb0ee 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -102,7 +102,7 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_formats_ref(formats, &inlink->out_formats)) < 0) return ret; - layouts = ff_all_channel_layouts(); + layouts = ff_all_channel_counts(); if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0) return ret; @@ -242,9 +242,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) } } - if (outlink->h > 40 && s->draw_text) - drawtext(s->out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, - av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c)), 1); + if (outlink->h > 40 && s->draw_text) { + const char *channel_name = av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c)); + if (!channel_name) + continue; + drawtext(s->out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, channel_name, 1); + } } } else { for (c = 0; c < inlink->channels; c++) { @@ -270,9 +273,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) } } - if (s->h >= 8 && s->draw_text) - drawtext(s->out, 2, c * (s->h + s->b) + (s->h - 8) / 2, - av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c)), 0); + if (s->h >= 8 && s->draw_text) { + const char *channel_name = av_get_channel_name(av_channel_layout_extract_channel(insamples->channel_layout, c)); + if (!channel_name) + continue; + drawtext(s->out, 2, c * (s->h + s->b) + (s->h - 8) / 2, channel_name, 0); + } } } |