input/InputStream: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-09 18:47:42 +02:00
parent 597e59f10d
commit 8c744efd56
64 changed files with 440 additions and 473 deletions

View File

@@ -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)
{

View File

@@ -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);