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
352352 .child_class_next = filter_child_class_next,
353353 };
354354
355−int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
355+AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
356356 {
357357 AVFilterContext *ret;
358− *filter_ctx = NULL;
359358
360359 if (!filter)
361− return AVERROR(EINVAL);
360+ return NULL;
362361
363362 ret = av_mallocz(sizeof(AVFilterContext));
364363 if (!ret)
365− return AVERROR(ENOMEM);
364+ return NULL;
366365
367366 ret->av_class = &avfilter_class;
368367 ret->filter = filter;
@@ -404,8 +403,7 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 35 unmodified lines
404403 ret->input_count = ret->nb_inputs;
405404 #endif
406405
407− *filter_ctx = ret;
408− return 0;
406+ return ret;
409407
410408 err:
411409 av_freep(&ret->inputs);
@@ -416,9 +414,17 @@ err: · 4 unmodified lines
416414 ret->nb_outputs = 0;
417415 av_freep(&ret->priv);
418416 av_free(ret);
419− return AVERROR(ENOMEM);
417+ return NULL;
420418 }
421419
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+
422428 void avfilter_free(AVFilterContext *filter)
423429 {
424430 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