forked from pixop/video-compare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffmpeg.h
36 lines (31 loc) · 844 Bytes
/
ffmpeg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <array>
#include <stdexcept>
extern "C" {
#include "libavcodec/version.h"
#include "libavutil/avutil.h"
}
const static double AV_TIME_TO_SEC = av_q2d(AV_TIME_BASE_Q);
const static double SEC_TO_AV_TIME = AV_TIME_BASE;
const static double MILLISEC_TO_AV_TIME = SEC_TO_AV_TIME / 1000.0;
namespace ffmpeg {
class Error : public std::runtime_error {
public:
explicit Error(const std::string& message);
explicit Error(int status);
Error(const std::string& file_name, int status);
};
std::string error_string(int error_code);
inline int check(const int status) {
if (status < 0) {
throw ffmpeg::Error{status};
}
return status;
}
inline int check(const std::string& file_name, const int status) {
if (status < 0) {
throw ffmpeg::Error{file_name, status};
}
return status;
}
} // namespace ffmpeg