Showing the changes to libavfilter/avfiltergraph.c (1 of 4 files). Show all
Unified · Split
| @@ -213,11 +213,16 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 212 unmodified lines | ||
| 213 | 213 | /* couldn't merge format lists. auto-insert conversion filter */ |
| 214 | 214 | switch (link->type) { |
| 215 | 215 | case AVMEDIA_TYPE_VIDEO: |
| 216 | + if (!(filter = avfilter_get_by_name("scale"))) { | |
| 217 | + av_log(log_ctx, AV_LOG_ERROR, "'scale' filter " | |
| 218 | + "not present, cannot convert pixel formats.\n"); | |
| 219 | + return AVERROR(EINVAL); | |
| 220 | + } | |
| 221 | + | |
| 216 | 222 | snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d", |
| 217 | 223 | scaler_count++); |
| 218 | 224 | snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts); |
| 219 | − if ((ret = avfilter_graph_create_filter(&convert, | |
| 220 | − avfilter_get_by_name("scale"), | |
| 225 | + if ((ret = avfilter_graph_create_filter(&convert, filter, | |
| 221 | 226 | inst_name, scale_args, NULL, |
| 222 | 227 | graph)) < 0) |
| 223 | 228 | return ret; |