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

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