The work with IP-based devices is similar to MFLive (MLive) and MFRenderer (MRenderer) objects. The specific one is the way of setting the device properties and how to pass the properties to the device from the SDK objects.
JSON configuration
All the device configuration is done in a JSON file. You can find a reference attached to the article.
The structure is the following:
{
"protocol":"2110",
"network2110":
{ // this part configures the parameters of the device itself, the connectors (SFP) with IP configurations
"ptpPreferredGMID":"00-00-00-00-00-00-00-00",
"ptpDomain":0,
"setup4k":"false",
"multiSDP":"false",
"audioCombine":"false",
"rxMatchOverride":0,
"sfps":
[ // the configuration itself for each of the connectors
{
"designator":"sfp1",
"ipAddress":"192.16.45.8",
"subnetMask":"255.255.0.0",
"gateWay":"255.255.255.255",
"enable":"true"
},
{
"designator":"sfp2",
"ipAddress":"192.16.45.9",
"subnetMask":"255.255.0.0",
"gateWay":"255.255.255.255",
"enable":"true"
}
]
},
"receiveVideo2110":
[ // this part is to receive a video feed where you set the connector, the source address
// and its port for both the connectors.
{
"stream":"video1",
...
},
{
"stream":"video2",
...
}
],
"receiveAudio2110":
[ // this part is to receive an audio feed where you set the connector, the source address
// and its port for both the connectors.
{
"stream":"audio1",
...
},
{
"stream":"audio2",
...
}
],
"receiveAnc2110":
[ // this part is to receive the ancillary data where you set the connector, the source address
// and its port for both the connectors.
{
"stream":"anc1",
...
},
{
"stream":"anc2",
...
}
],
"transmitVideo2110":
[ // this part is to send a video signal where you set the connector, the destination address
// and its port for both the connectors.
{
"stream":"video3",
...
},
{
"stream":"video4",
...
}
],
"transmitAudio2110":
[ // this part is to send an audio signal where you set the connector, the destination address
// and its port for both the connectors.
{
"stream":"audio3",
...
},
{
"stream":"audio4",
....
}
],
"transmitAnc2110":
[ // this part is to send ancilary data where you set the connector, the destination address
// and its port for both the connectors.
{
"stream":"anc3",
...
},
{
"stream":"anc4",
...
}
]
}
You don't need to set the video format in the configuration as it is used from the SDK. For example, if you work with HD1080p30, you don't need to specify it in the JSON configuration.
The most important settings are the IP addresses for the SFP connectors at the beginning of the configuration and the addresses of the sources and destinations for the "transmit" and the "receive" parts.
Configuration of objects
To start working with the device, you should set a path to the actual JSON file. The default path is located in the system registry:
HKEY_CURRENT_USER\Software\Medialooks\MFormats\MFLive\AJA2\
aja.ip_config = path_to_file
HKEY_CURRENT_USER\Software\Medialooks\MFormats\MFRenderer\AJA2\
aja.ip_config = path_to_file
To set the property from a code, you should use the "runtime::" prefix:
m_objMLive = new MLiveClass();
m_objMLive.PropsSet("runtime::aja.ip_config", @"path_or_JSON_string");
You can use a full JSON string instead of the file path in this case.
Note please that the number of inputs and outputs is defined by the configuration when you set it.
To check if the JSON configuration is set properly and to get the configuration itself, you should use the following:
m_objMLive.PropsGet("device::aja.ip_config.state", out strState);
m_objMLive.PropsGet("device::aja.ip_config.string", out strString);
The strState can be "valid" and "not_valid" that indicates if the JSON configuration was parsed properly. If the state is "valid" the strString contains the full configuration.
You can dynamically change the configuration for the live source with this code:
m_objMLive.PropsSet("device::aja.ip_config", @"path_or_JSON_string");
The changes will be implemented after the reinitialization (DeviceClose-DeviceSet or ObjectClose-ObjectStart). It might be useful to update IP addresses or port numbers in the configuration. If you need to change the number of inputs or outputs, you should close and re-crease the MLive or the MRenderer object to refresh the number of devices with the DeviceGetCount method.
The MRenderer (MFRenderer) object has a specific way to set the configuration. It is necessary to set the configuration and then recreate the same object:
m_objRenderer = new MRendererClass();
m_objRenderer.PropsSet("runtime::aja.ip_config", "path");
m_objRenderer.ObjectClose();
m_objRenderer = new MRendererClass();
Or set the configuration for the runtime of another object:
m_objFile = new MFileClass();
m_objFile .PropsSet("runtime::aja.ip_config", "path");
// and after that create the renderer object
m_objRenderer = new MRendererClass();
Note please that the "aja.ip_config" property is application-wide, so you can set only one configuration for all the MLive and MRenderer objects. For example, if you call the following:
m_objLive.PropsSet("runtime::aja.ip_config", "path1");
m_objRenderer.PropsSet("runtime::aja.ip_config", "path2");
Both objects will use the path2 configuration.
Known issues
The device works properly with 16 audio channels only. The output is 16 channels even if you use a stereo output. The rest channels are silent in this case. The input is 16 channels otherwise the audio is distorted.