|
@@ -218,21 +218,11 @@ int parse_text_buffer(struct videohub_data *data, char *cmd_buffer) {
|
218
|
218
|
return ok_commands;
|
219
|
219
|
}
|
220
|
220
|
|
221
|
|
-// Try to find input/output with certain name, return 0 on not found, pos + 1 is found
|
222
|
|
-static int search_video_output_name(struct videohub_data *d, char *name) {
|
|
221
|
+// Try to find port with certain name, return 0 on not found, pos + 1 is found
|
|
222
|
+static int get_port_by_name(struct port_set *p, char *name) {
|
223
|
223
|
unsigned int i;
|
224
|
|
- for(i = 0; i < d->outputs.num; i++) {
|
225
|
|
- if (streq(name, d->outputs.port[i].name)) {
|
226
|
|
- return i + 1;
|
227
|
|
- }
|
228
|
|
- }
|
229
|
|
- return 0;
|
230
|
|
-}
|
231
|
|
-
|
232
|
|
-static int search_video_input_name(struct videohub_data *d, char *name) {
|
233
|
|
- unsigned int i;
|
234
|
|
- for(i = 0; i < d->inputs.num; i++) {
|
235
|
|
- if (streq(name, d->inputs.port[i].name)) {
|
|
224
|
+ for(i = 0; i < p->num; i++) {
|
|
225
|
+ if (streq(name, p->port[i].name)) {
|
236
|
226
|
return i + 1;
|
237
|
227
|
}
|
238
|
228
|
}
|
|
@@ -256,7 +246,7 @@ void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
|
256
|
246
|
switch (e->cmd) {
|
257
|
247
|
case CMD_INPUT_LABELS:
|
258
|
248
|
if (e->port_no1 == 0 || e->port_no1 > d->inputs.num) {
|
259
|
|
- e->port_no1 = search_video_input_name(d, e->param1);
|
|
249
|
+ e->port_no1 = get_port_by_name(&d->inputs, e->param1);
|
260
|
250
|
if (!e->port_no1)
|
261
|
251
|
die("Unknown input port number/name: %s", e->param1);
|
262
|
252
|
}
|
|
@@ -264,7 +254,7 @@ void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
|
264
|
254
|
case CMD_OUTPUT_LABELS:
|
265
|
255
|
case CMD_VIDEO_OUTPUT_LOCKS:
|
266
|
256
|
if (e->port_no1 == 0 || e->port_no1 > d->outputs.num) {
|
267
|
|
- e->port_no1 = search_video_output_name(d, e->param1);
|
|
257
|
+ e->port_no1 = get_port_by_name(&d->outputs, e->param1);
|
268
|
258
|
if (!e->port_no1)
|
269
|
259
|
die("Unknown output port number/name: %s", e->param1);
|
270
|
260
|
}
|
|
@@ -272,12 +262,12 @@ void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
|
272
|
262
|
break;
|
273
|
263
|
case CMD_VIDEO_OUTPUT_ROUTING:
|
274
|
264
|
if (e->port_no1 == 0 || e->port_no1 > d->outputs.num) {
|
275
|
|
- e->port_no1 = search_video_output_name(d, e->param1);
|
|
265
|
+ e->port_no1 = get_port_by_name(&d->outputs, e->param1);
|
276
|
266
|
if (!e->port_no1)
|
277
|
267
|
die("Unknown output port number/name: %s", e->param1);
|
278
|
268
|
}
|
279
|
269
|
if (e->port_no2 == 0 || e->port_no2 > d->inputs.num) {
|
280
|
|
- e->port_no2 = search_video_input_name(d, e->param2);
|
|
270
|
+ e->port_no2 = get_port_by_name(&d->inputs, e->param2);
|
281
|
271
|
if (!e->port_no2)
|
282
|
272
|
die("Unknown input port number/name: %s", e->param2);
|
283
|
273
|
}
|