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.

cmd.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * === Commands processing ===
  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 CMD_H
  13. #define CMD_H
  14. #include <stdbool.h>
  15. #define NUM_COMMANDS 14
  16. enum vcmd {
  17. CMD_PROTOCOL_PREAMBLE,
  18. CMD_VIDEOHUB_DEVICE,
  19. CMD_INPUT_LABELS,
  20. CMD_OUTPUT_LABELS,
  21. CMD_VIDEO_OUTPUT_LOCKS,
  22. CMD_VIDEO_OUTPUT_ROUTING,
  23. CMD_VIDEO_INPUT_STATUS,
  24. CMD_VIDEO_OUTPUT_STATUS,
  25. CMD_MONITORING_OUTPUT_LABELS,
  26. CMD_MONITORING_OUTPUT_LOCKS,
  27. CMD_MONITORING_OUTPUT_ROUTING,
  28. CMD_PING,
  29. CMD_ACK,
  30. CMD_NAK = (NUM_COMMANDS - 1),
  31. };
  32. enum cmd_flags {
  33. PARSE_NONE, /* The result if this command needs no parsing */
  34. PARSE_CUSTOM, /* Use custom parser for this command */
  35. PARSE_LABEL, /* Parse [port_num] [port_text] */
  36. PARSE_STATUS, /* Parse [port_num] [port_status] */
  37. PARSE_ROUTE, /* Parse [port_num] [dest_port] */
  38. PARSE_LOCK, /* Parse [port_num] [dest_slot] */
  39. };
  40. struct videohub_commands {
  41. enum vcmd cmd;
  42. enum cmd_flags type;
  43. size_t ports1;
  44. size_t ports2;
  45. const char *port_id1;
  46. const char *port_id2;
  47. const char *opt_prefix;
  48. };
  49. extern struct videohub_commands videohub_commands[NUM_COMMANDS];
  50. bool parse_command(struct videohub_data *d, char *cmd);
  51. int parse_text_buffer(struct videohub_data *data, char *cmd_buffer);
  52. struct vcmd_entry {
  53. struct videohub_commands *cmd;
  54. char *param1;
  55. char *param2;
  56. unsigned int port_no1;
  57. unsigned int port_no2;
  58. bool do_lock;
  59. enum port_lock lock;
  60. };
  61. void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e);
  62. void format_cmd_text(struct vcmd_entry *e, char *buf, unsigned int bufsz);
  63. void show_cmd(struct videohub_data *d, struct vcmd_entry *e);
  64. #endif