summaryrefslogtreecommitdiff
path: root/libavfilter/avf_showspectrum.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-06-03 12:43:43 +0200
committerPaul B Mahol <onemda@gmail.com>2018-06-03 12:43:43 +0200
commit49eda27c6e7ad699d8f09c8ba60b9507946d1b1c (patch)
tree82351724901a6fd0b44b55b834ba7df72278b0f4 /libavfilter/avf_showspectrum.c
parent9add1786ad4c9549e133ba7a79c22d9c4b19acf3 (diff)
avfilter/avf_showspectrum: also show sample rate and channel layout
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r--libavfilter/avf_showspectrum.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index bf9f3c5b91..04fcc8d756 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -1082,9 +1082,19 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
if (s->legend) {
int multi = (s->mode == SEPARATE && s->color_mode == CHANNEL);
float spp = samples / (float)sz;
+ char *text;
uint8_t *dst;
+ char chlayout_str[128];
+
+ av_get_channel_layout_string(chlayout_str, sizeof(chlayout_str), inlink->channels,
+ inlink->channel_layout);
+
+ text = av_asprintf("%d Hz | %s", inlink->sample_rate, chlayout_str);
drawtext(s->outpicref, 2, outlink->h - 10, "CREATED BY LIBAVFILTER", 0);
+ drawtext(s->outpicref, outlink->w - 2 - strlen(text) * 10, outlink->h - 10, text, 0);
+
+ av_freep(&text);
dst = s->outpicref->data[0] + (s->start_y - 1) * s->outpicref->linesize[0] + s->start_x - 1;
for (x = 0; x < s->w + 1; x++)