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 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. unsigned int num_serial_ports;
  26. };
  27. enum port_lock {
  28. PORT_UNLOCKED,
  29. PORT_LOCKED,
  30. PORT_LOCKED_OTHER,
  31. };
  32. struct port {
  33. char name[MAX_NAME_LEN];
  34. // Port statuses are supported only by Universal Videohub
  35. // The statuses (actually they are connection types) are:
  36. // BNC, Optical or None /missing port/
  37. char status[8];
  38. unsigned int routed_to;
  39. enum port_lock lock;
  40. };
  41. struct port_set {
  42. unsigned int num;
  43. struct port port[MAX_PORTS];
  44. };
  45. struct videohub_data {
  46. char *dev_host;
  47. char *dev_port;
  48. int dev_fd;
  49. struct device_desc device;
  50. struct port_set inputs;
  51. struct port_set outputs;
  52. struct port_set mon_outputs;
  53. };
  54. extern int debug;
  55. extern int quiet;
  56. #define d(fmt, arguments...) \
  57. do { \
  58. if (debug) \
  59. printf("debug: " fmt, ## arguments); \
  60. } while(0)
  61. #define q(fmt, arguments...) \
  62. do { \
  63. if (!quiet) \
  64. fprintf(stderr, fmt, ## arguments); \
  65. } while(0)
  66. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  67. #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  68. #define UNUSED(x) UNUSED_ ## x __attribute__((unused))
  69. #endif