fftools/ffmpeg_filter: check that filter type matches output stream type

For simple filtergraphs. For complex filtergraphs they always match.
This commit is contained in:
Anton Khirnov 2024-04-01 06:23:58 +02:00
parent 8e35e33d42
commit 651c79da36
1 changed files with 8 additions and 0 deletions

View File

@ -773,6 +773,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
int ret;
av_assert0(!ofilter->ost);
av_assert0(ofilter->type == ost->type);
ofilter->ost = ost;
av_freep(&ofilter->linklabel);
@ -1106,6 +1107,13 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
graph_desc, fg->nb_inputs, fg->nb_outputs);
return AVERROR(EINVAL);
}
if (fg->outputs[0]->type != ost->type) {
av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect "
"it to %s output stream\n",
av_get_media_type_string(fg->outputs[0]->type),
av_get_media_type_string(ost->type));
return AVERROR(EINVAL);
}
ost->filter = fg->outputs[0];