10#include <system_error>
31 CodecInvalidDirection,
36 CodecInvalidDecodeProc,
37 CodecInvalidEncodeProc,
38 CodecDecodingOffsetToLarge,
39 CodecInvalidForEncode,
40 CodecInvalidForDecoce,
41 CodecInvalidMediaType,
50 FormatNullOutputFormat,
51 FormatWrongCountOfStreamOptions,
53 FormatInvalidStreamIndex,
55 FormatInvalidDirection,
56 FormatHeaderNotWriten,
57 FormatCodecUnsupported,
59 ResamplerInvalidParameters,
61 ResamplerInputChanges,
62 ResamplerOutputChanges,
64 RescalerInvalidParameters,
65 RescalerInternalSwsError,
67 FilterNotInFilterGraph,
68 FilterGraphDescriptionEmpty,
70 IncorrectBufferSrcFilter,
71 IncorrectBufferSrcMediaType,
73 IncorrectBufferSinkFilter,
74 IncorrectBufferSinkMediaType,
77 CodecUnsupportedOperation,
79 HardwareDeviceUnavailable,
80 HardwareDeviceInvalid,
81 HardwareConfigNotFound,
82 HardwareFramesInvalid,
83 HardwareTransferUnsupported,
84 HardwareCodecNotFound,
95class OptionalErrorCode
97 OptionalErrorCode() {}
112 static OptionalErrorCode
null();
119 operator bool()
const;
129 std::error_code *m_ec =
nullptr;
141 using std::system_error::system_error;
157 const char *
name() const noexcept override;
175 virtual const char *name()
const noexcept override;
176 virtual std::string message(
int ev)
const override;
251 return std::error_condition(
static_cast<int>(code),
avcpp_category());
280template<
typename Exception = av::Exception>
293template<
typename Exception = av::Exception>
322template<
typename Category,
typename Exception = av::Exception>
326 *ec = std::error_code(errcode, cat);
328 throw Exception(std::error_code(errcode, cat));
331template<
typename T,
typename Exception = av::Exception>
354static inline void throws_if(OptionalErrorCode ec,
const std::error_code& errcode)
359 throw Exception(errcode);
385 return static_cast<bool>(*ec);
393template<>
struct is_error_condition_enum<
av::Errors> :
public true_type {};
The AvcppCategory class Describes internal AvCpp errors.
Definition averror.h:149
std::string message(int ev) const override
Text for an error value.
const char * name() const noexcept override
Name of the category.
The AvException class Default exception that thows from function that does not accept error code stor...
Definition averror.h:139
The FfmpegCategory class Describers FFmpeg internal errors.
Definition averror.h:174
Carries the caller's choice between exceptions and error codes.
Definition averror.h:96
std::error_code & operator*()
The caller's variable.
OptionalErrorCode(std::error_code &ec)
Report errors through the given variable.
static OptionalErrorCode null()
The value that means "the caller wants no error code".
Root namespace of the library.
Definition audioresampler.h:19
void clear_if(OptionalErrorCode ec)
clear_if - clear error code if it is not av::throws()
Definition averror.h:368
void throw_error_code(const std::error_code &ec)
Throw an exception carrying the given error code.
Definition averror.h:288
bool is_error(OptionalErrorCode ec)
Whether an error was stored in the caller's variable.
Definition averror.h:382
std::error_code make_avcpp_error(Errors code)
Build an error code from an avcpp error.
Definition averror.h:236
std::error_code make_error_code(av::Errors errc) noexcept
Build an error code from an avcpp error.
Definition averror.h:223
std::error_condition make_ffmpeg_condition(int code)
Build an error condition from an FFmpeg return value.
Definition averror.h:275
std::error_code make_ffmpeg_error(int code)
Build an error code from an FFmpeg return value.
Definition averror.h:262
Errors
Errors the library raises itself, as opposed to FFmpeg's return codes.
Definition averror.h:23
FfmpegCategory & ffmpeg_category()
Error category that wraps FFmpeg return codes.
Definition averror.h:196
const AvcppCategory & avcpp_category()
Error category of the library's own errors.
Definition averror.h:185
std::error_condition make_error_condition(av::Errors errc) noexcept
Build an error condition from an avcpp error.
Definition averror.h:210
void throws_if(OptionalErrorCode ec, int errcode, const Category &cat)
Throw or store an error, depending on what the caller passed.
Definition averror.h:323
std::error_condition make_avcpp_condition(Errors code)
Build an error condition from an avcpp error.
Definition averror.h:249