summaryrefslogtreecommitdiff
path: root/fftools/cmdutils.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-27 14:52:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-01 14:21:56 +0200
commite157b21a9081e3c4e8e22a4ae764dfbf0cc5b5b3 (patch)
tree9e7110ddf324b92f4e0cbf2324932f4ed9c6731e /fftools/cmdutils.c
parent319e8a49b5bcfa80fcb6f50f0dd78c6408c972ae (diff)
downloadffmpeg-e157b21a9081e3c4e8e22a4ae764dfbf0cc5b5b3.tar.gz
fftools/cmdutils: Add function to report error before exit
This is designed to improve and unify error handling for allocation failures for the many (often small) allocations that we have in the fftools. These typically either don't return an error message or an error message that is not really helpful to the user and can be replaced by a generic error message without loss of information. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools/cmdutils.c')
-rw-r--r--fftools/cmdutils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 18e768b386..da3d391694 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -90,6 +90,12 @@ void register_exit(void (*cb)(int ret))
program_exit = cb;
}
+void report_and_exit(int ret)
+{
+ av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret));
+ exit_program(AVUNERROR(ret));
+}
+
void exit_program(int ret)
{
if (program_exit)