]> git.sesse.net Git - ffmpeg/blob - libavfilter/avfilter.c
lavfi: make avfilter_free() remove the filter from its graph.
[ffmpeg] / libavfilter / avfilter.c
1 /*
2  * filter layer
3  * Copyright (c) 2007 Bobby Bingham
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 /* #define DEBUG */
23
24 #include "libavutil/avstring.h"
25 #include "libavutil/channel_layout.h"
26 #include "libavutil/common.h"
27 #include "libavutil/imgutils.h"
28 #include "libavutil/opt.h"
29 #include "libavutil/pixdesc.h"
30 #include "libavutil/rational.h"
31 #include "libavutil/samplefmt.h"
32
33 #include "audio.h"
34 #include "avfilter.h"
35 #include "formats.h"
36 #include "internal.h"
37 #include "video.h"
38
39 unsigned avfilter_version(void) {
40     return LIBAVFILTER_VERSION_INT;
41 }
42
43 const char *avfilter_configuration(void)
44 {
45     return LIBAV_CONFIGURATION;
46 }
47
48 const char *avfilter_license(void)
49 {
50 #define LICENSE_PREFIX "libavfilter license: "
51     return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
52 }
53
54 void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
55                    AVFilterPad **pads, AVFilterLink ***links,
56                    AVFilterPad *newpad)
57 {
58     unsigned i;
59
60     idx = FFMIN(idx, *count);
61
62     *pads  = av_realloc(*pads,  sizeof(AVFilterPad)   * (*count + 1));
63     *links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));
64     memmove(*pads +idx+1, *pads +idx, sizeof(AVFilterPad)   * (*count-idx));
65     memmove(*links+idx+1, *links+idx, sizeof(AVFilterLink*) * (*count-idx));
66     memcpy(*pads+idx, newpad, sizeof(AVFilterPad));
67     (*links)[idx] = NULL;
68
69     (*count)++;
70     for (i = idx+1; i < *count; i++)
71         if (*links[i])
72             (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;
73 }
74
75 int avfilter_link(AVFilterContext *src, unsigned srcpad,
76                   AVFilterContext *dst, unsigned dstpad)
77 {
78     AVFilterLink *link;
79
80     if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad ||
81         src->outputs[srcpad]      || dst->inputs[dstpad])
82         return -1;
83
84     if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
85         av_log(src, AV_LOG_ERROR,
86                "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n",
87                src->name, srcpad, dst->name, dstpad);
88         return AVERROR(EINVAL);
89     }
90
91     src->outputs[srcpad] =
92     dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink));
93
94     link->src     = src;
95     link->dst     = dst;
96     link->srcpad  = &src->output_pads[srcpad];
97     link->dstpad  = &dst->input_pads[dstpad];
98     link->type    = src->output_pads[srcpad].type;
99     assert(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
100     link->format  = -1;
101
102     return 0;
103 }
104
105 int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
106                            unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
107 {
108     int ret;
109     unsigned dstpad_idx = link->dstpad - link->dst->input_pads;
110
111     av_log(link->dst, AV_LOG_VERBOSE, "auto-inserting filter '%s' "
112            "between the filter '%s' and the filter '%s'\n",
113            filt->name, link->src->name, link->dst->name);
114
115     link->dst->inputs[dstpad_idx] = NULL;
116     if ((ret = avfilter_link(filt, filt_dstpad_idx, link->dst, dstpad_idx)) < 0) {
117         /* failed to link output filter to new filter */
118         link->dst->inputs[dstpad_idx] = link;
119         return ret;
120     }
121
122     /* re-hookup the link to the new destination filter we inserted */
123     link->dst = filt;
124     link->dstpad = &filt->input_pads[filt_srcpad_idx];
125     filt->inputs[filt_srcpad_idx] = link;
126
127     /* if any information on supported media formats already exists on the
128      * link, we need to preserve that */
129     if (link->out_formats)
130         ff_formats_changeref(&link->out_formats,
131                                    &filt->outputs[filt_dstpad_idx]->out_formats);
132     if (link->out_samplerates)
133         ff_formats_changeref(&link->out_samplerates,
134                                    &filt->outputs[filt_dstpad_idx]->out_samplerates);
135     if (link->out_channel_layouts)
136         ff_channel_layouts_changeref(&link->out_channel_layouts,
137                                      &filt->outputs[filt_dstpad_idx]->out_channel_layouts);
138
139     return 0;
140 }
141
142 int avfilter_config_links(AVFilterContext *filter)
143 {
144     int (*config_link)(AVFilterLink *);
145     unsigned i;
146     int ret;
147
148     for (i = 0; i < filter->nb_inputs; i ++) {
149         AVFilterLink *link = filter->inputs[i];
150
151         if (!link) continue;
152
153         switch (link->init_state) {
154         case AVLINK_INIT:
155             continue;
156         case AVLINK_STARTINIT:
157             av_log(filter, AV_LOG_INFO, "circular filter chain detected\n");
158             return 0;
159         case AVLINK_UNINIT:
160             link->init_state = AVLINK_STARTINIT;
161
162             if ((ret = avfilter_config_links(link->src)) < 0)
163                 return ret;
164
165             if (!(config_link = link->srcpad->config_props)) {
166                 if (link->src->nb_inputs != 1) {
167                     av_log(link->src, AV_LOG_ERROR, "Source filters and filters "
168                                                     "with more than one input "
169                                                     "must set config_props() "
170                                                     "callbacks on all outputs\n");
171                     return AVERROR(EINVAL);
172                 }
173             } else if ((ret = config_link(link)) < 0) {
174                 av_log(link->src, AV_LOG_ERROR,
175                        "Failed to configure output pad on %s\n",
176                        link->src->name);
177                 return ret;
178             }
179
180             if (link->time_base.num == 0 && link->time_base.den == 0)
181                 link->time_base = link->src && link->src->nb_inputs ?
182                     link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
183
184             if (link->type == AVMEDIA_TYPE_VIDEO) {
185                 if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
186                     link->sample_aspect_ratio = link->src->nb_inputs ?
187                         link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
188
189                 if (link->src->nb_inputs) {
190                     if (!link->w)
191                         link->w = link->src->inputs[0]->w;
192                     if (!link->h)
193                         link->h = link->src->inputs[0]->h;
194                 } else if (!link->w || !link->h) {
195                     av_log(link->src, AV_LOG_ERROR,
196                            "Video source filters must set their output link's "
197                            "width and height\n");
198                     return AVERROR(EINVAL);
199                 }
200             }
201
202             if ((config_link = link->dstpad->config_props))
203                 if ((ret = config_link(link)) < 0) {
204                     av_log(link->src, AV_LOG_ERROR,
205                            "Failed to configure input pad on %s\n",
206                            link->dst->name);
207                     return ret;
208                 }
209
210             link->init_state = AVLINK_INIT;
211         }
212     }
213
214     return 0;
215 }
216
217 void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
218 {
219     if (link->type == AVMEDIA_TYPE_VIDEO) {
220         av_dlog(ctx,
221                 "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
222                 link, link->w, link->h,
223                 av_get_pix_fmt_name(link->format),
224                 link->src ? link->src->filter->name : "",
225                 link->dst ? link->dst->filter->name : "",
226                 end ? "\n" : "");
227     } else {
228         char buf[128];
229         av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
230
231         av_dlog(ctx,
232                 "link[%p r:%d cl:%s fmt:%-16s %-16s->%-16s]%s",
233                 link, link->sample_rate, buf,
234                 av_get_sample_fmt_name(link->format),
235                 link->src ? link->src->filter->name : "",
236                 link->dst ? link->dst->filter->name : "",
237                 end ? "\n" : "");
238     }
239 }
240
241 int ff_request_frame(AVFilterLink *link)
242 {
243     FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
244
245     if (link->srcpad->request_frame)
246         return link->srcpad->request_frame(link);
247     else if (link->src->inputs[0])
248         return ff_request_frame(link->src->inputs[0]);
249     else return -1;
250 }
251
252 int ff_poll_frame(AVFilterLink *link)
253 {
254     int i, min = INT_MAX;
255
256     if (link->srcpad->poll_frame)
257         return link->srcpad->poll_frame(link);
258
259     for (i = 0; i < link->src->nb_inputs; i++) {
260         int val;
261         if (!link->src->inputs[i])
262             return -1;
263         val = ff_poll_frame(link->src->inputs[i]);
264         min = FFMIN(min, val);
265     }
266
267     return min;
268 }
269
270 #define MAX_REGISTERED_AVFILTERS_NB 64
271
272 static AVFilter *registered_avfilters[MAX_REGISTERED_AVFILTERS_NB + 1];
273
274 static int next_registered_avfilter_idx = 0;
275
276 AVFilter *avfilter_get_by_name(const char *name)
277 {
278     int i;
279
280     for (i = 0; registered_avfilters[i]; i++)
281         if (!strcmp(registered_avfilters[i]->name, name))
282             return registered_avfilters[i];
283
284     return NULL;
285 }
286
287 int avfilter_register(AVFilter *filter)
288 {
289     if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB)
290         return -1;
291
292     registered_avfilters[next_registered_avfilter_idx++] = filter;
293     return 0;
294 }
295
296 AVFilter **av_filter_next(AVFilter **filter)
297 {
298     return filter ? ++filter : &registered_avfilters[0];
299 }
300
301 void avfilter_uninit(void)
302 {
303     memset(registered_avfilters, 0, sizeof(registered_avfilters));
304     next_registered_avfilter_idx = 0;
305 }
306
307 static int pad_count(const AVFilterPad *pads)
308 {
309     int count;
310
311     if (!pads)
312         return 0;
313
314     for(count = 0; pads->name; count ++) pads ++;
315     return count;
316 }
317
318 static const char *filter_name(void *p)
319 {
320     AVFilterContext *filter = p;
321     return filter->filter->name;
322 }
323
324 static void *filter_child_next(void *obj, void *prev)
325 {
326     AVFilterContext *ctx = obj;
327     if (!prev && ctx->filter && ctx->filter->priv_class && ctx->priv)
328         return ctx->priv;
329     return NULL;
330 }
331
332 static const AVClass *filter_child_class_next(const AVClass *prev)
333 {
334     AVFilter **f = NULL;
335
336     while (prev && *(f = av_filter_next(f)))
337         if ((*f)->priv_class == prev)
338             break;
339
340     while (*(f = av_filter_next(f)))
341         if ((*f)->priv_class)
342             return (*f)->priv_class;
343
344     return NULL;
345 }
346
347 static const AVClass avfilter_class = {
348     .class_name = "AVFilter",
349     .item_name  = filter_name,
350     .version    = LIBAVUTIL_VERSION_INT,
351     .child_next = filter_child_next,
352     .child_class_next = filter_child_class_next,
353 };
354
355 AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
356 {
357     AVFilterContext *ret;
358
359     if (!filter)
360         return NULL;
361
362     ret = av_mallocz(sizeof(AVFilterContext));
363     if (!ret)
364         return NULL;
365
366     ret->av_class = &avfilter_class;
367     ret->filter   = filter;
368     ret->name     = inst_name ? av_strdup(inst_name) : NULL;
369     if (filter->priv_size) {
370         ret->priv     = av_mallocz(filter->priv_size);
371         if (!ret->priv)
372             goto err;
373     }
374
375     if (filter->priv_class) {
376         *(const AVClass**)ret->priv = filter->priv_class;
377         av_opt_set_defaults(ret->priv);
378     }
379
380     ret->nb_inputs = pad_count(filter->inputs);
381     if (ret->nb_inputs ) {
382         ret->input_pads   = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs);
383         if (!ret->input_pads)
384             goto err;
385         memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs);
386         ret->inputs       = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs);
387         if (!ret->inputs)
388             goto err;
389     }
390
391     ret->nb_outputs = pad_count(filter->outputs);
392     if (ret->nb_outputs) {
393         ret->output_pads  = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs);
394         if (!ret->output_pads)
395             goto err;
396         memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs);
397         ret->outputs      = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs);
398         if (!ret->outputs)
399             goto err;
400     }
401 #if FF_API_FOO_COUNT
402     ret->output_count = ret->nb_outputs;
403     ret->input_count  = ret->nb_inputs;
404 #endif
405
406     return ret;
407
408 err:
409     av_freep(&ret->inputs);
410     av_freep(&ret->input_pads);
411     ret->nb_inputs = 0;
412     av_freep(&ret->outputs);
413     av_freep(&ret->output_pads);
414     ret->nb_outputs = 0;
415     av_freep(&ret->priv);
416     av_free(ret);
417     return NULL;
418 }
419
420 #if FF_API_AVFILTER_OPEN
421 int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
422 {
423     *filter_ctx = ff_filter_alloc(filter, inst_name);
424     return *filter_ctx ? 0 : AVERROR(ENOMEM);
425 }
426 #endif
427
428 void avfilter_free(AVFilterContext *filter)
429 {
430     int i;
431     AVFilterLink *link;
432
433     if (filter->graph)
434         ff_filter_graph_remove_filter(filter->graph, filter);
435
436     if (filter->filter->uninit)
437         filter->filter->uninit(filter);
438
439     for (i = 0; i < filter->nb_inputs; i++) {
440         if ((link = filter->inputs[i])) {
441             if (link->src)
442                 link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
443             ff_formats_unref(&link->in_formats);
444             ff_formats_unref(&link->out_formats);
445             ff_formats_unref(&link->in_samplerates);
446             ff_formats_unref(&link->out_samplerates);
447             ff_channel_layouts_unref(&link->in_channel_layouts);
448             ff_channel_layouts_unref(&link->out_channel_layouts);
449         }
450         av_freep(&link);
451     }
452     for (i = 0; i < filter->nb_outputs; i++) {
453         if ((link = filter->outputs[i])) {
454             if (link->dst)
455                 link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
456             ff_formats_unref(&link->in_formats);
457             ff_formats_unref(&link->out_formats);
458             ff_formats_unref(&link->in_samplerates);
459             ff_formats_unref(&link->out_samplerates);
460             ff_channel_layouts_unref(&link->in_channel_layouts);
461             ff_channel_layouts_unref(&link->out_channel_layouts);
462         }
463         av_freep(&link);
464     }
465
466     if (filter->filter->priv_class)
467         av_opt_free(filter->priv);
468
469     av_freep(&filter->name);
470     av_freep(&filter->input_pads);
471     av_freep(&filter->output_pads);
472     av_freep(&filter->inputs);
473     av_freep(&filter->outputs);
474     av_freep(&filter->priv);
475     av_free(filter);
476 }
477
478 /* process a list of value1:value2:..., each value corresponding
479  * to subsequent AVOption, in the order they are declared */
480 static int process_unnamed_options(AVFilterContext *ctx, AVDictionary **options,
481                                    const char *args)
482 {
483     const AVOption *o = NULL;
484     const char *p = args;
485     char *val;
486
487     while (*p) {
488         o = av_opt_next(ctx->priv, o);
489         if (!o) {
490             av_log(ctx, AV_LOG_ERROR, "More options provided than "
491                    "this filter supports.\n");
492             return AVERROR(EINVAL);
493         }
494         if (o->type == AV_OPT_TYPE_CONST)
495             continue;
496
497         val = av_get_token(&p, ":");
498         if (!val)
499             return AVERROR(ENOMEM);
500
501         av_dict_set(options, o->name, val, 0);
502
503         av_freep(&val);
504         if (*p)
505             p++;
506     }
507
508     return 0;
509 }
510
511 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
512 {
513     AVDictionary *options = NULL;
514     AVDictionaryEntry *e;
515     int ret=0;
516
517     if (args && *args) {
518         if (!filter->filter->priv_class) {
519             av_log(filter, AV_LOG_ERROR, "This filter does not take any "
520                    "options, but options were provided: %s.\n", args);
521             return AVERROR(EINVAL);
522         }
523
524 #if FF_API_OLD_FILTER_OPTS
525         if (!strcmp(filter->filter->name, "scale") &&
526             strchr(args, ':') < strchr(args, '=')) {
527             /* old w:h:flags=<flags> syntax */
528             char *copy = av_strdup(args);
529             char *p;
530
531             av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option "
532                    "syntax is deprecated. Use either <w>:<h>:<flags> or "
533                    "w=<w>:h=<h>:flags=<flags>.\n");
534
535             if (!copy) {
536                 ret = AVERROR(ENOMEM);
537                 goto fail;
538             }
539
540             p = strrchr(copy, ':');
541             if (p) {
542                 *p++ = 0;
543                 ret = av_dict_parse_string(&options, p, "=", ":", 0);
544             }
545             if (ret >= 0)
546                 ret = process_unnamed_options(filter, &options, copy);
547             av_freep(&copy);
548
549             if (ret < 0)
550                 goto fail;
551         } else
552 #endif
553
554         if (strchr(args, '=')) {
555             /* assume a list of key1=value1:key2=value2:... */
556             ret = av_dict_parse_string(&options, args, "=", ":", 0);
557             if (ret < 0)
558                 goto fail;
559 #if FF_API_OLD_FILTER_OPTS
560         } else if (!strcmp(filter->filter->name, "format")     ||
561                    !strcmp(filter->filter->name, "noformat")   ||
562                    !strcmp(filter->filter->name, "frei0r")     ||
563                    !strcmp(filter->filter->name, "frei0r_src") ||
564                    !strcmp(filter->filter->name, "ocv")) {
565             /* a hack for compatibility with the old syntax
566              * replace colons with |s */
567             char *copy = av_strdup(args);
568             char *p    = copy;
569             int nb_leading = 0; // number of leading colons to skip
570
571             if (!copy) {
572                 ret = AVERROR(ENOMEM);
573                 goto fail;
574             }
575
576             if (!strcmp(filter->filter->name, "frei0r") ||
577                 !strcmp(filter->filter->name, "ocv"))
578                 nb_leading = 1;
579             else if (!strcmp(filter->filter->name, "frei0r_src"))
580                 nb_leading = 3;
581
582             while (nb_leading--) {
583                 p = strchr(p, ':');
584                 if (!p) {
585                     p = copy + strlen(copy);
586                     break;
587                 }
588                 p++;
589             }
590
591             if (strchr(p, ':')) {
592                 av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
593                        "'|' to separate the list items.\n");
594             }
595
596             while ((p = strchr(p, ':')))
597                 *p++ = '|';
598
599             ret = process_unnamed_options(filter, &options, copy);
600             av_freep(&copy);
601
602             if (ret < 0)
603                 goto fail;
604 #endif
605         } else {
606             ret = process_unnamed_options(filter, &options, args);
607             if (ret < 0)
608                 goto fail;
609         }
610     }
611
612     if (filter->filter->priv_class) {
613         ret = av_opt_set_dict(filter->priv, &options);
614         if (ret < 0) {
615             av_log(filter, AV_LOG_ERROR, "Error applying options to the filter.\n");
616             goto fail;
617         }
618     }
619
620     if (filter->filter->init)
621         ret = filter->filter->init(filter);
622     else if (filter->filter->init_dict)
623         ret = filter->filter->init_dict(filter, &options);
624     if (ret < 0)
625         goto fail;
626
627     if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
628         av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key);
629         ret = AVERROR_OPTION_NOT_FOUND;
630         goto fail;
631     }
632
633 fail:
634     av_dict_free(&options);
635
636     return ret;
637 }
638
639 const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
640 {
641     return pads[pad_idx].name;
642 }
643
644 enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
645 {
646     return pads[pad_idx].type;
647 }
648
649 static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
650 {
651     return ff_filter_frame(link->dst->outputs[0], frame);
652 }
653
654 int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
655 {
656     int (*filter_frame)(AVFilterLink *, AVFrame *);
657     AVFilterPad *dst = link->dstpad;
658     AVFrame *out;
659
660     FF_DPRINTF_START(NULL, filter_frame);
661     ff_dlog_link(NULL, link, 1);
662
663     if (!(filter_frame = dst->filter_frame))
664         filter_frame = default_filter_frame;
665
666     /* copy the frame if needed */
667     if (dst->needs_writable && !av_frame_is_writable(frame)) {
668         av_log(link->dst, AV_LOG_DEBUG, "Copying data in avfilter.\n");
669
670         switch (link->type) {
671         case AVMEDIA_TYPE_VIDEO:
672             out = ff_get_video_buffer(link, link->w, link->h);
673             break;
674         case AVMEDIA_TYPE_AUDIO:
675             out = ff_get_audio_buffer(link, frame->nb_samples);
676             break;
677         default: return AVERROR(EINVAL);
678         }
679         if (!out) {
680             av_frame_free(&frame);
681             return AVERROR(ENOMEM);
682         }
683         av_frame_copy_props(out, frame);
684
685         switch (link->type) {
686         case AVMEDIA_TYPE_VIDEO:
687             av_image_copy(out->data, out->linesize, frame->data, frame->linesize,
688                           frame->format, frame->width, frame->height);
689             break;
690         case AVMEDIA_TYPE_AUDIO:
691             av_samples_copy(out->extended_data, frame->extended_data,
692                             0, 0, frame->nb_samples,
693                             av_get_channel_layout_nb_channels(frame->channel_layout),
694                             frame->format);
695             break;
696         default: return AVERROR(EINVAL);
697         }
698
699         av_frame_free(&frame);
700     } else
701         out = frame;
702
703     return filter_frame(link, out);
704 }
705
706 const AVClass *avfilter_get_class(void)
707 {
708     return &avfilter_class;
709 }