videohubctrl can be used to control Blackmagic Design Videohub SDI router device over the network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

display.c 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * === Display functions ===
  3. *
  4. * Blackmagic Design Videohub control application
  5. * Copyright (C) 2014 Unix Solutions Ltd.
  6. * Written by Georgi Chorbadzhiyski
  7. *
  8. * Released under MIT license.
  9. * See LICENSE-MIT.txt for license terms.
  10. *
  11. */
  12. #include <stdio.h>
  13. #include "data.h"
  14. #include "display.h"
  15. static void printf_line(int len) {
  16. int i;
  17. printf(" ");
  18. for (i = 0; i < len; i++)
  19. printf("-");
  20. printf("\n");
  21. }
  22. void print_device_info(struct videohub_data *d) {
  23. int len = 59;
  24. printf("Device info\n");
  25. printf_line(len);
  26. printf(" | %-26s | %-26s |\n", "Device address", d->dev_host);
  27. printf(" | %-26s | %-26s |\n", "Device port", d->dev_port);
  28. printf(" | %-26s | %-26s |\n", "Model name", d->device.model_name);
  29. printf(" | %-26s | %-26s |\n", "Unique ID", d->device.unique_id);
  30. printf(" | %-26s | %-26s |\n", "Protocol", d->device.protocol_ver);
  31. printf(" | %-26s | %-26u |\n", "Video inputs", d->device.num_video_inputs);
  32. printf(" | %-26s | %-26u |\n", "Video outputs", d->device.num_video_outputs);
  33. if (d->device.num_serial_ports)
  34. printf(" | %-26s | %-26u |\n", "Serial ports", d->device.num_serial_ports);
  35. if (d->device.num_video_processing_units)
  36. printf(" | %-26s | %-26u |\n", "Video processing units", d->device.num_video_processing_units);
  37. if (d->device.num_video_monitoring_outputs)
  38. printf(" | %-26s | %-26u |\n", "Video monitoring outputs", d->device.num_video_monitoring_outputs);
  39. printf_line(len);
  40. printf("\n");
  41. }
  42. void print_device_video_inputs(struct videohub_data *d) {
  43. unsigned int i, len = 33;
  44. printf("Video inputs\n");
  45. printf_line(len);
  46. printf(" | ## | %-24s |\n", "Video input name");
  47. printf_line(len);
  48. for(i = 0; i < d->device.num_video_inputs; i++) {
  49. printf(" | %2d | %-24s |\n",
  50. i + 1,
  51. d->inputs[i].name
  52. );
  53. }
  54. printf_line(len);
  55. printf("\n");
  56. }
  57. void print_device_video_outputs(struct videohub_data *d) {
  58. unsigned int i, len = 64;
  59. printf("Video outputs\n");
  60. printf_line(len);
  61. printf(" | ## | x | %-24s | %-24s |\n", "Video output name", "Connected video input");
  62. printf_line(len);
  63. for(i = 0; i < d->device.num_video_outputs; i++) {
  64. printf(" | %2d | %c | %-24s | %-24s |\n",
  65. i + 1,
  66. d->outputs[i].locked ? (d->outputs[i].locked_other ? 'L' : 'O') : ' ',
  67. d->outputs[i].name,
  68. d->inputs[d->outputs[i].routed_to].name
  69. );
  70. }
  71. printf_line(len);
  72. printf("\n");
  73. }
  74. void print_device_backup(struct videohub_data *d) {
  75. unsigned int i;
  76. printf("videohubctrl \\\n");
  77. for(i = 0; i < d->device.num_video_inputs; i++)
  78. printf(" --vi-name %2d \"%s\" \\\n", i + 1, d->inputs[i].name);
  79. for(i = 0; i < d->device.num_video_outputs; i++)
  80. printf(" --vo-name %2d \"%s\" \\\n", i + 1, d->outputs[i].name);
  81. for(i = 0; i < d->device.num_video_outputs; i++)
  82. printf(" --vo-route %2d %2d \\\n", i + 1, d->outputs[i].routed_to + 1);
  83. for(i = 0; i < d->device.num_video_outputs; i++) {
  84. if (d->outputs[i].locked) {
  85. printf(" --vo-unlock %2d --vo-lock %2d%s\n", i + 1, i + 1,
  86. i + 1 < d->device.num_video_outputs ? " \\" : "");
  87. } else {
  88. printf(" --vo-unlock %2d%s\n", i + 1,
  89. i + 1 < d->device.num_video_outputs ? " \\" : "");
  90. }
  91. }
  92. printf("\n");
  93. }