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

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