From e5ae44fe8287c6a5f91c8f9dfced7cb661f0d79b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 28 Apr 2021 10:50:08 +0200 Subject: Tidy up some error handling a little. --- src/lib/ffmpeg.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib/ffmpeg.cc') diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 7bb17f9bf..3de5da275 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -192,7 +192,7 @@ FFmpeg::setup_general () _frame = av_frame_alloc (); if (_frame == 0) { - throw DecodeError (N_("could not allocate frame")); + throw std::bad_alloc (); } } @@ -225,8 +225,9 @@ DCPOMATIC_DISABLE_WARNINGS /* Enable following of links in files */ av_dict_set_int (&options, "enable_drefs", 1, 0); - if (avcodec_open2 (context, codec, &options) < 0) { - throw DecodeError (N_("could not open decoder")); + int r = avcodec_open2 (context, codec, &options); + if (r < 0) { + throw DecodeError (N_("avcodec_open2"), N_("FFmpeg::setup_decoders"), r); } } else { dcpomatic_log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING); -- cgit v1.2.3