MX Foundation 4
Channel Class

Accessing a physical ASYNC channel requires a handle to the channel.

A channel handle is a reference to a channel holding a physical resource (port). The channel handle is the first argument to be passed to many MXF channel oriented functions.

To get the handle to an ASYNC physical port regardless of the installed devices, the mxfModuleChannelGet() function may be used by specifying the physical port index.

Alternatively, it is possible to use the mxfModuleChannelAllGet() function with the chnClass argument MXF_CLASS_ASYNC_ENHANCED.

If MXF_DEVICE_ALL is specified with mxfSystemDeviceAllGet() function, all handles of detected devices are returned.

Protocol selection is made with Channel Class attribute.

{
HMXF_SERVER server=0;
HMXF_DEVICE device;
HMXF_MODULE module;
HMXF_CHANNEL rx[4];
uint32 rc;
uint64 deviceCount;
uint64 moduleCount;
uint64 channelCount;
uint64 device = MXF_DEVICE_ALL; // All devices
uint64 moduleType = MXF_MODULE_ASYNC_EH; // ASYNC-ENHANCED module
uint64 chnClass = MXF_CLASS_ASYNC_ENHANCED;// ASYNC ENHANCED channel class
uint64 subClass = MXF_SCLASS_RX_CHANNEL; // RX channel
// Connects to the local server
rc = mxfServerConnect("0.0.0.0", "", "", FALSE, &server);
if (rc)
{
printf("Error connection 0x%08lx", rc);
return rc;
}
// Inits MXF library
rc = mxfSystemInit(server);
if (!rc)
{
// Gets the device handle
rc = mxfSystemDeviceAllGet(server, device, 1, &deviceCount, &device);
if (!rc && deviceCount)
{
// Gets the module handle
rc = mxfDeviceModuleAllGet(device, moduleType, 1, &moduleCount, &module);
// Gets the channel handle
if (!rc && moduleCount)
rc = mxfModuleChannelAllGet(module, chnClass, subClass, 4, &channelCount, rx);
}
}
}


Changing channel class

Depending on the module type, ASYNC channel can by default be configured to another channel class. To configure a channel to ASYNC, an initialization callback set with the mxfSystemInitAttributeUint64CallbackHandler() function can be used.
Since MXF 4.5.2, it is now possible to change the channel class by using mxfAttributeUint64Set() with KMXF_CHANNEL_CLASS attribute instead of using the initialization handler.
It is a good programming practice to not rely on default channel class value (or any other attributes for that matter) and set it to the desired value.

Updated 10/23/2023