| 391 | }; |
| 392 | |
| 393 | AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) |
| 394 | { |
| 395 | AVFilterContext *ret; |
| 396 | |
| 397 | if (!filter) |
| 398 | return 0; |
| 399 | |
| 400 | ret = av_mallocz(sizeof(AVFilterContext)); |
| 401 | |
| 402 | ret->av_class = &avfilter_class; |
| 403 | ret->filter = filter; |
| 404 | ret->name = inst_name ? av_strdup(inst_name) : NULL; |
| 405 | ret->priv = av_mallocz(filter->priv_size); |
| 406 | |
| 407 | ret->input_count = pad_count(filter->inputs); |
| 408 | if (ret->input_count) { |
| 409 | ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); |
| 410 | memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); |
| 411 | ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); |
| 412 | } |
| 413 | |
| 414 | ret->output_count = pad_count(filter->outputs); |
| 415 | if (ret->output_count) { |
| 416 | ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); |
| 417 | memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); |
| 418 | ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); |
| 419 | } |
| 420 | |
| 421 | return ret; |
| 422 | } |
| 423 | |
| 424 | void avfilter_destroy(AVFilterContext *filter) |
| 425 | { |
no test coverage detected