History

Merge commit '1ba95a9cca57b023b9b9de071a5671fc05b05e58'

* commit '1ba95a9cca57b023b9b9de071a5671fc05b05e58': lavfi: add avfilter_init_dict() for initializing a filter with a dict. Conflicts: libavfilter/avfilter.c

Michael Niedermayer committed 13 years ago

Commit 46de9ba2 parents 6b5ec76 1ba95a93 files · +46 −14Browse files

Unified · Split

3 files
  1. doc/APIchanges +1 −0
  2. libavfilter/avfilter.c +23 −14
  3. libavfilter/avfilter.h +22 −0
doc/APIchanges+1−0
@@ -168,6 +168,7 @@ API changes, most recent first: · 167 unmodified lines
168 Add AVFilterContext.graph pointing to the AVFilterGraph that contains the168 Add AVFilterContext.graph pointing to the AVFilterGraph that contains the
169 filter.169 filter.
170 Add avfilter_init_str(), deprecate avfilter_init_filter().170 Add avfilter_init_str(), deprecate avfilter_init_filter().
171 Add avfilter_init_dict().
171 172
1722013-xx-xx - lavfi 3.7.0 - avfilter.h1732013-xx-xx - lavfi 3.7.0 - avfilter.h
173 Add AVFilter.priv_class for exporting filter options through the AVOptions API174 Add AVFilter.priv_class for exporting filter options through the AVOptions API
libavfilter/avfilter.c+23−14
@@ -688,6 +688,28 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque · 687 unmodified lines
688}688}
689#endif689#endif
690 690
691int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
692{
693 int ret = 0;
694
695 if (ctx->filter->priv_class) {
696 ret = av_opt_set_dict(ctx->priv, options);
697 if (ret < 0) {
698 av_log(ctx, AV_LOG_ERROR, "Error applying options to the filter.\n");
699 return ret;
700 }
701 }
702
703 if (ctx->filter->init_opaque)
704 ret = ctx->filter->init_opaque(ctx, NULL);
705 else if (ctx->filter->init)
706 ret = ctx->filter->init(ctx);
707 else if (ctx->filter->init_dict)
708 ret = ctx->filter->init_dict(ctx, options);
709
710 return ret;
711}
712
691int avfilter_init_str(AVFilterContext *filter, const char *args)713int avfilter_init_str(AVFilterContext *filter, const char *args)
692{714{
693 AVDictionary *options = NULL;715 AVDictionary *options = NULL;
@@ -794,20 +816,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args) · 100 unmodified lines
794 }816 }
795 }817 }
796 818
797 if (filter->filter->priv_class) {819 ret = avfilter_init_dict(filter, &options);
798 ret = av_opt_set_dict(filter->priv, &options);
799 if (ret < 0) {
800 av_log(filter, AV_LOG_ERROR, "Error applying options to the filter.\n");
801 goto fail;
802 }
803 }
804
805 if (filter->filter->init_opaque)
806 ret = filter->filter->init_opaque(filter, NULL);
807 else if (filter->filter->init)
808 ret = filter->filter->init(filter);
809 else if (filter->filter->init_dict)
810 ret = filter->filter->init_dict(filter, &options);
811 if (ret < 0)820 if (ret < 0)
812 goto fail;821 goto fail;
813 822
libavfilter/avfilter.h+22−0
@@ -888,6 +888,28 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque · 887 unmodified lines
888 */888 */
889int avfilter_init_str(AVFilterContext *ctx, const char *args);889int avfilter_init_str(AVFilterContext *ctx, const char *args);
890 890
891/**
892 * Initialize a filter with the supplied dictionary of options.
893 *
894 * @param ctx uninitialized filter context to initialize
895 * @param options An AVDictionary filled with options for this filter. On
896 * return this parameter will be destroyed and replaced with
897 * a dict containing options that were not found. This dictionary
898 * must be freed by the caller.
899 * May be NULL, then this function is equivalent to
900 * avfilter_init_str() with the second parameter set to NULL.
901 * @return 0 on success, a negative AVERROR on failure
902 *
903 * @note This function and avfilter_init_str() do essentially the same thing,
904 * the difference is in manner in which the options are passed. It is up to the
905 * calling code to choose whichever is more preferable. The two functions also
906 * behave differently when some of the provided options are not declared as
907 * supported by the filter. In such a case, avfilter_init_str() will fail, but
908 * this function will leave those extra options in the options AVDictionary and
909 * continue as usual.
910 */
911int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options);
912
891/**913/**
892 * Free a filter context. This will also remove the filter from its914 * Free a filter context. This will also remove the filter from its
893 * filtergraph's list of filters.915 * filtergraph's list of filters.

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