Also perform them earlier.
---
fftools/ffmpeg_filter.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 82ee4fae7d..4b660002ed 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -663,6 +663,13 @@ static int ifilter_bind_ist(InputFilter *ifilter,
InputStream *ist)
av_assert0(!ifp->ist);
+ if (ifp->type != ist->par->codec_type &&
+ !(ifp->type == AVMEDIA_TYPE_VIDEO && ist->par->codec_type ==
AVMEDIA_TYPE_SUBTITLE)) {
+ av_log(fgp, AV_LOG_ERROR, "Tried to connect %s stream to %s
filtergraph input\n",
+ av_get_media_type_string(ist->par->codec_type),
av_get_media_type_string(ifp->type));
+ return AVERROR(EINVAL);
+ }
+
ifp->ist = ist;
ifp->type_src = ist->st->codecpar->codec_type;
@@ -1476,12 +1483,6 @@ static int configure_input_video_filter(FilterGraph *fg,
AVFilterGraph *graph,
if (!par)
return AVERROR(ENOMEM);
- if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
- av_log(fg, AV_LOG_ERROR, "Cannot connect video filter to audio
input\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
if (!fr.num)
fr = ist->framerate_guessed;
@@ -1598,11 +1599,6 @@ static int configure_input_audio_filter(FilterGraph *fg,
AVFilterGraph *graph,
int ret, pad_idx = 0;
int64_t tsoffset = 0;
- if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) {
- av_log(fg, AV_LOG_ERROR, "Cannot connect audio filter to non audio
input\n");
- return AVERROR(EINVAL);
- }
-
ifp->time_base = (AVRational){ 1, ifp->sample_rate };
av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".