input/Plugin: migrate open() from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-09 15:37:06 +02:00
parent 63ab7767a3
commit fc7d3f64c0
44 changed files with 359 additions and 461 deletions

View File

@@ -26,6 +26,14 @@ extern "C" {
#include <libavutil/error.h>
}
std::runtime_error
MakeFfmpegError(int errnum)
{
char msg[256];
av_strerror(errnum, msg, sizeof(msg));
return std::runtime_error(msg);
}
void
SetFfmpegError(Error &error, int errnum)
{

View File

@@ -20,8 +20,13 @@
#ifndef MPD_FFMPEG_ERROR_HXX
#define MPD_FFMPEG_ERROR_HXX
#include <stdexcept>
class Error;
std::runtime_error
MakeFfmpegError(int errnum);
void
SetFfmpegError(Error &error, int errnum);