-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathm2m.h
72 lines (56 loc) · 1.42 KB
/
m2m.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
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
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#include <assert.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
#include "tools.h"
#include "logging.h"
#include "frame.h"
#include "xioctl.h"
typedef struct {
uint8_t *data;
size_t allocated;
} us_m2m_buffer_s;
typedef struct {
int fd;
us_m2m_buffer_s *input_bufs;
unsigned n_input_bufs;
us_m2m_buffer_s *output_bufs;
unsigned n_output_bufs;
unsigned width;
unsigned height;
unsigned input_format;
unsigned stride;
bool dma;
bool ready;
int last_online;
} us_m2m_encoder_runtime_s;
typedef struct {
char *name;
char *path;
unsigned output_format;
unsigned fps;
unsigned bitrate;
unsigned gop;
unsigned quality;
bool allow_dma;
us_m2m_encoder_runtime_s *run;
} us_m2m_encoder_s;
us_m2m_encoder_s *us_m2m_h264_encoder_init(const char *name, const char *path, unsigned bitrate, unsigned gop);
us_m2m_encoder_s *us_m2m_mjpeg_encoder_init(const char *name, const char *path, unsigned quality);
us_m2m_encoder_s *us_m2m_jpeg_encoder_init(const char *name, const char *path, unsigned quality);
void us_m2m_encoder_destroy(us_m2m_encoder_s *enc);
int us_m2m_encoder_compress(us_m2m_encoder_s *enc, const us_frame_s *src, us_frame_s *dest, bool force_key);
#ifdef __cplusplus
}
#endif