1 | #ifndef _MODULE_COOLAPI_H_
|
---|
2 | #define _MODULE_COOLAPI_H_
|
---|
3 |
|
---|
4 | #define MAX_COOL_DMX 4
|
---|
5 |
|
---|
6 | typedef struct s_cool_filter {
|
---|
7 | int32_t fd;
|
---|
8 | int32_t channel;
|
---|
9 | int32_t pid;
|
---|
10 | uchar filter16[16];
|
---|
11 | uchar mask16[16];
|
---|
12 | } S_COOL_FILTER;
|
---|
13 |
|
---|
14 | typedef struct s_cool_chanhandle {
|
---|
15 | int32_t pid;
|
---|
16 | void * buffer1;
|
---|
17 | void * buffer2;
|
---|
18 | void * channel;
|
---|
19 | int32_t demux_index;
|
---|
20 | } S_COOL_CHANHANDLE;
|
---|
21 |
|
---|
22 | struct cool_dmx
|
---|
23 | {
|
---|
24 | int32_t opened;
|
---|
25 | int32_t fd;
|
---|
26 | uchar buffer[4096];
|
---|
27 | void * buffer1;
|
---|
28 | void * buffer2;
|
---|
29 | void * channel;
|
---|
30 | void * filter;
|
---|
31 | void * device;
|
---|
32 | int32_t pid;
|
---|
33 | pthread_mutex_t mutex;
|
---|
34 | int32_t demux_index;
|
---|
35 | int32_t demux_id;
|
---|
36 | int32_t filter_num;
|
---|
37 | int32_t type;
|
---|
38 | };
|
---|
39 | typedef struct cool_dmx dmx_t;
|
---|
40 |
|
---|
41 | typedef struct
|
---|
42 | {
|
---|
43 | int32_t type;
|
---|
44 | uint32_t size;
|
---|
45 | int32_t unknown1;
|
---|
46 | int16_t unknown2;
|
---|
47 | int32_t unknown3;
|
---|
48 | int32_t unknown[4];
|
---|
49 | } buffer_open_arg_t;
|
---|
50 |
|
---|
51 | typedef struct
|
---|
52 | {
|
---|
53 | int32_t type;
|
---|
54 | int32_t unknown[2];
|
---|
55 | } channel_open_arg_t;
|
---|
56 |
|
---|
57 | typedef struct
|
---|
58 | {
|
---|
59 | uint32_t number;
|
---|
60 | int32_t unknown1;
|
---|
61 | int32_t unknown2;
|
---|
62 | int32_t unknown3;
|
---|
63 | int32_t unknown4;
|
---|
64 | int32_t unknown5;
|
---|
65 | int32_t unknown6;
|
---|
66 | int32_t unknown[6];
|
---|
67 | } device_open_arg_t;
|
---|
68 |
|
---|
69 | typedef struct
|
---|
70 | {
|
---|
71 | uint32_t length;
|
---|
72 | uint8_t filter[18]; //strange: initialization with max 18 possible but length limited to 12
|
---|
73 | uint8_t mask[18];
|
---|
74 | uint8_t nmask[18];
|
---|
75 | int8_t fvernum;
|
---|
76 | int8_t crcchange;
|
---|
77 | int8_t keeprbytes;
|
---|
78 | int32_t mode;
|
---|
79 | } filter_set_t;
|
---|
80 |
|
---|
81 |
|
---|
82 | typedef enum
|
---|
83 | {
|
---|
84 | CONTINUOUS_ACQUIRE = 0,
|
---|
85 | ONE_SHOT_ACQUIRE,
|
---|
86 | TOGGLE_ACQUIRE
|
---|
87 | } DATA_ACQUIRE_MODE;
|
---|
88 |
|
---|
89 | typedef enum
|
---|
90 | {
|
---|
91 | DATA_ACQUIRED = 1,
|
---|
92 | CHANNEL_TIMEOUT,
|
---|
93 | CRC_ERROR,
|
---|
94 | BUF_OVERFLOW,
|
---|
95 | PES_ERROR,
|
---|
96 | COPY_DONE,
|
---|
97 | CHANNEL_INFO
|
---|
98 | } DATA_ACQUIRE_STATUS;
|
---|
99 |
|
---|
100 | typedef struct
|
---|
101 | {
|
---|
102 | uint32_t PTSLow;
|
---|
103 | uint32_t PTSHi;
|
---|
104 | } DMX_PTS;
|
---|
105 |
|
---|
106 | typedef struct
|
---|
107 | {
|
---|
108 | void * channel;
|
---|
109 | DATA_ACQUIRE_STATUS type;
|
---|
110 | DMX_PTS ptssnapshop;
|
---|
111 | DATA_ACQUIRE_MODE mode;
|
---|
112 | void * buf;
|
---|
113 | uint32_t len;
|
---|
114 | uint32_t num;
|
---|
115 | void * filters[64];
|
---|
116 | void * tags[64];
|
---|
117 | } dmx_callback_data_t;
|
---|
118 |
|
---|
119 | /* These functions are implemented in libnxp */
|
---|
120 | int32_t cnxt_cbuf_open(void **handle, buffer_open_arg_t * arg, void *, void *);
|
---|
121 | int32_t cnxt_dmx_open(void **device, device_open_arg_t *arg, void *, void *);
|
---|
122 | int32_t cnxt_dmx_channel_open(void * device, void **channel, channel_open_arg_t * arg, void * callback, void *);
|
---|
123 | int32_t cnxt_dmx_set_filter(void * handle, filter_set_t * arg, void *);
|
---|
124 |
|
---|
125 | /* Local coolapi functions */
|
---|
126 | void coolapi_open(void);
|
---|
127 | int32_t coolapi_set_filter (int32_t fd, int32_t num, int32_t pid, uchar * flt, uchar * mask, int32_t type);
|
---|
128 | int32_t coolapi_remove_filter (int32_t fd, int32_t num);
|
---|
129 | int32_t coolapi_open_device (int32_t demux_index, int32_t demux_id);
|
---|
130 | int32_t coolapi_close_device(int32_t fd);
|
---|
131 | int32_t coolapi_read(dmx_t * dmx, dmx_callback_data_t * data);
|
---|
132 | int32_t coolapi_write_cw(int32_t mask, uint16_t *STREAMpids, int32_t count, ca_descr_t * ca_descr);
|
---|
133 | int32_t coolapi_set_pid (int32_t demux_id, int32_t num, int32_t idx, int32_t pid);
|
---|
134 |
|
---|
135 | #endif
|
---|