|
|
@ -68,20 +68,16 @@ static int query_formats(AVFilterGraph *graph) |
|
|
|
AVFilterContext *filter = graph->filters[i]; |
|
|
|
AVFilterContext *filter = graph->filters[i]; |
|
|
|
|
|
|
|
|
|
|
|
for(j = 0; j < filter->input_count; j ++) { |
|
|
|
for(j = 0; j < filter->input_count; j ++) { |
|
|
|
AVFilterLink *link; |
|
|
|
AVFilterLink *link = filter->inputs[j]; |
|
|
|
if(!(link = filter->inputs[j])) |
|
|
|
if(link && link->in_formats != link->out_formats) { |
|
|
|
continue; |
|
|
|
|
|
|
|
if(link->in_formats != link->out_formats) { |
|
|
|
|
|
|
|
if(!avfilter_merge_formats(link->in_formats, |
|
|
|
if(!avfilter_merge_formats(link->in_formats, |
|
|
|
link->out_formats)) { |
|
|
|
link->out_formats)) { |
|
|
|
/* couldn't merge format lists. auto-insert scale filter */ |
|
|
|
/* couldn't merge format lists. auto-insert scale filter */ |
|
|
|
AVFilterContext *scale; |
|
|
|
AVFilterContext *scale = |
|
|
|
|
|
|
|
avfilter_open(avfilter_get_by_name("scale"), NULL); |
|
|
|
|
|
|
|
|
|
|
|
if(!(scale = |
|
|
|
if(!scale || scale->filter->init(scale, NULL, NULL) || |
|
|
|
avfilter_open(avfilter_get_by_name("scale"), NULL))) |
|
|
|
avfilter_insert_filter(link, scale, 0, 0)) { |
|
|
|
return -1; |
|
|
|
|
|
|
|
if(scale->filter->init(scale, NULL, NULL) || |
|
|
|
|
|
|
|
avfilter_insert_filter(link, scale, 0, 0)) { |
|
|
|
|
|
|
|
avfilter_destroy(scale); |
|
|
|
avfilter_destroy(scale); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|