diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-07-13 15:11:07 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-07-20 20:30:13 +0200 |
commit | ab16e324eae9f0eded14f8486fe44ad97ef613c8 (patch) | |
tree | 1e7834773130c0e6690f703ab77c0970152b77b6 | |
parent | 6298dd683b8542dd0c6b5eefabdcd8a7c7c54399 (diff) | |
download | ffmpeg-ab16e324eae9f0eded14f8486fe44ad97ef613c8.tar.gz |
fftools/ffmpeg_filter: return error codes from ofilter_bind_ost() instead of aborting
-rw-r--r-- | fftools/ffmpeg.h | 2 | ||||
-rw-r--r-- | fftools/ffmpeg_filter.c | 12 | ||||
-rw-r--r-- | fftools/ffmpeg_mux_init.c | 4 |
3 files changed, 12 insertions, 6 deletions
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 36e8867fd5..878f8e87d5 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -743,7 +743,7 @@ void ifilter_sub2video_heartbeat(InputFilter *ifilter, int64_t pts, AVRational t */ int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext *dec); -void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost); +int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost); /** * Create a new filtergraph in the global filtergraph list. diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index d373d8c002..cdf5610620 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -624,7 +624,7 @@ static void set_channel_layout(OutputFilterPriv *f, OutputStream *ost) av_channel_layout_default(&f->ch_layout, ost->enc_ctx->ch_layout.nb_channels); } -void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) +int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) { OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); FilterGraph *fg = ofilter->graph; @@ -699,15 +699,17 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) for (int i = 0; i < fg->nb_outputs; i++) if (!fg->outputs[i]->ost) - return; + return 0; ret = configure_filtergraph(fg); if (ret < 0) { av_log(fg, AV_LOG_ERROR, "Error configuring filter graph: %s\n", av_err2str(ret)); - exit_program(1); + return ret; } } + + return 0; } static InputFilter *ifilter_alloc(FilterGraph *fg) @@ -899,7 +901,9 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost, if (ret < 0) return ret; - ofilter_bind_ost(fg->outputs[0], ost); + ret = ofilter_bind_ost(fg->outputs[0], ost); + if (ret < 0) + return ret; return 0; } diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index d6ae154ad9..4580f4af41 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1382,7 +1382,9 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) { if (ofilter) { ost->filter = ofilter; - ofilter_bind_ost(ofilter, ost); + ret = ofilter_bind_ost(ofilter, ost); + if (ret < 0) + return ret; } else { ret = init_simple_filtergraph(ost->ist, ost, filters); if (ret < 0) { |