|
AJA NTV2 SDK
17.1.1.1245
NTV2 SDK 17.1.1.1245
|
Go to the documentation of this file.
16 #define HEX16(__x__) "0x" << hex << setw(16) << setfill('0') << uint64_t(__x__) << dec
17 #define INSTP(_p_) HEX16(uint64_t(_p_))
18 #define LOGGING_ROUTING_CHANGES (AJADebug::IsActive(AJA_DebugUnit_RoutingGeneric))
19 #define ROUTEFAIL(__x__) AJA_sERROR (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
20 #define ROUTEWARN(__x__) AJA_sWARNING(AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
21 #define ROUTENOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
22 #define ROUTEINFO(__x__) AJA_sINFO (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
23 #define ROUTEDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_RoutingGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
26 static const ULWord sMasks[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
43 if (regNum > maxRegNum)
58 if (GetConnectedOutput (outInputXpt, tmpOutputXpt))
59 if (tmpOutputXpt == inOutputXpt)
79 if (GetConnectedOutput (inputXpt, tmpOutputXpt))
80 if (tmpOutputXpt == inOutputXpt)
81 outInputXpts.insert(inputXpt);
83 return !outInputXpts.empty();
90 return Disconnect (inInputXpt);
95 bool canConnect (
true);
98 {
ROUTEFAIL(GetDisplayName() <<
": GetCrosspointSelectGroupRegisterInfo failed, inputXpt=" <<
DEC(inInputXpt));
return false;}
99 if (!regNum || regNum > maxRegNum)
100 {
ROUTEFAIL(GetDisplayName() <<
": GetCrosspointSelectGroupRegisterInfo returned bad register number '" <<
DEC(regNum) <<
"' for inputXpt=" <<
DEC(inInputXpt));
return false;}
102 {
ROUTEFAIL(GetDisplayName() <<
": GetCrosspointSelectGroupRegisterInfo returned bad index '" <<
DEC(ndx) <<
"' for inputXpt=" <<
DEC(inInputXpt));
return false;}
105 if (CanConnect(inInputXpt, inOutputXpt, canConnect))
117 const bool result (WriteRegister(regNum, inOutputXpt,
sMasks[ndx],
sShifts[ndx]));
123 else if (outputXpt && inOutputXpt != outputXpt)
126 else if (!outputXpt && inOutputXpt != outputXpt)
147 if (regNum > maxRegNum)
151 bool changed (
false);
153 changed = ReadRegister(regNum, outputXpt,
sMasks[ndx],
sShifts[ndx]) && outputXpt;
157 if (result && changed)
172 outIsConnected =
false;
173 if (!GetConnectedOutput (inInputXpt, outputID))
176 outIsConnected = outputID == inOutputXpt;
183 bool isConnectedToBlack (
false);
184 if (!IsConnectedTo (inInputXpt,
NTV2_XptBlack, isConnectedToBlack))
187 outIsConnected = !isConnectedToBlack;
194 outCanConnect =
false;
213 {outCanConnect =
true;
return true;}
226 for (uint32_t ndx(0); ndx < 4; ndx++)
230 ReadRegister(regBase + ndx, regVal);
232 ROUTEWARN(GetDisplayName() <<
": GetRouteROMInfoFromReg failed for register " <<
DEC(regBase+ndx)
237 outCanConnect = legalOutputXpts.find(inOutputXpt) != legalOutputXpts.end();
245 if (!ClearRouting ())
252 return WriteRegisters (registerWrites);
258 if (!ClearRouting ())
261 unsigned failures(0);
265 return failures == 0;
270 unsigned failures(0);
272 if (!Disconnect(iter->first))
274 return failures == 0;
282 unsigned nFailures (0);
286 if (*it <= maxRegisterNumber)
288 if (ReadRegister (*it, num))
290 if (!WriteRegister (*it, 0))
294 if (tally && !nFailures)
295 ROUTEINFO(GetDisplayName() <<
": Routing cleared");
297 ROUTEDBG(GetDisplayName() <<
": Routing already clear, nothing changed");
299 ROUTEFAIL(GetDisplayName() <<
": " <<
DEC(nFailures) <<
" register write(s) failed");
300 return nFailures == 0;
314 ROUTEDBG(GetDisplayName() <<
": '" << ::
NTV2DeviceIDToString(GetDeviceID()) <<
"' has " << validWidgets.size() <<
" widgets: " << validWidgets);
328 if (!GetConnectedOutput (*pInputID, outputID))
340 ROUTEDBG(GetDisplayName() <<
": Returning " << outRouting);
347 outConnections.clear();
352 && ReadRegisters(regInfos)
369 if (IS_CHANNEL_INVALID(inChannel))
373 inputXptQueue.push_back(SDIOutInputs[inChannel]);
377 while (!inputXptQueue.empty())
384 inputXptQueue.pop_front();
390 if (!GetConnectedOutput (inputXpt, outputXpt))
402 if (wgtIDs.find(widgetID) == wgtIDs.end())
408 inputXptQueue.push_back(*it);
412 ROUTEDBG(GetDisplayName() <<
": Channel " <<
DEC(inChannel+1) <<
" routing: " << outRouting);
NTV2InputCrosspointQueue::const_iterator NTV2InputCrosspointQueueConstIter
deque< NTV2InputCrosspointID > NTV2InputCrosspointQueue
static bool GetCrosspointSelectGroupRegisterInfo(const NTV2InputCrosspointID inInputXpt, uint32_t &outXptRegNum, uint32_t &outMaskIndex)
Answers with the crosspoint select register and mask information for a given widget input.
virtual bool GetConnections(NTV2XptConnections &outConnections)
Answers with the device's current widget routing connections.
ULWordSetConstIter NTV2RegNumSetConstIter
A const iterator that iterates over a set of distinct NTV2RegisterNumbers.
std::set< NTV2InputXptID > NTV2InputCrosspointIDSet
std::set< NTV2InputXptID > NTV2InputXptIDSet
A collection of distinct NTV2InputXptID values.
@ kDeviceHasXptConnectROM
True if device has a crosspoint connection ROM (New in SDK 17.0)
NTV2XptConnections::const_iterator NTV2XptConnectionsConstIter
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
static const ULWord sShifts[]
NTV2InputCrosspointQueue::iterator NTV2InputCrosspointQueueIter
@ NTV2_FIRST_INPUT_CROSSPOINT
static bool GetConnectionsFromRegs(const NTV2InputXptIDSet &inInputXptIDs, const NTV2RegisterReads &inRegValues, NTV2XptConnections &outConnections)
Converts a set of crosspoint registers into a set of crosspoint connections.
virtual bool GetRegisterWrites(NTV2RegisterWrites &outRegWrites) const
Returns a sequence of NTV2RegInfo values that can be written to an NTV2 device using its WriteRegiste...
static const ULWord sMasks[]
virtual bool IsConnected(const NTV2InputCrosspointID inInputXpt, bool &outIsConnected)
Answers whether or not the given widget signal input (sink) is connected to another output (source).
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
virtual bool ApplySignalRoute(const CNTV2SignalRouter &inRouter, const bool inReplace=(0))
Applies the given routing table to the AJA device.
enum NTV2InputCrosspointID NTV2InputXptID
@ NTV2_OUTPUT_CROSSPOINT_INVALID
static bool GetAllRoutingRegInfos(const NTV2InputXptIDSet &inInputs, NTV2RegisterWrites &outRegInfos)
Returns all routing registers for the given set of input crosspoints.
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
NTV2WidgetIDSet::const_iterator NTV2WidgetIDSetConstIter
An iterator for iterating over a read-only NTV2WidgetIDSet.
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
static bool GetRouteROMInfoFromReg(const ULWord inROMRegNum, const ULWord inROMRegValue, NTV2InputXptID &outInputXpt, NTV2OutputXptIDSet &outOutputXpts, const bool inAppendOutputXpts=false)
Answers with the NTV2InputXptID and NTV2OutputXptIDSet for the given ROM register value.
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay=false)
Declares the CNTV2Card class.
virtual bool IsConnectedTo(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, bool &outIsConnected)
Answers whether or not the given widget signal input (sink) is connected to another output (source).
@ kDeviceGetMaxRegisterNumber
The highest register number for the device.
std::string NTV2InputCrosspointIDToString(const NTV2InputCrosspointID inValue, const bool inForRetailDisplay=false)
NTV2RegWrites NTV2RegisterReads
Declares numerous NTV2 utility functions.
virtual bool Disconnect(const NTV2InputCrosspointID inInputXpt)
Disconnects the given widget signal input (sink) from whatever output (source) it may be connected.
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget's output (...
#define kRegClass_Routing
NTV2InputXptIDSet::const_iterator NTV2InputCrosspointIDSetConstIter
std::set< NTV2OutputXptID > NTV2OutputXptIDSet
A collection of distinct NTV2OutputXptID values.
virtual bool CanConnect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, bool &outCanConnect)
Answers whether or not the given widget signal input (sink) can legally be connected to the given sig...
This class is a collection of widget input-to-output connections that can be applied all-at-once to a...
@ kNTV2EnumsID_WidgetID
Identifies the NTV2AudioWidgetID enumerated type.
#define NTV2_IS_VALID_OutputCrosspointID(__s__)
@ NTV2_INPUT_CROSSPOINT_INVALID
virtual bool RemoveConnections(const NTV2XptConnections &inConnections)
Removes the given widget routing connections from the AJA device.
virtual bool GetConnectedInputs(const NTV2OutputCrosspointID inOutputXpt, NTV2InputCrosspointIDSet &outInputXpts)
Answers with all of the NTV2InputCrosspointIDs that are connected to the given NTV2OutputCrosspointID...
static bool GetWidgetIDs(const NTV2DeviceID inDeviceID, NTV2WidgetIDSet &outWidgets)
Returns the widget IDs supported by the given device.
static bool GetAllWidgetInputs(const NTV2DeviceID inDeviceID, NTV2InputXptIDSet &outInputs)
Returns all known widget input crosspoints for the given device.
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget's input (ident...
virtual bool GetRouting(CNTV2SignalRouter &outRouting)
Answers with the current signal routing between any and all widgets on the AJA device.
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=(0))
Connects the given widget signal input (sink) to the given widget signal output (source).
static NTV2RegNumSet GetRegistersForClass(const std::string &inClassName)
static bool GetWidgetForOutput(const NTV2OutputXptID inOutputXpt, NTV2WidgetID &outWidgetID, const NTV2DeviceID inDeviceID=DEVICE_ID_NOTFOUND)
Returns the widget that "owns" the specified output crosspoint.
std::vector< NTV2RegInfo > NTV2RegisterWrites
std::map< NTV2InputXptID, NTV2OutputXptID > NTV2XptConnections
@ NTV2_LAST_INPUT_CROSSPOINT
@ kRegFirstValidXptROMRegister
#define LOGGING_ROUTING_CHANGES
static bool GetWidgetInputs(const NTV2WidgetID inWidgetID, NTV2InputXptIDSet &outInputs)
Returns the input crosspoints known to be "owned" by the given widget.
@ NTV2_LAST_OUTPUT_CROSSPOINT
enum NTV2OutputCrosspointID NTV2OutputXptID
#define NTV2_IS_VALID_WIDGET(__w__)
std::string NTV2OutputCrosspointIDToString(const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay=false)
#define xHEX0N(__x__, __n__)
virtual bool GetRoutingForChannel(const NTV2Channel inChannel, CNTV2SignalRouter &outRouting)
Answers with the current signal routing for the given channel.
virtual void Reset(void)
Resets me, erasing any/all existing connections.
Declares the CNTV2RegisterExpert class.
std::string NTV2WidgetIDToString(const NTV2WidgetID inValue, const bool inCompactDisplay=false)
virtual bool AddConnection(const NTV2InputXptID inSignalInput, const NTV2OutputXptID inSignalOutput=NTV2_XptBlack)
Adds a connection between a widget's signal input (sink) and another widget's signal output (source).
std::set< NTV2WidgetID > NTV2WidgetIDSet
A collection of distinct NTV2WidgetID values.
Declares the AJADebug class.
virtual bool GetConnectedOutput(const NTV2InputCrosspointID inInputXpt, NTV2OutputCrosspointID &outOutputXpt)
Answers with the currently connected NTV2OutputCrosspointID for the given NTV2InputCrosspointID.
virtual bool GetConnectedInput(const NTV2OutputCrosspointID inOutputXpt, NTV2InputCrosspointID &outInputXpt)
Answers with a connected NTV2InputCrosspointID for the given NTV2OutputCrosspointID.