diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-01-10 12:31:58 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-01-30 09:52:00 +0100 |
commit | d47bb91f8bc67427ee8e4f8855878f19efa6ef38 (patch) | |
tree | a99b829e6649793cdc340459d725181468d44920 /fftools | |
parent | b43d4a06925867fbbc0dbe21d63a3593253f672a (diff) | |
download | ffmpeg-d47bb91f8bc67427ee8e4f8855878f19efa6ef38.tar.gz |
fftools/ffmpeg_filter: consolidate decoder/filter type checks
Also perform them earlier.
Diffstat (limited to 'fftools')
-rw-r--r-- | fftools/ffmpeg_filter.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index ab64b4610a..3e41e57986 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); |