media_info.h
2.0 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
#define __STDC_LIMIT_MACROS
#include <string>
#include <vector>
#include <stdint.h>
using namespace std;
enum media_type{
mt_audio = 0,
mt_video = 1,
mt_av = 3,
};
enum media_role {
mr_teacher = 0,
mr_student = 1,
};
enum timestamp_type{
tt_start = 0,
tt_end = 1,
};
class media_info {
public:
float type_time;//the time for start or end according to the m_type
float start_time;
int64_t start_time_ms;
float end_time;
int64_t end_time_ms;
string name;
int width;
int height;
int rotate;
float duration;
int index;//index in record info file
int sorted_index;//index according to start time
unsigned int uid;
media_type m_type;
media_role m_role;
timestamp_type t_type;
};
#define __STDC_FORMAT_MACROS
#include <stdint.h>
#include <inttypes.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfiltergraph.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
}
#ifdef ADD_FFMPEG_LIB
#pragma comment(lib, "avcodec.lib")
#pragma comment(lib, "avdevice.lib")
#pragma comment(lib, "avfilter.lib")
#pragma comment(lib, "avformat.lib")
#pragma comment(lib, "avutil.lib")
#pragma comment(lib, "postproc.lib")
#pragma comment(lib, "swresample.lib")
#pragma comment(lib, "swscale.lib")
#define snprintf _snprintf
#define PRIu64 "I64u"
#define PRId64 "I64d"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#endif
typedef struct FilteringContext {
AVFilterContext *buffersink_ctx;
AVFilterContext *buffersrc_ctx;
AVFilterGraph *filter_graph;
} FilteringContext;
#define AFRAME_DURATION_MS 21.333333
#if LIBAVCODEC_VERSION_MAJOR < 57
#define PCM_USING_FLTP_FOR_AAC_ENCODE
#endif
#ifdef PCM_USING_FLTP_FOR_AAC_ENCODE
#define PCM_FORMAT_FOR_AAC_ENCODE AV_SAMPLE_FMT_S16
#else
#define PCM_FORMAT_FOR_AAC_ENCODE AV_SAMPLE_FMT_FLTP
#endif