Sending and receiving custom ANC data packets with MPlatform and MFormats

Since MPlatform version 1.6.1.7552 and MFormats version 1.2.1.7552 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 is very simple: you process each frame retrieving the data with MFStrGet method of IMFFrame interface or write 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:

  • "ANC.Line.2" - for line 2,  
  • "ANC.Line.8" - for line 8 etc. 

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:

  • "did" - is the ANC packet Data ID;
  • "sdid" - is the ANC packet Secondary Data ID (optional for ANC data Type 2);
  • "01A0F203040B506C" - is user data in HEX.

You will find more ANC data packets syntax examples below.

Code examples for ANC data packets writing

To write ANC data packet you should:


1) 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."ANC.Line.8", "<packet did=0xCF>0102030400506070809</packet>");  

2) 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>");  

3) 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>"); 

4) 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);      
}

Writing and capturing ANC data with ANC Transmit Sample and ANC Receive Sample



Configuring the SDK for processing the ANC Data packets

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

  • MPlatform: [HKEY_CURRENT_USER\SOFTWARE\Medialooks\MPlatform\MLive] vanc.capture_anc = true  
  • MFormats: [HKEY_CURRENT_USER\SOFTWARE\Medialooks\MFormats\MFLive\BMD]  vanc.capture_anc = true  

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

  • MPlatform: [HKEY_CURRENT_USER\SOFTWARE\Medialooks\MPlatform\MRenderer] output.anc_packets = true 
  • MFormats: [HKEY_CURRENT_USER\SOFTWARE\Medialooks\MFormats\MFRenderer\BMD]  output.anc_packets = true

If you have old Blackmagic device (released before 4K devices were born) you might also need to enable 10 bits output (disabled by default):

  • MPlatform: [HKEY_CURRENT_USER\SOFTWARE\Medialooks\MPlatform\MRenderer] output.10bit = true  
  • MFormats: [HKEY_CURRENT_USER\SOFTWARE\Medialooks\MFormats\MFRenderer\BMD] output.10bit = true 

Limitations and notes

  • ANC data can be transmitted using the SDI only.
  • The current version of our products supports ANC data transmitting using Blackmagic devices only.
  • Check the SMPTE 291M standard for more details regarding the ANC data packets configuration.