MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / create_filter

Function create_filter

libavfilter/graphparser.c:76–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76static AVFilterContext *create_filter(AVFilterGraph *ctx, int index,
77 const char *filt_name, const char *args,
78 AVClass *log_ctx)
79{
80 AVFilterContext *filt_ctx;
81
82 AVFilter *filt;
83 char inst_name[30];
84
85 snprintf(inst_name, sizeof(inst_name), "Parsed filter %d", index);
86
87 filt = avfilter_get_by_name(filt_name);
88
89 if(!filt) {
90 av_log(log_ctx, AV_LOG_ERROR,
91 "no such filter: '%s'\n", filt_name);
92 return NULL;
93 }
94
95 filt_ctx = avfilter_open(filt, inst_name);
96 if(!filt_ctx) {
97 av_log(log_ctx, AV_LOG_ERROR,
98 "error creating filter '%s'\n", filt_name);
99 return NULL;
100 }
101
102 if(avfilter_graph_add_filter(ctx, filt_ctx) < 0) {
103 avfilter_destroy(filt_ctx);
104 return NULL;
105 }
106
107 if(avfilter_init_filter(filt_ctx, args, NULL)) {
108 av_log(log_ctx, AV_LOG_ERROR,
109 "error initializing filter '%s' with args '%s'\n", filt_name, args);
110 return NULL;
111 }
112
113 return filt_ctx;
114}
115
116/**
117 * Parse "filter=params"

Callers 1

parse_filterFunction · 0.85

Calls 6

avfilter_get_by_nameFunction · 0.85
av_logFunction · 0.85
avfilter_openFunction · 0.85
avfilter_destroyFunction · 0.85
avfilter_init_filterFunction · 0.85

Tested by

no test coverage detected