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.

data.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * === Main data structures and helpers ===
  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. #ifndef DATA_H
  13. #define DATA_H
  14. #include <stdbool.h>
  15. #define MAX_PORTS 288
  16. #define MAX_NAME_LEN 32
  17. #define MAX_RUN_CMDS (288 * 5)
  18. #define NO_PORT ((unsigned int) -1)
  19. struct device_desc {
  20. bool dev_present;
  21. bool needs_fw_update;
  22. char protocol_ver[16];
  23. char model_name[MAX_NAME_LEN];
  24. char friendly_name[MAX_NAME_LEN];
  25. char unique_id[MAX_NAME_LEN];
  26. };
  27. enum port_status {
  28. S_UNKNOWN,
  29. S_NONE,
  30. S_BNC,
  31. S_OPTICAL,
  32. S_THUNDERBOLT,
  33. S_RS422,
  34. };
  35. enum port_lock {
  36. PORT_UNLOCKED,
  37. PORT_LOCKED,
  38. PORT_LOCKED_OTHER,
  39. };
  40. enum serial_dir {
  41. DIR_CONTROL,
  42. DIR_SLAVE,
  43. DIR_AUTO,
  44. };
  45. struct port {
  46. char name[MAX_NAME_LEN];
  47. // Port statuses are supported only by Universal Videohub
  48. // The statuses (actually they are connection types) are:
  49. // BNC, Optical or None /missing port/ - for input/output
  50. // RS422, None - for serial ports
  51. enum port_status status;
  52. // For serial ports.
  53. // The values are:
  54. // control - In (Workstation)
  55. // slave - Out (Deck)
  56. // auto - Automatic
  57. enum serial_dir direction;
  58. unsigned int routed_to;
  59. enum port_lock lock;
  60. };
  61. struct port_set {
  62. unsigned int num;
  63. struct port port[MAX_PORTS];
  64. };
  65. struct videohub_data {
  66. char *dev_host;
  67. char *dev_port;
  68. int dev_fd;
  69. struct device_desc device;
  70. struct port_set inputs;
  71. struct port_set outputs;
  72. struct port_set mon_outputs;
  73. struct port_set serial;
  74. struct port_set proc_units;
  75. struct port_set frames;
  76. };
  77. extern int debug;
  78. extern int quiet;
  79. #define d(fmt, arguments...) \
  80. do { \
  81. if (debug) \
  82. printf("debug: " fmt, ## arguments); \
  83. } while(0)
  84. #define q(fmt, arguments...) \
  85. do { \
  86. if (!quiet) \
  87. fprintf(stderr, fmt, ## arguments); \
  88. } while(0)
  89. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  90. #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  91. #define UNUSED(x) UNUSED_ ## x __attribute__((unused))
  92. #endif