| CONTACT | DEVELOPER CENTER | PARTNERS | SITEMAP
GO
Useful Links
  • Search Helpweb
    
    

Dialogic Support Helpweb

Dialogic® Multimedia Platform for AdvancedTCA

M3G Device Connections

Using dev_PortConnect() with the 3G-324M, Multimedia and IP media Library APIs

Problem:
Connecting a 3G device to a media streaming device can be a confusing process. The simple CTBus xx_Listen() call, used by many Dialogic® technologies has been replaced in some cases by dev_Connect(). For a list of valid dev_Connect() devices, please see Device Management API Library Reference for Dialogic® Host Media Processing Software Release 3.1LIN and Device Management API Library Reference for Dialogic® Multimedia Software for AdvancedTCA Release 1.1

In the case of the M3G API, a third connection mechanism, dev_PortConnect(), is used.

This technote explains how to use dev_PortConnect() to connect 3G devices to Multimedia (MM) and IP Media Library (IPML) devices. Note that other dev_PortConnect() interconnections between these device types are also possible. This includes 3G-3G, which could be used in a loopback situation.

Solution:
The first thing to remember is that a multimedia device consists of both an audio and video component. So, each of the operations have to be done, separately, for each component.

The end result of a successful full-duplex connection should look like this:

3G MM/IPML
Audio  
Tx --------------- ----------------- Rx
Rx --------------- ----------------- Tx
   
Video  
Tx --------------- ----------------- Rx
Rx --------------- ----------------- Tx

The transmit packet stream of media (MM/IPML) device should be connected to the receive side of the 3G device. Conversely, the transmit packet stream of the 3G device should be connected to the receive side of the media device.

Before any connections are done, all devices must, of course, be open. Then, DM_PORT_INFO structs for all ports involved must be filled. This is done by issuing the following two calls on both devices involved in the connection:

if ( dev_GetTransmitPortInfo(IPMHandle, this) != DEV_SUCCESS ) 
{
LOG_ERROR(IPMHandle,"dev_GetTransmitPortInfo() failure\n");
}
if ( dev_GetReceivePortInfo(m_IPMHandle, this) != DEV_SUCCESS )
{
LOG_ERROR(IPMHandle,"dev_GetTransmitPortInfo() failure\n");
}

These calls are asynchronous, so the info arrives with the successful
completion event (DMEV_GET_TX_PORT_INFO or DMEV_GET_RX_PORT_INFO) from the call.

At this point, the port information must be parsed (between audio/video and transmit/receive) and saved for later use with dev_PortConnect():

DM_PORT_INFO_LIST* pPortInfoList 

for ( unsigned int i=0; i< pPortInfoList->unCount; i++ )
{
switch ( pPortInfoList->port_info[i].port_media_type ) {
case DM_PORT_MEDIA_TYPE_AUDIO:
if ( metaevent.evttype == DMEV_GET_TX_PORT_INFO )
{
memcpy(&m_audioPortTxInfo, &pPortInfoList->port_info[i],
sizeof(DM_PORT_INFO));
}
else
{
memcpy(&m_audioPortRxInfo, &pPortInfoList->port_info[i],
sizeof(DM_PORT_INFO));
}
break;
case DM_PORT_MEDIA_TYPE_VIDEO:
if ( metaevent.evttype == DMEV_GET_TX_PORT_INFO )
{
memcpy(&m_videoPortTxInfo, &pPortInfoList->port_info[i],
sizeof(DM_PORT_INFO));
}
else
{
memcpy(&m_videoPortRxInfo, &pPortInfoList->port_info[i],
sizeof(DM_PORT_INFO));
}
break;
}
}

Once the port info has been acquired, the port connects can be done. All devices (MM, 3G, IPML) use dev_PortConnect() in a similar fashion, so only one example will be given here. In this case, a 3G device's transmit ports are being connected to an IPML device's receive ports:
// Assume these all contain valid port info 
DM_PORT_INFO ipmlAudioPortRxInfo;
DM_PORT_INFO ipmlVideoPortRxInfo;
DM_PORT_INFO m3gAudioPortTxInfo;
DM_PORT_INFO m3gVideoPortTxInfo;

// This is empty
DM_PORT_CONNECT_INFO_LIST portConnectInfoList;

// Initialize the list
memset (portConnectInfoList, 0, sizeof(DM_PORT_CONNECT_INFO_LIST));
portConnectInfoList.unCount = 1;
portConnectInfoList.unVersion = DM_PORT_CONNECT_INFO_LIST_VERSION_0;
portConnectInfoList.port_connect_info[0].unVersion = DM_PORT_CONNECT_INFO_VERSION_0;

// "Native" mode means that the packet stream will pass unchanged from one
// device to the other - no transcoding takes place.
portConnectInfoList.port_connect_info[0].unFlags = DMFL_TRANSCODE_NATIVE;

// First call connects the Tx of 3G device to Rx of IPM device (Audio)
memcpy(&(portConnectInfoList.port_connect_info[0].port_info_tx),
&m3gAudioPortTxInfo,
sizeof(DM_PORT_INFO));
memcpy(&(portConnectInfoList.port_connect_info[0].port_info_rx),
&ipmlAudioPortRxInfo,
sizeof(DM_PORT_INFO));
memcpy(portConnectInfoList.port_connect_info[0].port_info_rx.device_ID,
portConnectInfoList.port_connect_info[0].port_info_tx.device_ID,
16*sizeof(char));


if ( DEV_SUCCESS != dev_PortConnect(m3gAudioHandle, &portConnectInfoList, this))
{
LOG_ERROR(m3gAudioHandle, "dev_PortConnect() failure in M3G endpoint - %s\n",
ATDV_ERRMSGP(m3gAudioHandle));
}

// Reinitalize list
memset (portConnectInfoList, 0, sizeof(DM_PORT_CONNECT_INFO_LIST));
portConnectInfoList.unCount = 1;
portConnectInfoList.unVersion = DM_PORT_CONNECT_INFO_LIST_VERSION_0;
portConnectInfoList.port_connect_info[0].unVersion = DM_PORT_CONNECT_INFO_VERSION_0;
portConnectInfoList.port_connect_info[0].unFlags = DMFL_TRANSCODE_NATIVE;

// Second call connects the Tx of 3G device to Rx of IPM device (Video)
memcpy(&(portConnectInfoList.port_connect_info[0].port_info_tx),
&m3gVideoPortTxInfo,
sizeof(DM_PORT_INFO));
memcpy(&(portConnectInfoList.port_connect_info[0].port_info_rx),
&ipmlVideoPortRxInfo,
sizeof(DM_PORT_INFO));
memcpy(portConnectInfoList.port_connect_info[0].port_info_rx.device_ID,
portConnectInfoList.port_connect_info[0].port_info_tx.device_ID,
16*sizeof(char));
if ( DEV_SUCCESS != dev_PortConnect(m3gVideoHandle, &portConnectInfoList, this))
{
LOG_ERROR(m3gVideohandle,
"dev_PortConnect() failure in M3G endpoint - %s\n",
ATDV_ERRMSGP(m3gVideoHandle));
}

Remember, the code above only connects one audio/video set of transmit ports (3G) to one set of receive ports. (IPML) This results in a half-duplex connection from 3G to IPML. A similar connection sequence must happen with transmit ports from IPML and receive ports from 3G. In this case, the device handle used for the dev_PortConnect() call will be the IPML device handle. This will usually result in a pair of symmetric calls to connection methods similar to these:

p3GObject->DoPortConnect(pIPMLObject->GetAudioRxPortInfo(), pIPMLObject->GetVideoRxPortInfo()); 
pIPMLObject->DoPortConnect(p3GObject->GetAudioRxPortInfo(), p3GObject->GetVideoRxPortInfo());

See the M3G-SIP gateway demo for a full example of the use of dev_PortConnect() with IPML. The demo can be found in the release distribution in the Demos directory /usr/dialogic/demos/3GDemo/m3g-sip_gateway. See also Device Management API Library Reference for both Dialogic® Multimedia Software for AdvancedTCA Release 1.1 and Dialogic® Host Media Processing Software Release 3.1LIN, for documentation on dev_PortConnect(). (See Related Documentation section below)

Related Documentation
Device Management API Library Reference for Dialogic® Host Media Processing Software Release 3.1LIN
Device Management API Library Reference for Dialogic® Multimedia Software for AdvancedTCA Release 1.1

Glossary
IPML IP Media Library



Feedback

Please rate the usefulness of this page:  

0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page: