aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_filter.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-05-11 10:51:13 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-22 17:10:44 +0200
commitdfa29ba9550797881943fa5b12a8cf5f30a3e47c (patch)
treee537501b9f7c01e0b28bf90c6836b189e04d793e /fftools/ffmpeg_filter.c
parentede6794d6a31c781f680e47c20515e18db0da454 (diff)
downloadffmpeg-dfa29ba9550797881943fa5b12a8cf5f30a3e47c.tar.gz
fftools/ffmpeg: return error codes from ist_*_add()
Will be useful in future commits.
Diffstat (limited to 'fftools/ffmpeg_filter.c')
-rw-r--r--fftools/ffmpeg_filter.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 8cc76209d0..ca43b4803a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -334,6 +334,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
FilterGraph *fg;
OutputFilter *ofilter;
InputFilter *ifilter;
+ int ret;
fg = fg_create(NULL);
if (!fg)
@@ -347,7 +348,9 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
ifilter = ifilter_alloc(fg);
ifilter->ist = ist;
- ist_filter_add(ist, ifilter, 1);
+ ret = ist_filter_add(ist, ifilter, 1);
+ if (ret < 0)
+ return ret;
return 0;
}
@@ -375,7 +378,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
InputStream *ist = NULL;
enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx);
InputFilter *ifilter;
- int i;
+ int i, ret;
// TODO: support other filter types
if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
@@ -435,7 +438,13 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
ifilter->type = ist->st->codecpar->codec_type;
ifilter->name = describe_filter_link(fg, in, 1);
- ist_filter_add(ist, ifilter, 0);
+ ret = ist_filter_add(ist, ifilter, 0);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Error binding an input stream to complex filtergraph input %s.\n",
+ in->name ? in->name : "");
+ exit_program(1);
+ }
}
static int read_binary(const char *path, uint8_t **data, int *len)