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 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 < MIN(d->device.num_video_outputs, ARRAY_SIZE(d->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. }