|
@@ -105,7 +105,7 @@ bool parse_command(struct videohub_data *data, char *cmd) {
|
105
|
105
|
slot_data[0] = '\0'; // Separate slot_pos from slot_data
|
106
|
106
|
slot_data++;
|
107
|
107
|
slot_pos = strtoul(line, NULL, 10);
|
108
|
|
- if (slot_pos + 1 > data->device.num_video_outputs) {
|
|
108
|
+ if (slot_pos + 1 > data->outputs.num) {
|
109
|
109
|
q("WARNING: %s - invalid slot %u\n", v->txt, slot_pos);
|
110
|
110
|
continue;
|
111
|
111
|
}
|
|
@@ -113,7 +113,7 @@ bool parse_command(struct videohub_data *data, char *cmd) {
|
113
|
113
|
|
114
|
114
|
if (v->flags & PARSE_SLOT_DEST) {
|
115
|
115
|
dest_pos = strtoul(slot_data, NULL, 10);
|
116
|
|
- if (dest_pos + 1 > data->device.num_video_inputs) {
|
|
116
|
+ if (dest_pos + 1 > data->inputs.num) {
|
117
|
117
|
q("WARNING: %s - invalid dest %u\n", v->txt, dest_pos);
|
118
|
118
|
continue;
|
119
|
119
|
}
|
|
@@ -139,13 +139,13 @@ bool parse_command(struct videohub_data *data, char *cmd) {
|
139
|
139
|
snprintf(data->device.unique_id, sizeof(data->device.unique_id) , "%s", p);
|
140
|
140
|
|
141
|
141
|
if ((p = parse_text(line, "Video inputs: ")))
|
142
|
|
- data->device.num_video_inputs = strtoul(p, NULL, 10);
|
|
142
|
+ data->inputs.num = strtoul(p, NULL, 10);
|
143
|
143
|
|
144
|
144
|
if ((p = parse_text(line, "Video processing units: ")))
|
145
|
145
|
data->device.num_video_processing_units = strtoul(p, NULL, 10);
|
146
|
146
|
|
147
|
147
|
if ((p = parse_text(line, "Video outputs: ")))
|
148
|
|
- data->device.num_video_outputs = strtoul(p, NULL, 10);
|
|
148
|
+ data->outputs.num = strtoul(p, NULL, 10);
|
149
|
149
|
|
150
|
150
|
if ((p = parse_text(line, "Video monitoring output: ")))
|
151
|
151
|
data->device.num_video_monitoring_outputs = strtoul(p, NULL, 10);
|
|
@@ -155,31 +155,31 @@ bool parse_command(struct videohub_data *data, char *cmd) {
|
155
|
155
|
break;
|
156
|
156
|
|
157
|
157
|
case CMD_INPUT_LABELS:
|
158
|
|
- snprintf(data->inputs[slot_pos].name, sizeof(data->inputs[slot_pos].name), "%s", slot_data);
|
|
158
|
+ snprintf(data->inputs.port[slot_pos].name, sizeof(data->inputs.port[slot_pos].name), "%s", slot_data);
|
159
|
159
|
break;
|
160
|
160
|
|
161
|
161
|
case CMD_OUTPUT_LABELS:
|
162
|
|
- snprintf(data->outputs[slot_pos].name, sizeof(data->outputs[slot_pos].name), "%s", slot_data);
|
|
162
|
+ snprintf(data->outputs.port[slot_pos].name, sizeof(data->outputs.port[slot_pos].name), "%s", slot_data);
|
163
|
163
|
break;
|
164
|
164
|
|
165
|
165
|
case CMD_VIDEO_INPUT_STATUS:
|
166
|
|
- snprintf(data->inputs[slot_pos].status, sizeof(data->inputs[slot_pos].status), "%s", slot_data);
|
|
166
|
+ snprintf(data->inputs.port[slot_pos].status, sizeof(data->inputs.port[slot_pos].status), "%s", slot_data);
|
167
|
167
|
break;
|
168
|
168
|
|
169
|
169
|
case CMD_VIDEO_OUTPUT_STATUS:
|
170
|
|
- snprintf(data->outputs[slot_pos].status, sizeof(data->outputs[slot_pos].status), "%s", slot_data);
|
|
170
|
+ snprintf(data->outputs.port[slot_pos].status, sizeof(data->outputs.port[slot_pos].status), "%s", slot_data);
|
171
|
171
|
break;
|
172
|
172
|
|
173
|
173
|
case CMD_VIDEO_OUTPUT_LOCKS:
|
174
|
174
|
switch (slot_data[0]) {
|
175
|
|
- case 'O': data->outputs[slot_pos].lock = PORT_LOCKED; break;
|
176
|
|
- case 'L': data->outputs[slot_pos].lock = PORT_LOCKED_OTHER; break;
|
177
|
|
- default : data->outputs[slot_pos].lock = PORT_UNLOCKED; break;
|
|
175
|
+ case 'O': data->outputs.port[slot_pos].lock = PORT_LOCKED; break;
|
|
176
|
+ case 'L': data->outputs.port[slot_pos].lock = PORT_LOCKED_OTHER; break;
|
|
177
|
+ default : data->outputs.port[slot_pos].lock = PORT_UNLOCKED; break;
|
178
|
178
|
}
|
179
|
179
|
break;
|
180
|
180
|
|
181
|
181
|
case CMD_VIDEO_OUTPUT_ROUTING:
|
182
|
|
- data->outputs[slot_pos].routed_to = dest_pos;
|
|
182
|
+ data->outputs.port[slot_pos].routed_to = dest_pos;
|
183
|
183
|
|
184
|
184
|
case CMD_PING:
|
185
|
185
|
case CMD_ACK:
|
|
@@ -221,8 +221,8 @@ int parse_text_buffer(struct videohub_data *data, char *cmd_buffer) {
|
221
|
221
|
// Try to find input/output with certain name, return 0 on not found, pos + 1 is found
|
222
|
222
|
static int search_video_output_name(struct videohub_data *d, char *name) {
|
223
|
223
|
unsigned int i;
|
224
|
|
- for(i = 0; i < d->device.num_video_outputs; i++) {
|
225
|
|
- if (streq(name, d->outputs[i].name)) {
|
|
224
|
+ for(i = 0; i < d->outputs.num; i++) {
|
|
225
|
+ if (streq(name, d->outputs.port[i].name)) {
|
226
|
226
|
return i + 1;
|
227
|
227
|
}
|
228
|
228
|
}
|
|
@@ -231,8 +231,8 @@ static int search_video_output_name(struct videohub_data *d, char *name) {
|
231
|
231
|
|
232
|
232
|
static int search_video_input_name(struct videohub_data *d, char *name) {
|
233
|
233
|
unsigned int i;
|
234
|
|
- for(i = 0; i < d->device.num_video_inputs; i++) {
|
235
|
|
- if (streq(name, d->inputs[i].name)) {
|
|
234
|
+ for(i = 0; i < d->inputs.num; i++) {
|
|
235
|
+ if (streq(name, d->inputs.port[i].name)) {
|
236
|
236
|
return i + 1;
|
237
|
237
|
}
|
238
|
238
|
}
|
|
@@ -255,7 +255,7 @@ void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
|
255
|
255
|
e->port_no2 = my_atoi(e->param2);
|
256
|
256
|
switch (e->cmd) {
|
257
|
257
|
case CMD_INPUT_LABELS:
|
258
|
|
- if (e->port_no1 == 0 || e->port_no1 > d->device.num_video_inputs) {
|
|
258
|
+ if (e->port_no1 == 0 || e->port_no1 > d->inputs.num) {
|
259
|
259
|
e->port_no1 = search_video_input_name(d, e->param1);
|
260
|
260
|
if (!e->port_no1)
|
261
|
261
|
die("Unknown input port number/name: %s", e->param1);
|
|
@@ -263,20 +263,20 @@ void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
|
263
|
263
|
break;
|
264
|
264
|
case CMD_OUTPUT_LABELS:
|
265
|
265
|
case CMD_VIDEO_OUTPUT_LOCKS:
|
266
|
|
- if (e->port_no1 == 0 || e->port_no1 > d->device.num_video_outputs) {
|
|
266
|
+ if (e->port_no1 == 0 || e->port_no1 > d->outputs.num) {
|
267
|
267
|
e->port_no1 = search_video_output_name(d, e->param1);
|
268
|
268
|
if (!e->port_no1)
|
269
|
269
|
die("Unknown output port number/name: %s", e->param1);
|
270
|
270
|
}
|
271
|
|
- e->lock = d->outputs[e->port_no1 - 1].lock;
|
|
271
|
+ e->lock = d->outputs.port[e->port_no1 - 1].lock;
|
272
|
272
|
break;
|
273
|
273
|
case CMD_VIDEO_OUTPUT_ROUTING:
|
274
|
|
- if (e->port_no1 == 0 || e->port_no1 > d->device.num_video_outputs) {
|
|
274
|
+ if (e->port_no1 == 0 || e->port_no1 > d->outputs.num) {
|
275
|
275
|
e->port_no1 = search_video_output_name(d, e->param1);
|
276
|
276
|
if (!e->port_no1)
|
277
|
277
|
die("Unknown output port number/name: %s", e->param1);
|
278
|
278
|
}
|
279
|
|
- if (e->port_no2 == 0 || e->port_no2 > d->device.num_video_inputs) {
|
|
279
|
+ if (e->port_no2 == 0 || e->port_no2 > d->inputs.num) {
|
280
|
280
|
e->port_no2 = search_video_input_name(d, e->param2);
|
281
|
281
|
if (!e->port_no2)
|
282
|
282
|
die("Unknown input port number/name: %s", e->param2);
|
|
@@ -328,14 +328,14 @@ void show_cmd(struct videohub_data *d, struct vcmd_entry *e) {
|
328
|
328
|
case CMD_INPUT_LABELS:
|
329
|
329
|
printf("%srename video input %d - \"%s\" to \"%s\"\n",
|
330
|
330
|
prefix,
|
331
|
|
- e->port_no1, d->inputs[e->port_no1 - 1].name,
|
|
331
|
+ e->port_no1, d->inputs.port[e->port_no1 - 1].name,
|
332
|
332
|
e->param2
|
333
|
333
|
);
|
334
|
334
|
break;
|
335
|
335
|
case CMD_OUTPUT_LABELS:
|
336
|
336
|
printf("%srename video output %d - \"%s\" to \"%s\"\n",
|
337
|
337
|
prefix,
|
338
|
|
- e->port_no1, d->outputs[e->port_no1 - 1].name,
|
|
338
|
+ e->port_no1, d->outputs.port[e->port_no1 - 1].name,
|
339
|
339
|
e->param2
|
340
|
340
|
);
|
341
|
341
|
break;
|
|
@@ -343,14 +343,14 @@ void show_cmd(struct videohub_data *d, struct vcmd_entry *e) {
|
343
|
343
|
printf("%s%s video output %d - \"%s\"\n",
|
344
|
344
|
prefix,
|
345
|
345
|
e->do_lock ? "lock" : (e->lock == PORT_LOCKED_OTHER ? "force unlock" : "unlock"),
|
346
|
|
- e->port_no1, d->outputs[e->port_no1 - 1].name
|
|
346
|
+ e->port_no1, d->outputs.port[e->port_no1 - 1].name
|
347
|
347
|
);
|
348
|
348
|
break;
|
349
|
349
|
case CMD_VIDEO_OUTPUT_ROUTING:
|
350
|
350
|
printf("%sset video output %d \"%s\" to read from input %d \"%s\"\n",
|
351
|
351
|
prefix,
|
352
|
|
- e->port_no1, d->outputs[e->port_no1 - 1].name,
|
353
|
|
- e->port_no2, d->inputs [e->port_no2 - 1].name
|
|
352
|
+ e->port_no1, d->outputs.port[e->port_no1 - 1].name,
|
|
353
|
+ e->port_no2, d->inputs.port [e->port_no2 - 1].name
|
354
|
354
|
);
|
355
|
355
|
break;
|
356
|
356
|
case CMD_VIDEO_INPUT_STATUS:
|