Dialogic Support Helpweb
Dialogic® Host Media Processing (HMP) Software
How to use the new multimedia initialization macros in Dialogic® HMP 3.1 for Linux
Initialization Macros in the Multimedia API
The Multimedia (MM) API in Dialogic® Host Media Processing Software Release 3.1 for Linux now includes a series of inline initialization macros for all C structs that are used to set up for the MM API calls. The macros must always be used - they are not optional.
These macros do two things. First, they set the proper version information for the struct so that the API library code can take into account any changes that may pertain to that version. Second, they set all fields in the struct to a known default value.
In most cases, a struct is simply declared, and then initialized before use. In one case, the MM_MEDIA_ITEM_LIST, structs are nested inside one another. Both the lowest level and higher-level structs need to be initialized. Their order is not particularly important:
The Multimedia (MM) API in Dialogic® Host Media Processing Software Release 3.1 for Linux now includes a series of inline initialization macros for all C structs that are used to set up for the MM API calls. The macros must always be used - they are not optional.
These macros do two things. First, they set the proper version information for the struct so that the API library code can take into account any changes that may pertain to that version. Second, they set all fields in the struct to a known default value.
In most cases, a struct is simply declared, and then initialized before use. In one case, the MM_MEDIA_ITEM_LIST, structs are nested inside one another. Both the lowest level and higher-level structs need to be initialized. Their order is not particularly important:
MM_MEDIA_ITEM_LIST audioMediaList;
MM_MEDIA_ITEM_LIST videoMediaList;
MM_PLAY_INFO playInfo;
MM_PLAY_RECORD_LIST playRecordList[2];
MM_RUNTIME_CONTROL runtimeControl;
// Initialze the structs contained in the media item list first
INIT_MM_MEDIA_AUDIO(&audioMediaList.item.audio);
INIT_MM_MEDIA_VIDEO(&videoMediaList.item.video);
// And now the list structures themselves
INIT_MM_MEDIA_ITEM_LIST(&audioMediaList);
INIT_MM_MEDIA_ITEM_LIST(&videoMediaList);
Also note here that the structs item.audio and item.video are a union and thus occupy the same area of memory in their parent structs. If audio is the type of medium being described, INIT_MM_MEDIA_AUDIO() is used for initialization. If video is the type of medium, INIT_MM_MEDIA_VIDEO() is used. However, it is important that only ONE initialization be done.
Other initializations are straightforward. But notice that each element of the MM_PLAY_RECORD_LIST is initialized separately:
INIT_MM_PLAY_INFO(&playInfo);
INIT_MM_PLAY_RECORD_LIST(&playRecordList[0]);
INIT_MM_PLAY_RECORD_LIST(&playRecordList[1]);
INIT_MM_RUNTIME_CONTROL(&runtimeControl);
Once structs have been initialized, remember that an application should never modify the unVersion field.


