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

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