| @@ -1180,25 +1180,27 @@ fail: · 1179 unmodified lines |
| 1180 | 1180 | return 0; |
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | | −int init_simple_filtergraph(InputStream *ist, OutputStream *ost, |
| 1184 | | − char *graph_desc, |
| 1185 | | − Scheduler *sch, unsigned sched_idx_enc, |
| 1186 | | − const OutputFilterOptions *opts) |
| 1183 | +int fg_create_simple(FilterGraph **pfg, |
| 1184 | + InputStream *ist, |
| 1185 | + char *graph_desc, |
| 1186 | + Scheduler *sch, unsigned sched_idx_enc, |
| 1187 | + const OutputFilterOptions *opts) |
| 1187 | 1188 | { |
| 1189 | + const enum AVMediaType type = ist->par->codec_type; |
| 1188 | 1190 | FilterGraph *fg; |
| 1189 | 1191 | FilterGraphPriv *fgp; |
| 1190 | 1192 | int ret; |
| 1191 | 1193 | |
| 1192 | | − ret = fg_create(&ost->fg_simple, graph_desc, sch); |
| 1194 | + ret = fg_create(pfg, graph_desc, sch); |
| 1193 | 1195 | if (ret < 0) |
| 1194 | 1196 | return ret; |
| 1195 | | − fg = ost->fg_simple; |
| 1197 | + fg = *pfg; |
| 1196 | 1198 | fgp = fgp_from_fg(fg); |
| 1197 | 1199 | |
| 1198 | 1200 | fgp->is_simple = 1; |
| 1199 | 1201 | |
| 1200 | 1202 | snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf%s", |
| 1201 | | − av_get_media_type_string(ost->type)[0], opts->name); |
| 1203 | + av_get_media_type_string(type)[0], opts->name); |
| 1202 | 1204 | |
| 1203 | 1205 | if (fg->nb_inputs != 1 || fg->nb_outputs != 1) { |
| 1204 | 1206 | av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected " |
| @@ -1208,16 +1210,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost, · 3 unmodified lines |
| 1208 | 1210 | graph_desc, fg->nb_inputs, fg->nb_outputs); |
| 1209 | 1211 | return AVERROR(EINVAL); |
| 1210 | 1212 | } |
| 1211 | | − if (fg->outputs[0]->type != ost->type) { |
| 1213 | + if (fg->outputs[0]->type != type) { |
| 1212 | 1214 | av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect " |
| 1213 | 1215 | "it to %s output stream\n", |
| 1214 | 1216 | av_get_media_type_string(fg->outputs[0]->type), |
| 1215 | | − av_get_media_type_string(ost->type)); |
| 1217 | + av_get_media_type_string(type)); |
| 1216 | 1218 | return AVERROR(EINVAL); |
| 1217 | 1219 | } |
| 1218 | 1220 | |
| 1219 | | − ost->filter = fg->outputs[0]; |
| 1220 | | − |
| 1221 | 1221 | ret = ifilter_bind_ist(fg->inputs[0], ist, opts->vs); |
| 1222 | 1222 | if (ret < 0) |
| 1223 | 1223 | return ret; |