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.4KB

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