[FFmpeg-devel] [PATCH 1/2] lavfi: add avfilter_graph_disable_auto_convert().
Stefano Sabatini
stefasab at gmail.com
Fri Apr 27 23:27:26 CEST 2012
On date Friday 2012-04-27 11:04:22 +0200, Nicolas George encoded:
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavfilter/avfiltergraph.c | 13 +++++++++++++
> libavfilter/avfiltergraph.h | 16 ++++++++++++++++
> libavfilter/version.h | 2 +-
> 3 files changed, 30 insertions(+), 1 deletions(-)
>
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index 9d7b956..813e389 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -95,6 +95,11 @@ fail:
> return ret;
> }
>
> +void avfilter_graph_disable_auto_convert(AVFilterGraph *graph, unsigned flags)
> +{
> + graph->disable_auto_convert = flags;
> +}
>
> int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
> {
> AVFilterContext *filt;
> @@ -160,6 +165,14 @@ static int insert_conv_filter(AVFilterGraph *graph, AVFilterLink *link,
> char inst_name[32];
> AVFilterContext *filt_ctx;
>
> + if (graph->disable_auto_convert) {
> + av_log(NULL, AV_LOG_ERROR,
> + "The filters '%s' and '%s' do not have a common format "
> + "and automatic conversion is disabled.\n",
> + link->src->name, link->dst->name);
> + return AVERROR(EINVAL);
> + }
> +
> snprintf(inst_name, sizeof(inst_name), "auto-inserted %s %d",
> filt_name, auto_count++);
>
> diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
> index b003795..f438bce 100644
> --- a/libavfilter/avfiltergraph.h
> +++ b/libavfilter/avfiltergraph.h
> @@ -43,6 +43,8 @@ typedef struct AVFilterGraph {
>
> AVFilterLink **sink_links;
> int sink_links_count;
> +
> + unsigned disable_auto_convert;
You can have:
avfilter_graph_disable_disable_auto_convert(graph, 0);
which is *enabling* auto conversion, and is rather confusing.
What about having a conversion mode field, like:
AVFILTER_GRAPH_CONVERT_AUTO = 0 // default
AVFILTER_GRAPH_CONVERT_DISABLE
...
and then a setter like this:
avfilter_graph_set_conversion_mode(...);
--
FFmpeg = Fundamental and Faithful Meaningless Practical Erotic Geisha
More information about the ffmpeg-devel
mailing list