avf_showvolume.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /*
  2. * Copyright (c) 2015 Paul B Mahol
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libavutil/avstring.h"
  21. #include "libavutil/channel_layout.h"
  22. #include "libavutil/eval.h"
  23. #include "libavutil/intreadwrite.h"
  24. #include "libavutil/opt.h"
  25. #include "libavutil/parseutils.h"
  26. #include "libavutil/xga_font_data.h"
  27. #include "avfilter.h"
  28. #include "filters.h"
  29. #include "formats.h"
  30. #include "audio.h"
  31. #include "video.h"
  32. #include "internal.h"
  33. static const char *const var_names[] = { "VOLUME", "CHANNEL", "PEAK", NULL };
  34. enum { VAR_VOLUME, VAR_CHANNEL, VAR_PEAK, VAR_VARS_NB };
  35. enum DisplayScale { LINEAR, LOG, NB_DISPLAY_SCALE };
  36. typedef struct ShowVolumeContext {
  37. const AVClass *class;
  38. int w, h;
  39. int b;
  40. double f;
  41. AVRational frame_rate;
  42. char *color;
  43. int orientation;
  44. int step;
  45. float bgopacity;
  46. int mode;
  47. int nb_samples;
  48. AVFrame *out;
  49. AVExpr *c_expr;
  50. int draw_text;
  51. int draw_volume;
  52. double *values;
  53. uint32_t *color_lut;
  54. float *max;
  55. int display_scale;
  56. double draw_persistent_duration; /* in second */
  57. uint8_t persistant_max_rgba[4];
  58. int persistent_max_frames; /* number of frames to check max value */
  59. float *max_persistent; /* max value for draw_persistent_max for each channel */
  60. int *nb_frames_max_display; /* number of frame for each channel, for displaying the max value */
  61. void (*meter)(float *src, int nb_samples, float *max);
  62. } ShowVolumeContext;
  63. #define OFFSET(x) offsetof(ShowVolumeContext, x)
  64. #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  65. static const AVOption showvolume_options[] = {
  66. { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
  67. { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
  68. { "b", "set border width", OFFSET(b), AV_OPT_TYPE_INT, {.i64=1}, 0, 5, FLAGS },
  69. { "w", "set channel width", OFFSET(w), AV_OPT_TYPE_INT, {.i64=400}, 80, 8192, FLAGS },
  70. { "h", "set channel height", OFFSET(h), AV_OPT_TYPE_INT, {.i64=20}, 1, 900, FLAGS },
  71. { "f", "set fade", OFFSET(f), AV_OPT_TYPE_DOUBLE, {.dbl=0.95}, 0, 1, FLAGS },
  72. { "c", "set volume color expression", OFFSET(color), AV_OPT_TYPE_STRING, {.str="PEAK*255+floor((1-PEAK)*255)*256+0xff000000"}, 0, 0, FLAGS },
  73. { "t", "display channel names", OFFSET(draw_text), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
  74. { "v", "display volume value", OFFSET(draw_volume), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
  75. { "dm", "duration for max value display", OFFSET(draw_persistent_duration), AV_OPT_TYPE_DOUBLE, {.dbl=0.}, 0, 9000, FLAGS},
  76. { "dmc","set color of the max value line", OFFSET(persistant_max_rgba), AV_OPT_TYPE_COLOR, {.str = "orange"}, 0, 0, FLAGS },
  77. { "o", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "orientation" },
  78. { "h", "horizontal", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "orientation" },
  79. { "v", "vertical", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "orientation" },
  80. { "s", "set step size", OFFSET(step), AV_OPT_TYPE_INT, {.i64=0}, 0, 5, FLAGS },
  81. { "p", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, FLAGS },
  82. { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "mode" },
  83. { "p", "peak", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" },
  84. { "r", "rms", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" },
  85. { "ds", "set display scale", OFFSET(display_scale), AV_OPT_TYPE_INT, {.i64=LINEAR}, LINEAR, NB_DISPLAY_SCALE - 1, FLAGS, "display_scale" },
  86. { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, FLAGS, "display_scale" },
  87. { "log", "log", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, FLAGS, "display_scale" },
  88. { NULL }
  89. };
  90. AVFILTER_DEFINE_CLASS(showvolume);
  91. static av_cold int init(AVFilterContext *ctx)
  92. {
  93. ShowVolumeContext *s = ctx->priv;
  94. int ret;
  95. if (s->color) {
  96. ret = av_expr_parse(&s->c_expr, s->color, var_names,
  97. NULL, NULL, NULL, NULL, 0, ctx);
  98. if (ret < 0)
  99. return ret;
  100. }
  101. return 0;
  102. }
  103. static int query_formats(AVFilterContext *ctx)
  104. {
  105. AVFilterFormats *formats = NULL;
  106. AVFilterChannelLayouts *layouts = NULL;
  107. AVFilterLink *inlink = ctx->inputs[0];
  108. AVFilterLink *outlink = ctx->outputs[0];
  109. static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
  110. static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE };
  111. int ret;
  112. formats = ff_make_format_list(sample_fmts);
  113. if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
  114. return ret;
  115. layouts = ff_all_channel_counts();
  116. if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0)
  117. return ret;
  118. formats = ff_all_samplerates();
  119. if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
  120. return ret;
  121. formats = ff_make_format_list(pix_fmts);
  122. if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
  123. return ret;
  124. return 0;
  125. }
  126. static void find_peak(float *src, int nb_samples, float *peak)
  127. {
  128. float max = 0.f;
  129. max = 0;
  130. for (int i = 0; i < nb_samples; i++)
  131. max = fmaxf(max, fabsf(src[i]));
  132. *peak = max;
  133. }
  134. static void find_rms(float *src, int nb_samples, float *rms)
  135. {
  136. float sum = 0.f;
  137. for (int i = 0; i < nb_samples; i++)
  138. sum += src[i] * src[i];
  139. *rms = sqrtf(sum / nb_samples);
  140. }
  141. static int config_input(AVFilterLink *inlink)
  142. {
  143. AVFilterContext *ctx = inlink->dst;
  144. ShowVolumeContext *s = ctx->priv;
  145. s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
  146. s->values = av_calloc(inlink->ch_layout.nb_channels * VAR_VARS_NB, sizeof(double));
  147. if (!s->values)
  148. return AVERROR(ENOMEM);
  149. s->color_lut = av_calloc(s->w, sizeof(*s->color_lut) * inlink->ch_layout.nb_channels);
  150. if (!s->color_lut)
  151. return AVERROR(ENOMEM);
  152. s->max = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->max));
  153. if (!s->max)
  154. return AVERROR(ENOMEM);
  155. switch (s->mode) {
  156. case 0: s->meter = find_peak; break;
  157. case 1: s->meter = find_rms; break;
  158. default: return AVERROR_BUG;
  159. }
  160. if (s->draw_persistent_duration > 0.) {
  161. s->persistent_max_frames = (int) FFMAX(av_q2d(s->frame_rate) * s->draw_persistent_duration, 1.);
  162. s->max_persistent = av_calloc(inlink->ch_layout.nb_channels * s->persistent_max_frames, sizeof(*s->max_persistent));
  163. s->nb_frames_max_display = av_calloc(inlink->ch_layout.nb_channels * s->persistent_max_frames, sizeof(*s->nb_frames_max_display));
  164. if (!s->max_persistent ||
  165. !s->nb_frames_max_display)
  166. return AVERROR(ENOMEM);
  167. }
  168. return 0;
  169. }
  170. static int config_output(AVFilterLink *outlink)
  171. {
  172. ShowVolumeContext *s = outlink->src->priv;
  173. AVFilterLink *inlink = outlink->src->inputs[0];
  174. int ch;
  175. if (s->orientation) {
  176. outlink->h = s->w;
  177. outlink->w = s->h * inlink->ch_layout.nb_channels + (inlink->ch_layout.nb_channels - 1) * s->b;
  178. } else {
  179. outlink->w = s->w;
  180. outlink->h = s->h * inlink->ch_layout.nb_channels + (inlink->ch_layout.nb_channels - 1) * s->b;
  181. }
  182. outlink->sample_aspect_ratio = (AVRational){1,1};
  183. outlink->frame_rate = s->frame_rate;
  184. outlink->time_base = av_inv_q(outlink->frame_rate);
  185. for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
  186. int i;
  187. for (i = 0; i < s->w; i++) {
  188. float max = i / (float)(s->w - 1);
  189. s->values[ch * VAR_VARS_NB + VAR_PEAK] = max;
  190. s->values[ch * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max);
  191. s->values[ch * VAR_VARS_NB + VAR_CHANNEL] = ch;
  192. s->color_lut[ch * s->w + i] = av_expr_eval(s->c_expr, &s->values[ch * VAR_VARS_NB], NULL);
  193. }
  194. }
  195. return 0;
  196. }
  197. static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
  198. {
  199. const uint8_t *font;
  200. int font_height;
  201. int i;
  202. font = avpriv_cga_font, font_height = 8;
  203. for (i = 0; txt[i]; i++) {
  204. int char_y, mask;
  205. if (o) { /* vertical orientation */
  206. for (char_y = font_height - 1; char_y >= 0; char_y--) {
  207. uint8_t *p = pic->data[0] + (y + i * 10) * pic->linesize[0] + x * 4;
  208. for (mask = 0x80; mask; mask >>= 1) {
  209. if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
  210. AV_WN32(&p[char_y * 4], ~AV_RN32(&p[char_y * 4]));
  211. p += pic->linesize[0];
  212. }
  213. }
  214. } else { /* horizontal orientation */
  215. uint8_t *p = pic->data[0] + y * pic->linesize[0] + (x + i * 8) * 4;
  216. for (char_y = 0; char_y < font_height; char_y++) {
  217. for (mask = 0x80; mask; mask >>= 1) {
  218. if (font[txt[i] * font_height + char_y] & mask)
  219. AV_WN32(p, ~AV_RN32(p));
  220. p += 4;
  221. }
  222. p += pic->linesize[0] - 8 * 4;
  223. }
  224. }
  225. }
  226. }
  227. static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink)
  228. {
  229. int i, j;
  230. const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24;
  231. for (i = 0; i < outlink->h; i++) {
  232. uint32_t *dst = (uint32_t *)(s->out->data[0] + i * s->out->linesize[0]);
  233. for (j = 0; j < outlink->w; j++)
  234. AV_WN32A(dst + j, bg);
  235. }
  236. }
  237. static inline int calc_max_draw(ShowVolumeContext *s, AVFilterLink *outlink, float max)
  238. {
  239. float max_val;
  240. if (s->display_scale == LINEAR) {
  241. max_val = max;
  242. } else { /* log */
  243. max_val = av_clipf(0.21 * log10(max) + 1, 0, 1);
  244. }
  245. if (s->orientation) { /* vertical */
  246. return outlink->h - outlink->h * max_val;
  247. } else { /* horizontal */
  248. return s->w * max_val;
  249. }
  250. }
  251. static inline void calc_persistent_max(ShowVolumeContext *s, float max, int channel)
  252. {
  253. /* update max value for persistent max display */
  254. if ((max >= s->max_persistent[channel]) || (s->nb_frames_max_display[channel] >= s->persistent_max_frames)) { /* update max value for display */
  255. s->max_persistent[channel] = max;
  256. s->nb_frames_max_display[channel] = 0;
  257. } else {
  258. s->nb_frames_max_display[channel] += 1; /* incremente display frame count */
  259. }
  260. }
  261. static inline void draw_max_line(ShowVolumeContext *s, int max_draw, int channel)
  262. {
  263. int k;
  264. if (s->orientation) { /* vertical */
  265. uint8_t *dst = s->out->data[0] + max_draw * s->out->linesize[0] + channel * (s->b + s->h) * 4;
  266. for (k = 0; k < s->h; k++) {
  267. memcpy(dst + k * 4, s->persistant_max_rgba, sizeof(s->persistant_max_rgba));
  268. }
  269. } else { /* horizontal */
  270. for (k = 0; k < s->h; k++) {
  271. uint8_t *dst = s->out->data[0] + (channel * s->h + channel * s->b + k) * s->out->linesize[0];
  272. memcpy(dst + max_draw * 4, s->persistant_max_rgba, sizeof(s->persistant_max_rgba));
  273. }
  274. }
  275. }
  276. static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
  277. {
  278. AVFilterContext *ctx = inlink->dst;
  279. AVFilterLink *outlink = ctx->outputs[0];
  280. ShowVolumeContext *s = ctx->priv;
  281. const int step = s->step;
  282. int c, j, k, max_draw, ret;
  283. char channel_name[64];
  284. AVFrame *out;
  285. if (!s->out || s->out->width != outlink->w ||
  286. s->out->height != outlink->h) {
  287. av_frame_free(&s->out);
  288. s->out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
  289. if (!s->out) {
  290. av_frame_free(&insamples);
  291. return AVERROR(ENOMEM);
  292. }
  293. clear_picture(s, outlink);
  294. }
  295. s->out->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
  296. s->out->duration = 1;
  297. if ((s->f < 1.) && (s->f > 0.)) {
  298. for (j = 0; j < outlink->h; j++) {
  299. uint8_t *dst = s->out->data[0] + j * s->out->linesize[0];
  300. const uint32_t alpha = s->bgopacity * 255;
  301. for (k = 0; k < outlink->w; k++) {
  302. dst[k * 4 + 0] = FFMAX(dst[k * 4 + 0] * s->f, 0);
  303. dst[k * 4 + 1] = FFMAX(dst[k * 4 + 1] * s->f, 0);
  304. dst[k * 4 + 2] = FFMAX(dst[k * 4 + 2] * s->f, 0);
  305. dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha);
  306. }
  307. }
  308. } else if (s->f == 0.) {
  309. clear_picture(s, outlink);
  310. }
  311. if (s->orientation) { /* vertical */
  312. for (c = 0; c < inlink->ch_layout.nb_channels; c++) {
  313. float *src = (float *)insamples->extended_data[c];
  314. uint32_t *lut = s->color_lut + s->w * c;
  315. float max;
  316. s->meter(src, insamples->nb_samples, &s->max[c]);
  317. max = s->max[c];
  318. s->values[c * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max);
  319. max = av_clipf(max, 0, 1);
  320. max_draw = calc_max_draw(s, outlink, max);
  321. for (j = max_draw; j < s->w; j++) {
  322. uint8_t *dst = s->out->data[0] + j * s->out->linesize[0] + c * (s->b + s->h) * 4;
  323. for (k = 0; k < s->h; k++) {
  324. AV_WN32A(&dst[k * 4], lut[s->w - j - 1]);
  325. if (j & step)
  326. j += step;
  327. }
  328. }
  329. if (s->h >= 8 && s->draw_text) {
  330. int ret = av_channel_name(channel_name, sizeof(channel_name), av_channel_layout_channel_from_index(&insamples->ch_layout, c));
  331. if (ret < 0)
  332. continue;
  333. drawtext(s->out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, channel_name, 1);
  334. }
  335. if (s->draw_persistent_duration > 0.) {
  336. calc_persistent_max(s, max, c);
  337. max_draw = FFMAX(0, calc_max_draw(s, outlink, s->max_persistent[c]) - 1);
  338. draw_max_line(s, max_draw, c);
  339. }
  340. }
  341. } else { /* horizontal */
  342. for (c = 0; c < inlink->ch_layout.nb_channels; c++) {
  343. float *src = (float *)insamples->extended_data[c];
  344. uint32_t *lut = s->color_lut + s->w * c;
  345. float max;
  346. s->meter(src, insamples->nb_samples, &s->max[c]);
  347. max = s->max[c];
  348. s->values[c * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max);
  349. max = av_clipf(max, 0, 1);
  350. max_draw = calc_max_draw(s, outlink, max);
  351. for (j = 0; j < s->h; j++) {
  352. uint8_t *dst = s->out->data[0] + (c * s->h + c * s->b + j) * s->out->linesize[0];
  353. for (k = 0; k < max_draw; k++) {
  354. AV_WN32A(dst + k * 4, lut[k]);
  355. if (k & step)
  356. k += step;
  357. }
  358. }
  359. if (s->h >= 8 && s->draw_text) {
  360. int ret = av_channel_name(channel_name, sizeof(channel_name), av_channel_layout_channel_from_index(&insamples->ch_layout, c));
  361. if (ret < 0)
  362. continue;
  363. drawtext(s->out, 2, c * (s->h + s->b) + (s->h - 8) / 2, channel_name, 0);
  364. }
  365. if (s->draw_persistent_duration > 0.) {
  366. calc_persistent_max(s, max, c);
  367. max_draw = FFMAX(0, calc_max_draw(s, outlink, s->max_persistent[c]) - 1);
  368. draw_max_line(s, max_draw, c);
  369. }
  370. }
  371. }
  372. av_frame_free(&insamples);
  373. out = av_frame_clone(s->out);
  374. if (!out)
  375. return AVERROR(ENOMEM);
  376. ret = ff_inlink_make_frame_writable(outlink, &out);
  377. if (ret < 0) {
  378. av_frame_free(&out);
  379. return ret;
  380. }
  381. /* draw volume level */
  382. for (c = 0; c < inlink->ch_layout.nb_channels && s->h >= 8 && s->draw_volume; c++) {
  383. char buf[16];
  384. if (s->orientation) { /* vertical */
  385. snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
  386. drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1);
  387. } else { /* horizontal */
  388. snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
  389. drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0);
  390. }
  391. }
  392. return ff_filter_frame(outlink, out);
  393. }
  394. static int activate(AVFilterContext *ctx)
  395. {
  396. AVFilterLink *inlink = ctx->inputs[0];
  397. AVFilterLink *outlink = ctx->outputs[0];
  398. ShowVolumeContext *s = ctx->priv;
  399. AVFrame *in = NULL;
  400. int ret;
  401. FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
  402. ret = ff_inlink_consume_samples(inlink, s->nb_samples, s->nb_samples, &in);
  403. if (ret < 0)
  404. return ret;
  405. if (ret > 0)
  406. return filter_frame(inlink, in);
  407. if (ff_inlink_queued_samples(inlink) >= s->nb_samples) {
  408. ff_filter_set_ready(ctx, 10);
  409. return 0;
  410. }
  411. FF_FILTER_FORWARD_STATUS(inlink, outlink);
  412. FF_FILTER_FORWARD_WANTED(outlink, inlink);
  413. return FFERROR_NOT_READY;
  414. }
  415. static av_cold void uninit(AVFilterContext *ctx)
  416. {
  417. ShowVolumeContext *s = ctx->priv;
  418. av_frame_free(&s->out);
  419. av_expr_free(s->c_expr);
  420. av_freep(&s->values);
  421. av_freep(&s->color_lut);
  422. av_freep(&s->max);
  423. av_freep(&s->max_persistent);
  424. av_freep(&s->nb_frames_max_display);
  425. }
  426. static const AVFilterPad showvolume_inputs[] = {
  427. {
  428. .name = "default",
  429. .type = AVMEDIA_TYPE_AUDIO,
  430. .config_props = config_input,
  431. },
  432. };
  433. static const AVFilterPad showvolume_outputs[] = {
  434. {
  435. .name = "default",
  436. .type = AVMEDIA_TYPE_VIDEO,
  437. .config_props = config_output,
  438. },
  439. };
  440. const AVFilter ff_avf_showvolume = {
  441. .name = "showvolume",
  442. .description = NULL_IF_CONFIG_SMALL("Convert input audio volume to video output."),
  443. .init = init,
  444. .activate = activate,
  445. .uninit = uninit,
  446. .priv_size = sizeof(ShowVolumeContext),
  447. FILTER_INPUTS(showvolume_inputs),
  448. FILTER_OUTPUTS(showvolume_outputs),
  449. FILTER_QUERY_FUNC(query_formats),
  450. .priv_class = &showvolume_class,
  451. };