Resources | Resources |



Media frame model

IMediaFrameModel is derived from IFrameModel and provides image frames from a video.

Using media frame model

An application can use the media frame model as follows:

  1. Create an instance of the FrameWidget using AEECLSID_CFrameWidget.
  2. Create an instance of the IMediaUtil object using AEECLSID_MediaUtil.
  3. Create an instance of the IMedia interface and load the video file by calling IMediaUtil_CreateMedia().
  4. Create an instance of the MediaFrameModel using AEECLSID_CMediaFrameModel.
  5. Set the IMedia instance on the MediaFrameModel by calling IMediaFrameModel_SetIMedia().
  6. Set the model on the frame widget using IWidget_SetModel().
  7. Start video using IMedia_Play().

The following example code shows how to use IMediaFrameModel to provide video frames to a frame widget:

// Create a frame widget
nErr = ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_CFrameWidget, 

if (AEE_SUCCESS == nErr) {
   // Create a media utility instance to assist with creating a media object
   nErr = ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_MEDIAUTIL, 

   // Create the media
   if (AEE_SUCCESS == nErr) {

      /* Allocate memory for file name string and get string */

      if (pszMediaFile) {
         mediaData.clsData = MMD_FILE_NAME; 
         mediaData.pData   = (void*)pszMediaFile; 
         mediaData.dwSize  = 0; 

         // Identify the media class type and create the media
         nErr = IMEDIAUTIL_CreateMedia(pMediaUtil, &mediaData, &pMe->m_pMedia); 
(void) IMEDIAUTIL_Release(pMediaUtil);

// Create a media frame model
if (AEE_SUCCESS == nErr) {
   nErr = ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_CMediaFrameModel, 

   if (AEE_SUCCESS == nErr) {

      /* Set the frame widget extent and the media bounding rectangle */

      // Set the IMedia instance on the MediaFrameModel 
      nErr = IMediaFrameModel_SetIMedia(pMediaFrameMdl, pMe->m_pMedia);

      // Set the model on the frame widget
      if (AEE_SUCCESS == nErr) {
         nErr = IWidget_SetModel(pFrameWgt, (IModel*)pMediaFrameMdl);

/* Position and insert frame widget into container, and play media */