forked from F5OEO/avc2ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathffmpegsrc.h
More file actions
44 lines (29 loc) · 736 Bytes
/
ffmpegsrc.h
File metadata and controls
44 lines (29 loc) · 736 Bytes
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
#include <string>
#include <memory> // unique_ptr
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
}
class ffmpegsrc {
public:
ffmpegsrc(const std::string& source = "/dev/video0");
~ffmpegsrc();
void GetVideoSize(int& Width,int& Height);
void SetOmxBuffer(unsigned char* Buffer);
bool read_frame(int timeout);
private:
void open_device();
void close_device();
std::string source;
AVFormatContext *format_ctx;
AVCodecContext *codec_ctx;
struct SwsContext *sws_ctx;
AVFrame *frame;
AVFrame *framey420;
uint8_t *OmxBuffer = NULL;
int video_stream;
int len;
};