Browse Source

Implement in AVFilterGraph the scale_sws_opts field, and pass its

value in the args for the auto-inserted scale filters.

Originally committed as revision 17547 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Stefano Sabatini 16 years ago
parent
commit
39c07b8e44
3 changed files with 7 additions and 2 deletions
  1. +1
    -1
      libavfilter/avfilter.h
  2. +4
    -1
      libavfilter/avfiltergraph.c
  3. +2
    -0
      libavfilter/avfiltergraph.h

+ 1
- 1
libavfilter/avfilter.h View File

@@ -23,7 +23,7 @@
#define AVFILTER_AVFILTER_H #define AVFILTER_AVFILTER_H


#define LIBAVFILTER_VERSION_MAJOR 0 #define LIBAVFILTER_VERSION_MAJOR 0
#define LIBAVFILTER_VERSION_MINOR 3
#define LIBAVFILTER_VERSION_MINOR 4
#define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_MICRO 0


#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \


+ 4
- 1
libavfilter/avfiltergraph.c View File

@@ -30,6 +30,7 @@ void avfilter_destroy_graph(AVFilterGraph *graph)
{ {
for(; graph->filter_count > 0; graph->filter_count --) for(; graph->filter_count > 0; graph->filter_count --)
avfilter_destroy(graph->filters[graph->filter_count - 1]); avfilter_destroy(graph->filters[graph->filter_count - 1]);
av_freep(&graph->scale_sws_opts);
av_freep(&graph->filters); av_freep(&graph->filters);
} }


@@ -111,13 +112,15 @@ static int query_formats(AVFilterGraph *graph)
if(!avfilter_merge_formats(link->in_formats, if(!avfilter_merge_formats(link->in_formats,
link->out_formats)) { link->out_formats)) {
AVFilterContext *scale; AVFilterContext *scale;
char scale_args[256];
/* couldn't merge format lists. auto-insert scale filter */ /* couldn't merge format lists. auto-insert scale filter */
snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d", snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
scaler_count); scaler_count);
scale = scale =
avfilter_open(avfilter_get_by_name("scale"),inst_name); avfilter_open(avfilter_get_by_name("scale"),inst_name);


if(!scale || scale->filter->init(scale, NULL, NULL) ||
snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
if(!scale || scale->filter->init(scale, scale_args, NULL) ||
avfilter_insert_filter(link, scale, 0, 0)) { avfilter_insert_filter(link, scale, 0, 0)) {
avfilter_destroy(scale); avfilter_destroy(scale);
return -1; return -1;


+ 2
- 0
libavfilter/avfiltergraph.h View File

@@ -27,6 +27,8 @@
typedef struct AVFilterGraph { typedef struct AVFilterGraph {
unsigned filter_count; unsigned filter_count;
AVFilterContext **filters; AVFilterContext **filters;

char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
} AVFilterGraph; } AVFilterGraph;


/** /**


Loading…
Cancel
Save