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