summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-02-21 15:43:25 +0100
committerAnton Khirnov <anton@khirnov.net>2024-03-09 20:03:33 +0100
commit01e11ab27251977d20264187791566f1297aae57 (patch)
tree130dcc7428ed8fbfbe588e100e7d38f02d9f1cf7
parent044f4a61c3248b0f79186ef0ac594c6cb8ce521b (diff)
fftools/ffmpeg_filter: move filtergraph input type check to a better place
Perform it right after we figure out what the type is.
-rw-r--r--fftools/ffmpeg_filter.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index f24fd3eecb..16e71ed330 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1005,6 +1005,14 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
ifp->type = avfilter_pad_get_type(cur->filter_ctx->input_pads,
cur->pad_idx);
+
+ if (ifp->type != AVMEDIA_TYPE_VIDEO && ifp->type != AVMEDIA_TYPE_AUDIO) {
+ av_log(fg, AV_LOG_FATAL, "Only video and audio filters supported "
+ "currently.\n");
+ ret = AVERROR(ENOSYS);
+ goto fail;
+ }
+
ifilter->name = describe_filter_link(fg, cur, 1);
if (!ifilter->name) {
ret = AVERROR(ENOMEM);
@@ -1104,13 +1112,6 @@ static int fg_complex_bind_input(FilterGraph *fg, InputFilter *ifilter)
enum AVMediaType type = ifp->type;
int i, ret;
- // TODO: support other filter types
- if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
- av_log(fg, AV_LOG_FATAL, "Only video and audio filters supported "
- "currently.\n");
- return AVERROR(ENOSYS);
- }
-
if (ifp->linklabel) {
AVFormatContext *s;
AVStream *st = NULL;