-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQFC.h
More file actions
87 lines (68 loc) · 2.06 KB
/
QFC.h
File metadata and controls
87 lines (68 loc) · 2.06 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
#ifndef __QFC__
#define __QFC__
#if defined _WIN32 || defined __CYGWIN__ || defined __MINGW32__
// Include Windows specific headers
#include <windows.h>
#ifdef BUILDING_DLL
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllexport))
#else
#define DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
#endif
#else
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllimport))
#else
#define DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
#endif
#endif
#define DLL_LOCAL
#else
#include <pthread.h>
#include <unistd.h>
#if __GNUC__ >= 4
#define DLL_PUBLIC __attribute__ ((visibility ("default")))
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
#else
#define DLL_PUBLIC
#define DLL_LOCAL
#endif
#endif
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <libavutil/pixdesc.h>
#include <libswscale/swscale.h>
// Maximum number of cams that we can process internally.
#define MAX_CAMS 9
// Maximum number of buffered frames
#define MAX_BUFFERED_FRAMES 30
// PUBLIC API
//uint8_t DLL_PUBLIC init();
DLL_PUBLIC int8_t startStreaming(uint8_t camId, const char* rtspAddress, uint32_t width, uint32_t height);
DLL_PUBLIC uint8_t stopStreaming(uint8_t camId);
DLL_PUBLIC size_t getFrameSize(uint8_t camId);
DLL_PUBLIC uint8_t* getFrame(uint8_t camId);
DLL_PUBLIC uint8_t isConnected(uint8_t camId);
DLL_PUBLIC uint8_t isCapturing(uint8_t camId);
// End of PUBLIC API
// PRIVATE API
DLL_LOCAL void* ffmpegStartStreaming(void *arg); // thread function
DLL_LOCAL uint8_t isValidCamId(uint8_t camId);
DLL_LOCAL void launchThread(void *args);
// END PRIVATE API
struct cam_st {
uint8_t camId;
char rtspAddress[255];
uint8_t isConnected;
uint8_t isCapturing;
uint8_t isEOS;
uint32_t requestedWidth;
uint32_t requestedHeight;
};
typedef struct cam_st cam_t;
cam_t cams[MAX_CAMS];
#endif