Medialooks Knowledge Base Support Center

Contact Us

Sending and receiving custom ANC data packets with MPlatform and MFormats

You can build custom ANC data packets and embed them into frames manually. Once embedded, the ANC data can be transmitted over the SDI, and extracted out of the frames afterward.

In general, the sending and receiving of ANC data consist of processing of each frame retrieving the data with MFStrGet method of IMFFrame interface or writing the data with the MFStrSet method. 

ANC data packets common string syntax  

These are the common strings we use to write an ANC data packet:

myMFFrame.MFStrSet("ANC.Line.2", "<packet did=0x58 sdid=0x77>01A0F203040B506C</packet>");

Here, "ANC.Line.2" is the string ID for ANC data. It also contains the line number. Use it to specify the line number to read or write ANC data to. For example:

The string "<packet did=0x58 sdid=0x77>01A0F203040B506C</packet>" is the ANC data packet XML description. It contains the ANC data packet or multiple packets description, where:

You will find more ANC data packets syntax examples below.

Code examples for ANC data packets writing

To write ANC data packet you should:

Example of writing a single packet Type 1 on line 8

If your packet fits into a single line (approximately 1024 bytes for SD; 1275 bytes for 720p; 62,475 bytes for 1080p), then there is no need to specify Data Block Number (DBN), the data will be separated into blocks automatically. DID range for Type 1 data packets: '0xC0..0xCF'.

myMFFrame.MFStrSet( "ANC.Line.8", "<packet did=0xCF>0102030400506070809</packet>");  

Example of writing a single packet Type 1 on line 2, where the Data Block Number (DBN) is specified manually

If you want to write a big packet that is longer than a single line, then you can separate it into 2 lines specifying the DBN of a second line manually.

// First line packet. The DBNs (1..4) will be assigned automatically. 
myMFFrame.MFStrSet( "ANC.Line.2", "<packet did=0xCF >0102030400506070809.....[1020 bytes = 4x255 bytes] </packet>");   

// Second line packet. We specify the DBN to mark it as continuation of the previous packet 
myMFFrame.MFStrSet( "ANC.Line.3", "<packet did=0xCF dbn=5>0102030400506070809 ... [Rest of packet]</packet>");

Example of writing a single packet Type 2 on line 2

Type 2 packets are limited by 255 bytes. DID range for Type 2 data packets: '0x50 ... 0x5F'.

myMFFrame.MFStrSet( "ANC.Line.2", "<packet did=0x58 sdid=0x77>0102030400506070809</packet>"); 

Example of writing multiple packets Type 2 on line 8

myMFFrame.MFStrSet( "ANC.Line.8", "<packet did=0x58 sdid=0x77>0102030400506070809</packet><packet did=0x55 sdid=0x17>FF0102030400506070809</packet>"); 

Code example for ANC data packets reading

// Handle OnFrameSafe event of MLive to get each frame and get it's ANC data 
void m_objMLive_OnFrameSafe(string bsChannelID, object pMFrame) 
    string strANC = ""; 
    // Read ANC data from line 1 
    ((IMFFrame) pMFrame).MFStrGet("ANC.Line.2", out strANC);      

Configuring the SDK for processing the ANC Data packets

To be able to read ANC data from the live source (disabled by default) from Blackmagic devices:

vanc.capture_anc = true  

To be able to write ANC data and output it to the renderer  (enabled by default): 

output.anc_packets = true 

output.anc_packets = true

If you have old Blackmagic device you might also need to enable 10 bit output:

output.10bit = true  

output.10bit = true 

Limitations and notes