10
10
11
11
#define FFMPG3_4
12
12
#define FFMPG4_0
13
+ #define FFMPG4_4
13
14
14
- extern " C"
15
- {
16
- #include " libavcodec/avcodec.h"
17
- #include " libavformat/avformat.h"
18
- #include " libswscale/swscale.h"
19
- #include " libavutil/imgutils.h"
20
- #include " libavutil/samplefmt.h"
21
- #include " libavutil/timestamp.h"
22
- #include " libavutil/opt.h"
23
- #include " libavutil/avassert.h"
24
- #include " libavutil/channel_layout.h"
25
- #include " libavutil/opt.h"
26
- #include " libavutil/mathematics.h"
27
- #include " libswresample/swresample.h"
15
+ namespace cmpc {
16
+ extern " C"
17
+ {
18
+ #include " libavcodec/avcodec.h"
19
+ #include " libavformat/avformat.h"
20
+ #include " libswscale/swscale.h"
21
+ #include " libavutil/imgutils.h"
22
+ #include " libavutil/samplefmt.h"
23
+ #include " libavutil/timestamp.h"
24
+ #include " libavutil/opt.h"
25
+ #include " libavutil/avassert.h"
26
+ #include " libavutil/channel_layout.h"
27
+ #include " libavutil/mathematics.h"
28
+ #include " libavutil/time.h"
29
+ #include " libswresample/swresample.h"
30
+ }
28
31
}
29
32
30
- #define MPEGCODER_CURRENT_VERSION " 2.05 "
33
+ #define MPEGCODER_CURRENT_VERSION " 3.0.0 "
31
34
32
- #define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
35
+ #define STREAM_PIX_FMT AVPixelFormat:: AV_PIX_FMT_YUV420P /* default pix_fmt */
33
36
34
37
#define SCALE_FLAGS SWS_BICUBIC
35
38
// SWS_BILINEAR
36
39
37
40
#include < iostream>
38
41
// #include <memory>
39
42
#include < string>
43
+ #include < functional>
40
44
#include < iomanip>
45
+ #include < sstream>
41
46
#include < fstream>
42
47
#include < thread>
43
48
#include < mutex>
44
49
#include < Python.h>
45
- #include < numpy/arrayobject.h>
46
50
using std::string;
47
51
using std::cerr;
48
52
using std::cout;
49
53
using std::endl;
50
54
using std::ostream;
51
55
52
56
#ifdef __cplusplus
57
+ namespace cmpc {
53
58
static const string av_make_error_string2 (int errnum) {
54
59
char errbuf[AV_ERROR_MAX_STRING_SIZE];
55
60
av_strerror (errnum, errbuf, AV_ERROR_MAX_STRING_SIZE);
@@ -66,20 +71,37 @@ using std::ostream;
66
71
}
67
72
#undef av_ts2str
68
73
#define av_ts2str (ts ) av_ts_make_string_cpp(ts).c_str()
69
- static const string av_ts_make_time_string_cpp (int64_t ts, AVRational * tb) {
74
+ static const string av_ts_make_time_string_cpp (int64_t ts, AVRational* tb) {
70
75
char tsstrbuf[AV_TS_MAX_STRING_SIZE];
71
76
av_ts_make_time_string (tsstrbuf, ts, tb);
72
77
string strtsstrbuf = tsstrbuf;
73
78
return strtsstrbuf;
74
79
}
75
80
#undef av_ts2timestr
76
81
#define av_ts2timestr (ts, tb ) av_ts_make_time_string_cpp(ts, tb).c_str()
82
+ }
77
83
#endif // __cplusplus
78
84
85
+ namespace cmpc {
86
+ // a wrapper around a single output AVStream
87
+ typedef struct _OutputStream {
88
+ AVStream* st;
89
+ AVCodecContext* enc;
90
+
91
+ /* pts of the next frame that will be generated */
92
+ int64_t next_frame;
93
+
94
+ AVFrame* frame;
95
+ AVFrame* tmp_frame;
96
+
97
+ struct SwsContext * sws_ctx;
98
+ } OutputStream;
99
+ }
100
+
79
101
// compatibility with newer API
80
102
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
81
103
#define av_frame_alloc avcodec_alloc_frame
82
104
#define av_frame_free avcodec_free_frame
83
105
#endif
84
106
85
- #endif
107
+ #endif
0 commit comments