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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_INPUTS 288
  16. #define MAX_OUTPUTS 288
  17. #define MAX_NAME_LEN 64
  18. #define MAX_RUN_CMDS (MAX_INPUTS + (MAX_OUTPUTS * 2))
  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_inputs;
  26. unsigned int num_video_processing_units;
  27. unsigned int num_video_outputs;
  28. unsigned int num_video_monitoring_outputs;
  29. unsigned int num_serial_ports;
  30. };
  31. enum port_lock {
  32. PORT_UNLOCKED,
  33. PORT_LOCKED,
  34. PORT_LOCKED_OTHER,
  35. };
  36. struct input_desc {
  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/
  41. char status[8];
  42. };
  43. struct output_desc {
  44. enum port_lock lock;
  45. char name[MAX_NAME_LEN];
  46. unsigned int routed_to;
  47. char status[8];
  48. };
  49. struct videohub_data {
  50. char *dev_host;
  51. char *dev_port;
  52. int dev_fd;
  53. struct device_desc device;
  54. struct input_desc inputs[MAX_INPUTS];
  55. struct output_desc outputs[MAX_OUTPUTS];
  56. };
  57. extern int debug;
  58. extern int quiet;
  59. #define d(fmt, arguments...) \
  60. do { \
  61. if (debug) \
  62. printf("debug: " fmt, ## arguments); \
  63. } while(0)
  64. #define q(fmt, arguments...) \
  65. do { \
  66. if (!quiet) \
  67. fprintf(stderr, fmt, ## arguments); \
  68. } while(0)
  69. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  70. #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  71. #define UNUSED(x) UNUSED_ ## x __attribute__((unused))
  72. #endif