aja-routing.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #include "aja-props.hpp"
  3. #include "aja-presets.hpp"
  4. #include <ajantv2/includes/ntv2enums.h>
  5. #include <ajantv2/includes/ntv2signalrouter.h>
  6. #include <string>
  7. class CNTV2Card;
  8. namespace aja {
  9. /* The AJA hardware and NTV2 SDK uses a concept called "Signal Routing" to connect high-level firmware
  10. * blocks known as "Widgets" to one another via "crosspoint" connections. This facilitates streaming
  11. * data from one Widget to another to achieve specific functionality.
  12. * Such functionality may include SDI/HDMI capture/output, colorspace conversion, hardware LUTs, etc.
  13. *
  14. * This code references a table of RoutingConfig entries, where each entry contains the settings required
  15. * to configure an AJA device for a particular capture or output task. These settings include the number of
  16. * physical IO Widgets (SDI or HDMI) required, number of framestore Widgets required, register settings
  17. * that must be enabled or disabled, and a special short-hand "route string".
  18. * Of special note is the route string, which is parsed into a map of NTV2XptConnections. These connections
  19. * are then applied as the "signal route", connecting the Widget's crosspoints together.
  20. */
  21. struct RoutingConfig {
  22. NTV2Mode mode; // capture or playout?
  23. uint32_t num_wires; // number of physical connections
  24. uint32_t num_framestores; // number of framestores used
  25. bool enable_3g_out; // enable register for 3G SDI Output?
  26. bool enable_6g_out; // enable register for 6G SDI Output?
  27. bool enable_12g_out; // enable register for 12G SDI Output?
  28. bool convert_3g_in; // enable register for 3G level-B -> level-A SDI input conversion?
  29. bool convert_3g_out; // enable register for 3G level-A -> level-B SDI output conversion?
  30. bool enable_rgb_3ga_convert; // enable register for RGB 3G level-B -> level-A SDI output conversion?
  31. bool enable_3gb_out; // enable register for 3G level-B SDI output?
  32. bool enable_4k_squares; // enable register for 4K square division?
  33. bool enable_8k_squares; // enable register for 8K square division?
  34. bool enable_tsi; // enable register for two-sample interleave (UHD/4K/8K)
  35. std::string route_string; // signal routing shorthand string to parse into crosspoint connections
  36. };
  37. // Applies RoutingConfig settings to the card to configure a specific SDI/HDMI capture/output mode.
  38. class Routing {
  39. public:
  40. static bool ParseRouteString(const std::string &route, NTV2XptConnections &cnx);
  41. static void StartSourceAudio(const SourceProps &props, CNTV2Card *card);
  42. static void StopSourceAudio(const SourceProps &props, CNTV2Card *card);
  43. static bool ConfigureSourceRoute(const SourceProps &props, NTV2Mode mode, CNTV2Card *card,
  44. NTV2XptConnections &cnx);
  45. static bool ConfigureOutputRoute(const OutputProps &props, NTV2Mode mode, CNTV2Card *card,
  46. NTV2XptConnections &cnx);
  47. static void ConfigureOutputAudio(const OutputProps &props, CNTV2Card *card);
  48. static void LogRoutingPreset(const RoutingPreset &rp);
  49. };
  50. } // namespace aja