History

lavfi: replace avfilter_open() with avfilter_graph_alloc_filter().

Since we do not support "standalone" filters not attached to an AVFilterGraph, we should not have a public function to create such filters. In addition that function is horribly named, the action it does cannot be possibly described as "opening" a filter.

Anton Khirnov committed 13 years ago

Commit bc1a9851 parent 38f0c077 files · +83 −20Browse files

Showing the changes to libavfilter/avfilter.c (1 of 7 files). Show all

Unified · Split

libavfilter/avfilter.c+13−7
@@ -352,17 +352,16 @@ static const AVClass avfilter_class = { · 351 unmodified lines
352 .child_class_next = filter_child_class_next,352 .child_class_next = filter_child_class_next,
353};353};
354 354
355int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)355AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
356{356{
357 AVFilterContext *ret;357 AVFilterContext *ret;
358 *filter_ctx = NULL;
359 358
360 if (!filter)359 if (!filter)
361 return AVERROR(EINVAL);360 return NULL;
362 361
363 ret = av_mallocz(sizeof(AVFilterContext));362 ret = av_mallocz(sizeof(AVFilterContext));
364 if (!ret)363 if (!ret)
365 return AVERROR(ENOMEM);364 return NULL;
366 365
367 ret->av_class = &avfilter_class;366 ret->av_class = &avfilter_class;
368 ret->filter = filter;367 ret->filter = filter;
@@ -404,8 +403,7 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 35 unmodified lines
404 ret->input_count = ret->nb_inputs;403 ret->input_count = ret->nb_inputs;
405#endif404#endif
406 405
407 *filter_ctx = ret;406 return ret;
408 return 0;
409 407
410err:408err:
411 av_freep(&ret->inputs);409 av_freep(&ret->inputs);
@@ -416,9 +414,17 @@ err: · 4 unmodified lines
416 ret->nb_outputs = 0;414 ret->nb_outputs = 0;
417 av_freep(&ret->priv);415 av_freep(&ret->priv);
418 av_free(ret);416 av_free(ret);
419 return AVERROR(ENOMEM);417 return NULL;
420}418}
421 419
420#if FF_API_AVFILTER_OPEN
421int 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
422void avfilter_free(AVFilterContext *filter)428void avfilter_free(AVFilterContext *filter)
423{429{
424 int i;430 int i;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t