lavfi: add avfilter_graph_set_auto_convert().
This commit is contained in:
parent
7e944159c6
commit
440af105f2
@ -95,6 +95,11 @@ fail:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
|
||||||
|
{
|
||||||
|
graph->disable_auto_convert = flags;
|
||||||
|
}
|
||||||
|
|
||||||
int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
|
int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
|
||||||
{
|
{
|
||||||
AVFilterContext *filt;
|
AVFilterContext *filt;
|
||||||
@ -160,6 +165,14 @@ static int insert_conv_filter(AVFilterGraph *graph, AVFilterLink *link,
|
|||||||
char inst_name[32];
|
char inst_name[32];
|
||||||
AVFilterContext *filt_ctx;
|
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",
|
snprintf(inst_name, sizeof(inst_name), "auto-inserted %s %d",
|
||||||
filt_name, auto_count++);
|
filt_name, auto_count++);
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ typedef struct AVFilterGraph {
|
|||||||
|
|
||||||
AVFilterLink **sink_links;
|
AVFilterLink **sink_links;
|
||||||
int sink_links_count;
|
int sink_links_count;
|
||||||
|
|
||||||
|
unsigned disable_auto_convert;
|
||||||
} AVFilterGraph;
|
} AVFilterGraph;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,6 +85,21 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt,
|
|||||||
const char *name, const char *args, void *opaque,
|
const char *name, const char *args, void *opaque,
|
||||||
AVFilterGraph *graph_ctx);
|
AVFilterGraph *graph_ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable automatic format conversion inside the graph.
|
||||||
|
*
|
||||||
|
* Note that format conversion can still happen inside explicitly inserted
|
||||||
|
* scale and aconvert filters.
|
||||||
|
*
|
||||||
|
* @param flags any of the AVFILTER_AUTO_CONVERT_* constants
|
||||||
|
*/
|
||||||
|
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */
|
||||||
|
AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check validity and configure all the links and formats in the graph.
|
* Check validity and configure all the links and formats in the graph.
|
||||||
*
|
*
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
#define LIBAVFILTER_VERSION_MAJOR 2
|
||||||
#define LIBAVFILTER_VERSION_MINOR 72
|
#define LIBAVFILTER_VERSION_MINOR 73
|
||||||
#define LIBAVFILTER_VERSION_MICRO 105
|
#define LIBAVFILTER_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||||
LIBAVFILTER_VERSION_MINOR, \
|
LIBAVFILTER_VERSION_MINOR, \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user