summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-09-09 18:47:42 +0200
committerMax Kellermann <max@musicpd.org>2016-09-16 17:43:36 +0200
commit8c744efd5693f2a39b1441d747ebdf0d23faa308 (patch)
treeee7e99a9b1a235bc1ef554930a3c75dbfabec8d5 /src/lib/ffmpeg
parent597e59f10da774c7169ee4328c874b21f71f3e60 (diff)
input/InputStream: migrate from class Error to C++ exceptions
Diffstat (limited to 'src/lib/ffmpeg')
-rw-r--r--src/lib/ffmpeg/Error.cxx9
-rw-r--r--src/lib/ffmpeg/Error.hxx3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/ffmpeg/Error.cxx b/src/lib/ffmpeg/Error.cxx
index 92608300f..2b9cc5a6c 100644
--- a/src/lib/ffmpeg/Error.cxx
+++ b/src/lib/ffmpeg/Error.cxx
@@ -21,6 +21,7 @@
#include "Error.hxx"
#include "Domain.hxx"
#include "util/Error.hxx"
+#include "util/RuntimeError.hxx"
extern "C" {
#include <libavutil/error.h>
@@ -34,6 +35,14 @@ MakeFfmpegError(int errnum)
return std::runtime_error(msg);
}
+std::runtime_error
+MakeFfmpegError(int errnum, const char *prefix)
+{
+ char msg[256];
+ av_strerror(errnum, msg, sizeof(msg));
+ return FormatRuntimeError("%s: %s", prefix, msg);
+}
+
void
SetFfmpegError(Error &error, int errnum)
{
diff --git a/src/lib/ffmpeg/Error.hxx b/src/lib/ffmpeg/Error.hxx
index 3a6eb876d..028dffbaa 100644
--- a/src/lib/ffmpeg/Error.hxx
+++ b/src/lib/ffmpeg/Error.hxx
@@ -27,6 +27,9 @@ class Error;
std::runtime_error
MakeFfmpegError(int errnum);
+std::runtime_error
+MakeFfmpegError(int errnum, const char *prefix);
+
void
SetFfmpegError(Error &error, int errnum);