FFmpeg
Loading...
Searching...
No Matches
avf_showvolume.c
Go to the documentation of this file.
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
22#include "libavutil/eval.h"
24#include "libavutil/mem.h"
25#include "libavutil/opt.h"
27#include "avfilter.h"
28#include "filters.h"
29#include "formats.h"
30#include "video.h"
31
32static const char *const var_names[] = { "VOLUME", "CHANNEL", "PEAK", NULL };
35
36typedef struct ShowVolumeContext {
37 const AVClass *class;
38 int w, h;
39 int b;
40 double f;
42 char *color;
44 int step;
45 float bgopacity;
46 int mode;
47
53 double *values;
54 uint32_t *color_lut;
55 float *max;
57
58 double draw_persistent_duration; /* in second */
60 int persistent_max_frames; /* number of frames to check max value */
61 float *max_persistent; /* max value for draw_persistent_max for each channel */
62 int *nb_frames_max_display; /* number of frame for each channel, for displaying the max value */
63
64 void (*meter)(float *src, int nb_samples, float *max);
66
67#define OFFSET(x) offsetof(ShowVolumeContext, x)
68#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
69
70static const AVOption showvolume_options[] = {
71 { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
72 { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
73 { "b", "set border width", OFFSET(b), AV_OPT_TYPE_INT, {.i64=1}, 0, 5, FLAGS },
74 { "w", "set channel width", OFFSET(w), AV_OPT_TYPE_INT, {.i64=400}, 80, 8192, FLAGS },
75 { "h", "set channel height", OFFSET(h), AV_OPT_TYPE_INT, {.i64=20}, 1, 900, FLAGS },
76 { "f", "set fade", OFFSET(f), AV_OPT_TYPE_DOUBLE, {.dbl=0.95}, 0, 1, FLAGS },
77 { "c", "set volume color expression", OFFSET(color), AV_OPT_TYPE_STRING, {.str="PEAK*255+floor((1-PEAK)*255)*256+0xff000000"}, 0, 0, FLAGS },
78 { "t", "display channel names", OFFSET(draw_text), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
79 { "v", "display volume value", OFFSET(draw_volume), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
80 { "dm", "duration for max value display", OFFSET(draw_persistent_duration), AV_OPT_TYPE_DOUBLE, {.dbl=0.}, 0, 9000, FLAGS},
81 { "dmc","set color of the max value line", OFFSET(persistant_max_rgba), AV_OPT_TYPE_COLOR, {.str = "orange"}, 0, 0, FLAGS },
82 { "o", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "orientation" },
83 { "h", "horizontal", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "orientation" },
84 { "v", "vertical", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "orientation" },
85 { "s", "set step size", OFFSET(step), AV_OPT_TYPE_INT, {.i64=0}, 0, 5, FLAGS },
86 { "p", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, FLAGS },
87 { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "mode" },
88 { "p", "peak", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "mode" },
89 { "r", "rms", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "mode" },
90 { "ds", "set display scale", OFFSET(display_scale), AV_OPT_TYPE_INT, {.i64=LINEAR}, LINEAR, NB_DISPLAY_SCALE - 1, FLAGS, .unit = "display_scale" },
91 { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, FLAGS, .unit = "display_scale" },
92 { "log", "log", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, FLAGS, .unit = "display_scale" },
93 { NULL }
94};
95
97
99{
100 ShowVolumeContext *s = ctx->priv;
101 int ret;
102
103 if (s->color) {
104 ret = av_expr_parse(&s->c_expr, s->color, var_names,
105 NULL, NULL, NULL, NULL, 0, ctx);
106 if (ret < 0)
107 return ret;
108 }
109
110 return 0;
111}
112
114 AVFilterFormatsConfig **cfg_in,
115 AVFilterFormatsConfig **cfg_out)
116{
119 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE };
120 int ret;
121
123 if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
124 return ret;
125
127 if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
128 return ret;
129
130 return 0;
131}
132
133static void find_peak(float *src, int nb_samples, float *peak)
134{
135 float max = 0.f;
136
137 max = 0;
138 for (int i = 0; i < nb_samples; i++)
139 max = fmaxf(max, fabsf(src[i]));
140 *peak = max;
141}
142
143static void find_rms(float *src, int nb_samples, float *rms)
144{
145 float sum = 0.f;
146
147 for (int i = 0; i < nb_samples; i++)
148 sum += src[i] * src[i];
149 *rms = sqrtf(sum / nb_samples);
150}
151
152static int config_input(AVFilterLink *inlink)
153{
154 AVFilterContext *ctx = inlink->dst;
155 ShowVolumeContext *s = ctx->priv;
156
157 s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
158 s->values = av_calloc(inlink->ch_layout.nb_channels * VAR_VARS_NB, sizeof(double));
159 if (!s->values)
160 return AVERROR(ENOMEM);
161
162 s->color_lut = av_calloc(s->w, sizeof(*s->color_lut) * inlink->ch_layout.nb_channels);
163 if (!s->color_lut)
164 return AVERROR(ENOMEM);
165
166 s->max = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->max));
167 if (!s->max)
168 return AVERROR(ENOMEM);
169
170 switch (s->mode) {
171 case 0: s->meter = find_peak; break;
172 case 1: s->meter = find_rms; break;
173 default: return AVERROR_BUG;
174 }
175
176 if (s->draw_persistent_duration > 0.) {
177 s->persistent_max_frames = (int) FFMAX(av_q2d(s->frame_rate) * s->draw_persistent_duration, 1.);
178 s->max_persistent = av_calloc(inlink->ch_layout.nb_channels * s->persistent_max_frames, sizeof(*s->max_persistent));
179 s->nb_frames_max_display = av_calloc(inlink->ch_layout.nb_channels * s->persistent_max_frames, sizeof(*s->nb_frames_max_display));
180 if (!s->max_persistent ||
181 !s->nb_frames_max_display)
182 return AVERROR(ENOMEM);
183 }
184 return 0;
185}
186
187static int config_output(AVFilterLink *outlink)
188{
189 FilterLink *l = ff_filter_link(outlink);
190 ShowVolumeContext *s = outlink->src->priv;
191 AVFilterLink *inlink = outlink->src->inputs[0];
192 int ch;
193
194 if (s->orientation) {
195 outlink->h = s->w;
196 outlink->w = s->h * inlink->ch_layout.nb_channels + (inlink->ch_layout.nb_channels - 1) * s->b;
197 } else {
198 outlink->w = s->w;
199 outlink->h = s->h * inlink->ch_layout.nb_channels + (inlink->ch_layout.nb_channels - 1) * s->b;
200 }
201
202 outlink->sample_aspect_ratio = (AVRational){1,1};
203 l->frame_rate = s->frame_rate;
204 outlink->time_base = av_inv_q(l->frame_rate);
205
206 for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
207 int i;
208
209 for (i = 0; i < s->w; i++) {
210 float max = i / (float)(s->w - 1);
211
212 s->values[ch * VAR_VARS_NB + VAR_PEAK] = max;
213 s->values[ch * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max);
214 s->values[ch * VAR_VARS_NB + VAR_CHANNEL] = ch;
215 s->color_lut[ch * s->w + i] = av_expr_eval(s->c_expr, &s->values[ch * VAR_VARS_NB], NULL);
216 }
217 }
218
219 return 0;
220}
221
222static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
223{
224 const uint8_t *font;
225 int font_height;
226 int i;
227
228 font = avpriv_cga_font_get(), font_height = 8;
229
230 for (i = 0; txt[i]; i++) {
231 int char_y, mask;
232
233 if (o) { /* vertical orientation */
234 for (char_y = font_height - 1; char_y >= 0; char_y--) {
235 uint8_t *p = pic->data[0] + (y + i * 10) * pic->linesize[0] + x * 4;
236 for (mask = 0x80; mask; mask >>= 1) {
237 if (font[txt[i] * font_height + font_height - 1 - char_y] & mask)
238 AV_WN32(&p[char_y * 4], ~AV_RN32(&p[char_y * 4]));
239 p += pic->linesize[0];
240 }
241 }
242 } else { /* horizontal orientation */
243 uint8_t *p = pic->data[0] + y * pic->linesize[0] + (x + i * 8) * 4;
244 for (char_y = 0; char_y < font_height; char_y++) {
245 for (mask = 0x80; mask; mask >>= 1) {
246 if (font[txt[i] * font_height + char_y] & mask)
247 AV_WN32(p, ~AV_RN32(p));
248 p += 4;
249 }
250 p += pic->linesize[0] - 8 * 4;
251 }
252 }
253 }
254}
255
257{
258 int i, j;
259 const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24;
260
261 for (i = 0; i < outlink->h; i++) {
262 uint32_t *dst = (uint32_t *)(s->out->data[0] + i * s->out->linesize[0]);
263 for (j = 0; j < outlink->w; j++)
264 AV_WN32A(dst + j, bg);
265 }
266}
267
268static inline int calc_max_draw(ShowVolumeContext *s, AVFilterLink *outlink, float max)
269{
270 float max_val;
271 if (s->display_scale == LINEAR) {
272 max_val = max;
273 } else { /* log */
274 max_val = av_clipf(0.21 * log10(max) + 1, 0, 1);
275 }
276 if (s->orientation) { /* vertical */
277 return outlink->h - outlink->h * max_val;
278 } else { /* horizontal */
279 return s->w * max_val;
280 }
281}
282
283static inline void calc_persistent_max(ShowVolumeContext *s, float max, int channel)
284{
285 /* update max value for persistent max display */
286 if ((max >= s->max_persistent[channel]) || (s->nb_frames_max_display[channel] >= s->persistent_max_frames)) { /* update max value for display */
287 s->max_persistent[channel] = max;
288 s->nb_frames_max_display[channel] = 0;
289 } else {
290 s->nb_frames_max_display[channel] += 1; /* incremente display frame count */
291 }
292}
293
294static inline void draw_max_line(ShowVolumeContext *s, int max_draw, int channel)
295{
296 int k;
297 if (s->orientation) { /* vertical */
298 uint8_t *dst = s->out->data[0] + max_draw * s->out->linesize[0] + channel * (s->b + s->h) * 4;
299 for (k = 0; k < s->h; k++) {
300 memcpy(dst + k * 4, s->persistant_max_rgba, sizeof(s->persistant_max_rgba));
301 }
302 } else { /* horizontal */
303 for (k = 0; k < s->h; k++) {
304 uint8_t *dst = s->out->data[0] + (channel * s->h + channel * s->b + k) * s->out->linesize[0];
305 memcpy(dst + max_draw * 4, s->persistant_max_rgba, sizeof(s->persistant_max_rgba));
306 }
307 }
308}
309
310static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
311{
312 AVFilterContext *ctx = inlink->dst;
313 AVFilterLink *outlink = ctx->outputs[0];
314 ShowVolumeContext *s = ctx->priv;
315 const int step = s->step;
316 int c, j, k, max_draw, ret;
317 char channel_name[64];
318 AVFrame *out;
319
320 if (!s->out || s->out->width != outlink->w ||
321 s->out->height != outlink->h) {
322 av_frame_free(&s->out);
323 s->out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
324 if (!s->out) {
325 av_frame_free(&insamples);
326 return AVERROR(ENOMEM);
327 }
328 clear_picture(s, outlink);
329 }
330 s->out->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
331 s->out->duration = 1;
332
333 if ((s->f < 1.) && (s->f > 0.)) {
334 for (j = 0; j < outlink->h; j++) {
335 uint8_t *dst = s->out->data[0] + j * s->out->linesize[0];
336 const uint32_t alpha = s->bgopacity * 255;
337
338 for (k = 0; k < outlink->w; k++) {
339 dst[k * 4 + 0] = FFMAX(dst[k * 4 + 0] * s->f, 0);
340 dst[k * 4 + 1] = FFMAX(dst[k * 4 + 1] * s->f, 0);
341 dst[k * 4 + 2] = FFMAX(dst[k * 4 + 2] * s->f, 0);
342 dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha);
343 }
344 }
345 } else if (s->f == 0.) {
346 clear_picture(s, outlink);
347 }
348
349 if (s->orientation) { /* vertical */
350 for (c = 0; c < inlink->ch_layout.nb_channels; c++) {
351 float *src = (float *)insamples->extended_data[c];
352 uint32_t *lut = s->color_lut + s->w * c;
353 float max;
354
355 s->meter(src, insamples->nb_samples, &s->max[c]);
356 max = s->max[c];
357
358 s->values[c * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max);
359 max = av_clipf(max, 0, 1);
360 max_draw = calc_max_draw(s, outlink, max);
361
362 for (j = s->w - 1; j >= max_draw; j--) {
363 uint8_t *dst = s->out->data[0] + j * s->out->linesize[0] + c * (s->b + s->h) * 4;
364 for (k = 0; k < s->h; k++) {
365 AV_WN32A(&dst[k * 4], lut[s->w - j - 1]);
366 }
367 if (j & step)
368 j -= step;
369 }
370
371 if (s->draw_persistent_duration > 0.) {
373 max_draw = FFMAX(0, calc_max_draw(s, outlink, s->max_persistent[c]) - 1);
374 draw_max_line(s, max_draw, c);
375 }
376 }
377 } else { /* horizontal */
378 for (c = 0; c < inlink->ch_layout.nb_channels; c++) {
379 float *src = (float *)insamples->extended_data[c];
380 uint32_t *lut = s->color_lut + s->w * c;
381 float max;
382
383 s->meter(src, insamples->nb_samples, &s->max[c]);
384 max = s->max[c];
385
386 s->values[c * VAR_VARS_NB + VAR_VOLUME] = 20.0 * log10(max);
387 max = av_clipf(max, 0, 1);
388 max_draw = calc_max_draw(s, outlink, max);
389
390 for (j = 0; j < s->h; j++) {
391 uint8_t *dst = s->out->data[0] + (c * s->h + c * s->b + j) * s->out->linesize[0];
392
393 for (k = 0; k < max_draw; k++) {
394 AV_WN32A(dst + k * 4, lut[k]);
395 if (k & step)
396 k += step;
397 }
398 }
399
400 if (s->draw_persistent_duration > 0.) {
402 max_draw = FFMAX(0, calc_max_draw(s, outlink, s->max_persistent[c]) - 1);
403 draw_max_line(s, max_draw, c);
404 }
405 }
406 }
407
408 av_frame_free(&insamples);
409 out = av_frame_clone(s->out);
410 if (!out)
411 return AVERROR(ENOMEM);
412 ret = ff_inlink_make_frame_writable(outlink, &out);
413 if (ret < 0) {
415 return ret;
416 }
417
418 /* draw channel names */
419 for (c = 0; c < inlink->ch_layout.nb_channels && s->h >= 10 && s->draw_text; c++) {
420 if (s->orientation) { /* vertical */
422 if (ret < 0)
423 continue;
424 drawtext(out, c * (s->h + s->b) + (s->h - 10) / 2, outlink->h - 35, channel_name, 1);
425 } else { /* horizontal */
427 if (ret < 0)
428 continue;
429 drawtext(out, 2, c * (s->h + s->b) + (s->h - 8) / 2, channel_name, 0);
430 }
431 }
432
433 /* draw volume level */
434 for (c = 0; c < inlink->ch_layout.nb_channels && s->h >= 8 && s->draw_volume; c++) {
435 char buf[16];
436
437 if (s->orientation) { /* vertical */
438 snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
439 drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1);
440 } else { /* horizontal */
441 snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]);
442 drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0);
443 }
444 }
445
446 return ff_filter_frame(outlink, out);
447}
448
450{
451 AVFilterLink *inlink = ctx->inputs[0];
452 AVFilterLink *outlink = ctx->outputs[0];
453 ShowVolumeContext *s = ctx->priv;
454 AVFrame *in = NULL;
455 int ret;
456
457 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
458
459 ret = ff_inlink_consume_samples(inlink, s->nb_samples, s->nb_samples, &in);
460 if (ret < 0)
461 return ret;
462 if (ret > 0)
463 return filter_frame(inlink, in);
464
465 if (ff_inlink_queued_samples(inlink) >= s->nb_samples) {
467 return 0;
468 }
469
470 FF_FILTER_FORWARD_STATUS(inlink, outlink);
471 FF_FILTER_FORWARD_WANTED(outlink, inlink);
472
473 return FFERROR_NOT_READY;
474}
475
477{
478 ShowVolumeContext *s = ctx->priv;
479
480 av_frame_free(&s->out);
481 av_expr_free(s->c_expr);
482 av_freep(&s->values);
483 av_freep(&s->color_lut);
484 av_freep(&s->max);
485 av_freep(&s->max_persistent);
486 av_freep(&s->nb_frames_max_display);
487}
488
490 {
491 .name = "default",
492 .type = AVMEDIA_TYPE_AUDIO,
493 .config_props = config_input,
494 },
495};
496
498 {
499 .name = "default",
500 .type = AVMEDIA_TYPE_VIDEO,
501 .config_props = config_output,
502 },
503};
504
506 .p.name = "showvolume",
507 .p.description = NULL_IF_CONFIG_SMALL("Convert input audio volume to video output."),
508 .p.priv_class = &showvolume_class,
509 .init = init,
510 .activate = activate,
511 .uninit = uninit,
512 .priv_size = sizeof(ShowVolumeContext),
516};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static enum AVSampleFormat sample_fmts[]
Definition adpcmenc.c:933
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static int config_input(AVFilterLink *inlink)
@ VAR_CHANNEL
Definition af_afftfilt.c:57
@ VAR_VOLUME
Definition af_volume.h:56
const FFFilter ff_avf_showvolume
DisplayScale
static const AVFilterPad showvolume_outputs[]
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
static void draw_max_line(ShowVolumeContext *s, int max_draw, int channel)
static void find_rms(float *src, int nb_samples, float *rms)
@ NB_DISPLAY_SCALE
static const AVFilterPad showvolume_inputs[]
static int calc_max_draw(ShowVolumeContext *s, AVFilterLink *outlink, float max)
static const AVOption showvolume_options[]
static int config_input(AVFilterLink *inlink)
static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink)
static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static void calc_persistent_max(ShowVolumeContext *s, float max, int channel)
#define OFFSET(x)
static int config_output(AVFilterLink *outlink)
static void find_peak(float *src, int nb_samples, float *peak)
@ VAR_PEAK
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition avfilter.c:1540
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition avfilter.c:229
int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
Make sure a frame is writable.
Definition avfilter.c:1567
int ff_inlink_queued_samples(AVFilterLink *link)
Definition avfilter.c:1495
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define FLAGS
Definition cmdutils.c:598
#define av_clipf
Definition common.h:145
#define NULL
Definition coverity.c:32
static __device__ float sqrtf(float a)
static __device__ float fabsf(float a)
#define max(a, b)
static int32_t find_peak(DCAEncContext *c, const int32_t *in, int len)
Definition dcaenc.c:624
float fmaxf(float, float)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
channel
Use these values when setting the channel map with ebur128_set_channel().
Definition ebur128.h:39
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition eval.c:368
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition eval.c:824
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition eval.c:735
simple arithmetic expression evaluator
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add ref as a new reference to formats.
Definition formats.c:756
av_warn_unused_result AVFilterFormats * ff_make_sample_format_list(const enum AVSampleFormat *fmts)
Create a list of supported sample formats.
av_warn_unused_result AVFilterFormats * ff_make_pixel_format_list(const enum AVPixelFormat *fmts)
Create a list of supported pixel formats.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
Definition opt.h:314
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
Definition opt.h:322
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string in an abbreviated form describing a given channel.
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition rational.h:159
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
@ AV_SAMPLE_FMT_NONE
Definition samplefmt.h:56
static const int16_t alpha[]
Definition ilbcdata.h:55
#define b
Definition input.c:43
#define AV_WN32(p, v)
#define AV_RN32(p)
#define AV_WN32A(p, v)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
Definition filters.h:694
#define FF_FILTER_FORWARD_STATUS(inlink, outlink)
Acknowledge the status on an input link and forward it to an output link.
Definition filters.h:666
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition filters.h:639
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
uint8_t w
Definition llvidencdsp.c:39
static const uint16_t mask[17]
Definition lzw.c:38
#define FFMAX(a, b)
Definition macros.h:47
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:264
Memory handling functions.
@ VAR_VARS_NB
Definition noise.c:59
static const char *const var_names[]
Definition noise.c:30
AVOptions.
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
formats
Definition signature.h:47
#define snprintf
Definition snprintf.h:34
static void draw_text(FFDrawContext *draw, AVFrame *out, FFDrawColor *color, int x0, int y0, const uint8_t *text)
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
Definition log.h:76
Definition eval.c:171
An instance of a filter.
Definition avfilter.h:273
AVFilterLink ** inputs
array of pointers to input links
Definition avfilter.h:281
void * priv
private data for use by the filter
Definition avfilter.h:288
Lists of formats / etc.
Definition avfilter.h:120
A list of supported formats for one end of a filter link.
Definition formats.h:64
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int nb_samples
number of audio samples (per channel) described by this frame
Definition frame.h:552
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition frame.h:517
uint8_t ** extended_data
pointers to the data planes/channels.
Definition frame.h:533
AVOption.
Definition opt.h:428
Rational number (pair of numerator and denominator).
Definition rational.h:58
double draw_persistent_duration
void(* meter)(float *src, int nb_samples, float *max)
uint8_t persistant_max_rgba[4]
AVRational frame_rate
Definition swscale.c:71
#define av_freep(p)
#define LOG(...)
Definition internal.h:126
#define src
Definition vp8dsp.c:248
static FILE * out
Definition movenc.c:55
static AVFormatContext * ctx
Definition movenc.c:49
#define LINEAR
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89
static double c[64]
const uint8_t * avpriv_cga_font_get(void)
CGA/EGA/VGA ROM font data.