Browse Source

Add support for --vi-output and --vi-monitor parameters.

Georgi Chorbadzhiyski 9 years ago
parent
commit
e8bfb2bf00
9 changed files with 67 additions and 4 deletions
  1. 2
    0
      ChangeLog
  2. 10
    0
      README
  3. 10
    0
      cmd.c
  4. 1
    0
      cmd.h
  5. 6
    0
      test/run
  6. 7
    4
      test/test-04.ok
  7. 4
    0
      test/test-06.ok
  8. 12
    0
      videohubctrl.1
  9. 15
    0
      videohubctrl.c

+ 2
- 0
ChangeLog View File

2
 xxxx-xx-xx : Version -next
2
 xxxx-xx-xx : Version -next
3
  * Add support for --list-proc-units and --list-frames.
3
  * Add support for --list-proc-units and --list-frames.
4
  * Add support for setting device friendly name using --set-name option.
4
  * Add support for setting device friendly name using --set-name option.
5
+ * Add support for routing inputs to outputs/mon_ports using
6
+  --vi-output and --vi-monitor parameters.
5
 
7
 
6
 2014-12-03 : Version 1.0
8
 2014-12-03 : Version 1.0
7
  * Add missing documentation for --list-moutputs parameter.
9
  * Add missing documentation for --list-moutputs parameter.

+ 10
- 0
README View File

63
 
63
 
64
 Video inputs configuration:
64
 Video inputs configuration:
65
  --vi-name <in_X> <name>    | Set video input port X name.
65
  --vi-name <in_X> <name>    | Set video input port X name.
66
+ --vi-output <in_X> <out_Y> | Route video input X to output Y.
67
+ --vi-monitor <in_X> <mout_Y> | Route video input X to mon port Y.
66
 
68
 
67
 Video outputs configuration:
69
 Video outputs configuration:
68
  --vo-name <out_X> <name>   | Set video output port X name.
70
  --vo-name <out_X> <name>   | Set video output port X name.
150
    videohubctrl -h sdi --vo-input "Output 7" "Windows 4 HD"
152
    videohubctrl -h sdi --vo-input "Output 7" "Windows 4 HD"
151
 
153
 
152
 
154
 
155
+ # Set one input to go out two outputs and two monitoring ports
156
+
157
+   videohubctrl -h sdi --vi-output  "Windows 4 HD" "Output 8" \
158
+                       --vi-output  "Windows 4 HD" "Output 7" \
159
+                       --vi-monitor "Windows 4 HD" "Monitor 1" \
160
+                       --vi-monitor "Windows 4 HD" "Monitor 2"
161
+
162
+
153
  # Run several commands at once
163
  # Run several commands at once
154
  # Rename video input 11 and 12
164
  # Rename video input 11 and 12
155
  # Rename video output 5,
165
  # Rename video output 5,

+ 10
- 0
cmd.c View File

506
 			);
506
 			);
507
 			break;
507
 			break;
508
 		}
508
 		}
509
+		if (e->reversed_args) {
510
+			printf("%sset %s %d \"%s\" to go out of %s %d \"%s\"\n",
511
+				prefix,
512
+				e->cmd->port_id2,
513
+				e->p2.port_no + 1, d_port->port[e->p2.port_no].name,
514
+				e->cmd->port_id1,
515
+				e->p1.port_no + 1, s_port->port [e->p1.port_no].name
516
+			);
517
+			break;
518
+		}
509
 		printf("%sset %s %d \"%s\" to read from %s %d \"%s\"\n",
519
 		printf("%sset %s %d \"%s\" to read from %s %d \"%s\"\n",
510
 			prefix,
520
 			prefix,
511
 			e->cmd->port_id1,
521
 			e->cmd->port_id1,

+ 1
- 0
cmd.h View File

83
 	enum port_lock	lock;
83
 	enum port_lock	lock;
84
 	enum serial_dir	direction;
84
 	enum serial_dir	direction;
85
 	bool			clear_port;
85
 	bool			clear_port;
86
+	bool			reversed_args;
86
 };
87
 };
87
 
88
 
88
 void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e);
89
 void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e);

+ 6
- 0
test/run View File

34
 videohubctrl --test-input test/input-00.txt \
34
 videohubctrl --test-input test/input-00.txt \
35
 	--set-name "Test name" \
35
 	--set-name "Test name" \
36
 	--vi-name "Windows 4 HD" "Windows 4 HighDef" \
36
 	--vi-name "Windows 4 HD" "Windows 4 HighDef" \
37
+	--vi-output "Windows 1" "Output 15" \
38
+	--vi-monitor "Windows 3" "Monitor 1" \
37
 	--vi-name 5 "In 5" \
39
 	--vi-name 5 "In 5" \
38
 	--vi-name "Input 6" "Camera 6" \
40
 	--vi-name "Input 6" "Camera 6" \
39
 	--vo-name "Enc1 1" "Encoder 1" \
41
 	--vo-name "Enc1 1" "Encoder 1" \
82
 ./videohubctrl --test-input test/input-00.txt --vi-name "Input 18"  "Test Input 18"  $@ >> test/test-06.out 2>&1
84
 ./videohubctrl --test-input test/input-00.txt --vi-name "Input 18"  "Test Input 18"  $@ >> test/test-06.out 2>&1
83
 ./videohubctrl --test-input test/input-00.txt --vo-name 18          "Test Output 18" $@ >> test/test-06.out 2>&1
85
 ./videohubctrl --test-input test/input-00.txt --vo-name 18          "Test Output 18" $@ >> test/test-06.out 2>&1
84
 ./videohubctrl --test-input test/input-00.txt --vo-name "Output 18" "Test Output 18" $@ >> test/test-06.out 2>&1
86
 ./videohubctrl --test-input test/input-00.txt --vo-name "Output 18" "Test Output 18" $@ >> test/test-06.out 2>&1
87
+./videohubctrl --test-input test/input-00.txt --vi-output "Input 22" "Output 15"     $@ >> test/test-06.out 2>&1
88
+./videohubctrl --test-input test/input-00.txt --vi-output "Input 14" "Output 22"     $@ >> test/test-06.out 2>&1
89
+./videohubctrl --test-input test/input-00.txt --vi-monitor "Input 22" "Monitor 3"    $@ >> test/test-06.out 2>&1
90
+./videohubctrl --test-input test/input-00.txt --vi-monitor "Input 14" "Monitor 33"   $@ >> test/test-06.out 2>&1
85
 ./videohubctrl --test-input test/input-00.txt --vo-lock 18                           $@ >> test/test-06.out 2>&1
91
 ./videohubctrl --test-input test/input-00.txt --vo-lock 18                           $@ >> test/test-06.out 2>&1
86
 ./videohubctrl --test-input test/input-00.txt --vo-lock "Output 18"                  $@ >> test/test-06.out 2>&1
92
 ./videohubctrl --test-input test/input-00.txt --vo-lock "Output 18"                  $@ >> test/test-06.out 2>&1
87
 ./videohubctrl --test-input test/input-00.txt --vo-unlock 18                         $@ >> test/test-06.out 2>&1
93
 ./videohubctrl --test-input test/input-00.txt --vo-unlock 18                         $@ >> test/test-06.out 2>&1

+ 7
- 4
test/test-04.ok View File

1
 videohub: set device "Friendly name" to "Test name"
1
 videohub: set device "Friendly name" to "Test name"
2
 videohub: rename video input 4 "Windows 4 HD" to "Windows 4 HighDef"
2
 videohub: rename video input 4 "Windows 4 HD" to "Windows 4 HighDef"
3
+videohub: set video input 1 "Windows 1" to go out of video output 15 "Output 15"
4
+videohub: set video input 3 "Windows 3" to go out of monitoring output 1 "Monitor 1"
3
 videohub: rename video input 5 "Input 5" to "In 5"
5
 videohub: rename video input 5 "Input 5" to "In 5"
4
 videohub: rename video input 6 "Input 6" to "Camera 6"
6
 videohub: rename video input 6 "Input 6" to "Camera 6"
5
 videohub: rename video output 1 "Enc1 1" to "Encoder 1"
7
 videohub: rename video output 1 "Enc1 1" to "Encoder 1"
66
   ----------------------------------------------------------------------
68
   ----------------------------------------------------------------------
67
   | ### | Video input name         | nn | Routed to output         | s |
69
   | ### | Video input name         | nn | Routed to output         | s |
68
   ----------------------------------------------------------------------
70
   ----------------------------------------------------------------------
69
-  |   1 | Windows 1                |  2 | Enc1 3                   | B |
71
+  |   1 | Windows 1                |  3 | Enc1 3                   | B |
70
   |     |                          |    | Enc1 4                   |   |
72
   |     |                          |    | Enc1 4                   |   |
73
+  |     |                          |    | Output 15                |   |
71
   |   2 | Windows 2                |  1 | Enc1 2                   | B |
74
   |   2 | Windows 2                |  1 | Enc1 2                   | B |
72
   |   3 | Windows 3                |  2 | Encoder 1                | B |
75
   |   3 | Windows 3                |  2 | Encoder 1                | B |
73
   |     |                          |    | Output 5                 |   |
76
   |     |                          |    | Output 5                 |   |
83
   |  12 | DPlay1                   |  1 | Output 13                |   |
86
   |  12 | DPlay1                   |  1 | Output 13                |   |
84
   |  13 | DPlay2                   |  1 | Denc                     |   |
87
   |  13 | DPlay2                   |  1 | Denc                     |   |
85
   |  14 | Input 14                 |  1 | Output 14                | x |
88
   |  14 | Input 14                 |  1 | Output 14                | x |
86
-  |  15 | Input 15                 |  1 | Output 15                | x |
89
+  |  15 | Input 15                 |  0 | -                        | x |
87
   |  16 | Loopback                 |  1 | Dev-Lo                   |   |
90
   |  16 | Loopback                 |  1 | Dev-Lo                   |   |
88
   ----------------------------------------------------------------------
91
   ----------------------------------------------------------------------
89
 
92
 
105
   |  12 |   | Denc                     | DPlay2                   | B |
108
   |  12 |   | Denc                     | DPlay2                   | B |
106
   |  13 | O | Output 13                | DPlay1                   | o |
109
   |  13 | O | Output 13                | DPlay1                   | o |
107
   |  14 |   | Output 14                | Input 14                 | o |
110
   |  14 |   | Output 14                | Input 14                 | o |
108
-  |  15 | O | Output 15                | Input 15                 | o |
111
+  |  15 | O | Output 15                | Windows 1                | o |
109
   |  16 | O | Dev-Lo                   | Loopback                 | o |
112
   |  16 | O | Dev-Lo                   | Loopback                 | o |
110
   ---------------------------------------------------------------------
113
   ---------------------------------------------------------------------
111
 
114
 
113
   -----------------------------------------------------------------
116
   -----------------------------------------------------------------
114
   | ### | x | Monitoring output name   | Connected video input    |
117
   | ### | x | Monitoring output name   | Connected video input    |
115
   -----------------------------------------------------------------
118
   -----------------------------------------------------------------
116
-  |   1 |   | PC 1 Mon                 | Windows 1                |
119
+  |   1 |   | PC 1 Mon                 | Windows 3                |
117
   |   2 |   | Monitor 2                | Windows 2                |
120
   |   2 |   | Monitor 2                | Windows 2                |
118
   |   3 | L | Loopback                 | Loopback                 |
121
   |   3 | L | Loopback                 | Loopback                 |
119
   |   4 | O | Decklink                 | Windows 4 HighDef        |
122
   |   4 | O | Decklink                 | Windows 4 HighDef        |

+ 4
- 0
test/test-06.ok View File

3
 ERROR: Unknown video input port number/name: Input 18
3
 ERROR: Unknown video input port number/name: Input 18
4
 ERROR: Unknown video output port number/name: 18
4
 ERROR: Unknown video output port number/name: 18
5
 ERROR: Unknown video output port number/name: Output 18
5
 ERROR: Unknown video output port number/name: Output 18
6
+ERROR: Unknown video input port number/name: Input 22
7
+ERROR: Unknown video output port number/name: Output 22
8
+ERROR: Unknown video input port number/name: Input 22
9
+ERROR: Unknown monitoring output port number/name: Monitor 33
6
 ERROR: Unknown video output port number/name: 18
10
 ERROR: Unknown video output port number/name: 18
7
 ERROR: Unknown video output port number/name: Output 18
11
 ERROR: Unknown video output port number/name: Output 18
8
 ERROR: Unknown video output port number/name: 18
12
 ERROR: Unknown video output port number/name: 18

+ 12
- 0
videohubctrl.1 View File

107
 .TP
107
 .TP
108
 \fB\-\-vi\-name\fR <in_X> <name>
108
 \fB\-\-vi\-name\fR <in_X> <name>
109
 Set video input port X name.
109
 Set video input port X name.
110
+.TP
111
+\fB\-\-vi\-output\fR <in_X> <out_Y>
112
+Set video input X to be outputted via output Y.
113
+.TP
114
+\fB\-\-vi\-monitor\fR <in_X> <mout_Y>
115
+Set video input X to be outputted via monitoring port Y.
110
 .SH VIDEO OUTPUTS CONFIGURATION
116
 .SH VIDEO OUTPUTS CONFIGURATION
111
 .PP
117
 .PP
112
 .TP
118
 .TP
247
    videohubctrl -h sdi --vo-input "Output 8" "Windows 4 HD"
253
    videohubctrl -h sdi --vo-input "Output 8" "Windows 4 HD"
248
    videohubctrl -h sdi --vo-input "Output 7" "Windows 4 HD"
254
    videohubctrl -h sdi --vo-input "Output 7" "Windows 4 HD"
249
 
255
 
256
+ # Set one input to go out two outputs and two monitoring ports
257
+   videohubctrl -h sdi --vi-output  "Windows 4 HD" "Output 8" \\
258
+                       --vi-output  "Windows 4 HD" "Output 7" \\
259
+                       --vi-monitor "Windows 4 HD" "Monitor 1" \\
260
+                       --vi-monitor "Windows 4 HD" "Monitor 2"
261
+
250
  # Run several commands at once
262
  # Run several commands at once
251
  # Rename video input 11 and 12
263
  # Rename video input 11 and 12
252
  # Rename video output 5,
264
  # Rename video output 5,

+ 15
- 0
videohubctrl.c View File

71
 	{ "list-frames",		no_argument,       NULL, 907 },
71
 	{ "list-frames",		no_argument,       NULL, 907 },
72
 	{ "set-name",			required_argument, NULL, 950 },
72
 	{ "set-name",			required_argument, NULL, 950 },
73
 	{ "vi-name",			required_argument, NULL, 1001 },
73
 	{ "vi-name",			required_argument, NULL, 1001 },
74
+	{ "vi-output",			required_argument, NULL, 1002 },
75
+	{ "vi-monitor",			required_argument, NULL, 1003 },
74
 	{ "vo-name",			required_argument, NULL, 2001 },
76
 	{ "vo-name",			required_argument, NULL, 2001 },
75
 	{ "vo-input",			required_argument, NULL, 2002 },
77
 	{ "vo-input",			required_argument, NULL, 2002 },
76
 	{ "vo-route",			required_argument, NULL, 2002 }, // Alias of --vo-input
78
 	{ "vo-route",			required_argument, NULL, 2002 }, // Alias of --vo-input
135
 	printf("\n");
137
 	printf("\n");
136
 	printf("Video inputs configuration:\n");
138
 	printf("Video inputs configuration:\n");
137
 	printf(" --vi-name <in_X> <name>    | Set video input port X name.\n");
139
 	printf(" --vi-name <in_X> <name>    | Set video input port X name.\n");
140
+	printf(" --vi-output <in_X> <out_Y> | Route video input X to output Y.\n");
141
+	printf(" --vi-monitor <in_X> <mout_Y> | Route video input X to mon port Y.\n");
138
 	printf("\n");
142
 	printf("\n");
139
 	printf("Video outputs configuration:\n");
143
 	printf("Video outputs configuration:\n");
140
 	printf(" --vo-name <out_X> <name>   | Set video output port X name.\n");
144
 	printf(" --vo-name <out_X> <name>   | Set video output port X name.\n");
236
 	num_parsed_cmds++;
240
 	num_parsed_cmds++;
237
 }
241
 }
238
 
242
 
243
+static void switch_cmd_args(void) {
244
+	char *p1, *p2;
245
+	parsed_cmds.entry[num_parsed_cmds-1].reversed_args = 1;
246
+	p1 = parsed_cmds.entry[num_parsed_cmds-1].p1.param;
247
+	p2 = parsed_cmds.entry[num_parsed_cmds-1].p2.param;
248
+	parsed_cmds.entry[num_parsed_cmds-1].p1.param = p2;
249
+	parsed_cmds.entry[num_parsed_cmds-1].p2.param = p1;
250
+}
251
+
239
 static void parse_options(struct videohub_data *data, int argc, char **argv) {
252
 static void parse_options(struct videohub_data *data, int argc, char **argv) {
240
 	int j, err = 0;
253
 	int j, err = 0;
241
 	// Check environment
254
 	// Check environment
295
 			case 907: show_list |= action_list_frames; break; // --list-frames
308
 			case 907: show_list |= action_list_frames; break; // --list-frames
296
 			case 950: set_device_option("Friendly name", optarg); break; // --set-name
309
 			case 950: set_device_option("Friendly name", optarg); break; // --set-name
297
 			case 1001: parse_cmd2(argc, argv, CMD_INPUT_LABELS); break; // --vi-name
310
 			case 1001: parse_cmd2(argc, argv, CMD_INPUT_LABELS); break; // --vi-name
311
+			case 1002: parse_cmd2(argc, argv, CMD_VIDEO_OUTPUT_ROUTING); switch_cmd_args(); break; // --vi-output
312
+			case 1003: parse_cmd2(argc, argv, CMD_MONITORING_OUTPUT_ROUTING); switch_cmd_args(); break; // --vi-monitor
298
 			case 2001: parse_cmd2(argc, argv, CMD_OUTPUT_LABELS); break; // --vo-name
313
 			case 2001: parse_cmd2(argc, argv, CMD_OUTPUT_LABELS); break; // --vo-name
299
 			case 2002: parse_cmd2(argc, argv, CMD_VIDEO_OUTPUT_ROUTING); break; // --vo-input
314
 			case 2002: parse_cmd2(argc, argv, CMD_VIDEO_OUTPUT_ROUTING); break; // --vo-input
300
 			case 2003: parse_cmd1(argc, argv, CMD_VIDEO_OUTPUT_LOCKS, true); break; // --vo-lock
315
 			case 2003: parse_cmd1(argc, argv, CMD_VIDEO_OUTPUT_LOCKS, true); break; // --vo-lock

Loading…
Cancel
Save