depend_headers.h
1.4 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
#ifndef __DEPEND_HEADERS_H__
#define __DEPEND_HEADERS_H__
#include <iostream>
#include <utility>
#include <chrono>
#include <thread>
#include <functional>
#include <atomic>
#include <fstream>
#include <signal.h>
#include <time.h>
#include <unistd.h>
#include <set>
#include <mutex>
#include <vector>
#include <condition_variable>
/*
* 依赖模块外部的代码或库
* 不要在此处添加模块内部的头文件
*/
// ffmpeg 是c库 所以编译的时候要加入从 extern导入的C 来声明否则连接失败
extern "C" {
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include <libavutil/opt.h>
#include <libavutil/timestamp.h>
#include <libswscale/swscale.h>
}
#include "../interface/logger.hpp"
#include "../interface/DeviceMemory.hpp"
#include "../interface/interface_headers.h"
#include "../interface/utiltools.hpp"
struct DataPacket {
AVPacket* pkt {nullptr};
unsigned long long frame_nb{0};
bool isKeyFrame{false};
~DataPacket(){
if(pkt != nullptr) {
av_packet_free(&pkt);
pkt = nullptr;
}
}
};
struct DataFrame {
AVFrame* frame {nullptr};
unsigned long long frame_nb{0};
bool isKeyFrame{false};
~DataFrame(){
if(frame != nullptr) {
av_frame_free(&frame);
frame = nullptr;
}
}
};
#endif