Playing video on simulator | developer.brewmp.com Playing video on simulator | developer.brewmp.com

Developer

Playing video on simulator

Forums:

Trying to play video on simulator (sdk 7.3). but its doesnt work.

Using IMEDIAUTIL_CreateMedia and IMedia_SetMediaData works fine, but either way IMedia_GetTotalTime returns 0, and i get MM_STATUS_ABORT, even when i dont use IMedia_Play. In callback i dont get pCmdNotify->nCmd == MM_CMD_GETTOTALTIME.

Can any1 help or mb share a working code?

Here's what im doing:

pMe->pszMediaFile = "3.3g2";
pMe->md.clsData = MMD_FILE_NAME;
pMe->md.pData = (void *) pMe->pszMediaFile;
pMe->md.dwSize = 0;//(uint32) STRLEN(pMe->pszMediaFile);

nErr = ISHELL_CreateInstance( pMe->piShell, AEECLSID_MEDIAUTIL, (void **)&pMe->pMediaUtil );
DBGPRINTF("ISHELL_CreateInstance: %d", nErr);

IMEDIAUTIL_CreateMedia( pMe->pMediaUtil, &pMe->md, &pMe->pMedia );
if(!pMe->pMedia)
{
DBGPRINTF_FATAL("error, cant create media");
}
IMEDIAUTIL_Release(pMe->pMediaUtil);

nErr = IMedia_RegisterNotify( pMe->pMedia, (PFNMEDIANOTIFY) IMediaEventHandler, (void *) pMe );
DBGPRINTF("IMedia_RegisterNotify: %d", nErr);
nErr = IMedia_GetTotalTime( pMe->pMedia );
DBGPRINTF("IMedia_GetTotalTime: %d", nErr);

nErr = IMedia_SetVolume( pMe->pMedia, 100 );
DBGPRINTF("IMedia_SetVolume: %d", nErr);
nErr = IMedia_GetMediaParm(pMe->pMedia, MM_PARM_CLSID, &param, NULL);
DBGPRINTF("IMedia_GetMediaParm: %d", nErr);
if (param == AEECLSID_MEDIAMPEG4)
{
DBGPRINTF("MEDIAMPEG4");
}

SETAEERECT(&rect,0,0,240,180);
IMedia_SetRect( pMe->pMedia, &rect, NULL );
IMedia_Play( pMe->pMedia );

Hi Vulko,
In your event handler for MM_CMD_GETTOTALTIME, can you please try changing:
if(pCmdNotify->nStatus = MM_STATUS_DONE)
to
if(pCmdNotify->nStatus == MM_STATUS_DONE)
Can you please tell me what version of SDK you are using? GETTOTALTIME has been recently added as IMediaMPEG4.dll must be available.
Thanks,
Karina

Hi Vulko,
In your event handler for MM_CMD_GETTOTALTIME, can you please try changing:
if(pCmdNotify->nStatus = MM_STATUS_DONE)
to
if(pCmdNotify->nStatus == MM_STATUS_DONE)
Can you please tell me what version of SDK you are using? GETTOTALTIME has been recently added as IMediaMPEG4.dll must be available.
Thanks,
Karina

Did that already, still aint working.
I'm using SDK 7.3

Did that already, still aint working.
I'm using SDK 7.3

Hi Vulko,
Thanks for replying with the version info and trying the change. Do you know the resolution of your 3.3g2 file? The IMediaMPEG4 shipped with Brew MP SDK 7.3 has a resolution limitation of 320X240 or less.
h263/mpeg4/h264 formats should work OK.
Best regards,
Karina

Hi Vulko,
Thanks for replying with the version info and trying the change. Do you know the resolution of your 3.3g2 file? The IMediaMPEG4 shipped with Brew MP SDK 7.3 has a resolution limitation of 320X240 or less.
h263/mpeg4/h264 formats should work OK.
Best regards,
Karina

The resolution was ok, and this problem occured also while playing audio files.
Installed SDK 7.4, now its working fine.

The resolution was ok, and this problem occured also while playing audio files.
Installed SDK 7.4, now its working fine.

There is still one problem with 5.0 and 6.0 simulators. IMedia from ISource wouldnt play. When i use FileMgr and convert audio file from fs to ISource its ok. But when i use IWeb API and IWeb_GetResponce to get ISource object, it's not being played. I get MM_STATUS_START and directly MM_STATUS_DONE. I suppose it's (streaming from network) not supported on simulator, is it?

There is still one problem with 5.0 and 6.0 simulators. IMedia from ISource wouldnt play. When i use FileMgr and convert audio file from fs to ISource its ok. But when i use IWeb API and IWeb_GetResponce to get ISource object, it's not being played. I get MM_STATUS_START and directly MM_STATUS_DONE. I suppose it's (streaming from network) not supported on simulator, is it?

Streaming from network only supports RTSP, the video format can be h264/mpeg4/h263, and it has the same resolution limitation up to 320X240.

Streaming from network only supports RTSP, the video format can be h264/mpeg4/h263, and it has the same resolution limitation up to 320X240.

Your app is a streaming media player. right?
If yes, what is the scenario playing a media from network?
I want to know the method to transfer the media data received from network to IMedia.
Pls explain it...

Your app is a streaming media player. right?
If yes, what is the scenario playing a media from network?
I want to know the method to transfer the media data received from network to IMedia.
Pls explain it...

Noah wrote:Your app is a streaming media player. right?
If yes, what is the scenario playing a media from network?
I want to know the method to transfer the media data received from network to IMedia.
Pls explain it...
To start with i dicieded to use IWeb interface to get ISource object. It works as following, IWeb_GetResponce gets ISource object. Then md.clsData = MMD_ISOURCE and md.pData = (pointer to isource).
I've found that simulator doesn't support that type of ISource for IMedia, as it is a network stream. When i get ISource from IFileMgr its working fine. Tried network ISource on target device - working fine.

Noah wrote:Your app is a streaming media player. right?
If yes, what is the scenario playing a media from network?
I want to know the method to transfer the media data received from network to IMedia.
Pls explain it...
To start with i dicieded to use IWeb interface to get ISource object. It works as following, IWeb_GetResponce gets ISource object. Then md.clsData = MMD_ISOURCE and md.pData = (pointer to isource).
I've found that simulator doesn't support that type of ISource for IMedia, as it is a network stream. When i get ISource from IFileMgr its working fine. Tried network ISource on target device - working fine.

Hi Vulko,
I'll check with development to see why you're seeing this issue.
Thanks,
Karina

Hi Vulko,
I'll check with development to see why you're seeing this issue.
Thanks,
Karina

Hi Vulko,
As of now, the support for streaming is available ONLY on a target and is NOT available in the simulator.
Thanks,
Sreekanth Aila

Hi Vulko,
As of now, the support for streaming is available ONLY on a target and is NOT available in the simulator.
Thanks,
Sreekanth Aila

Does the lack of support for streaming on the simulator include both http and rtsp streaming? How about progressive download?
Is it likely that the simulator will support streaming in the near future?

Does the lack of support for streaming on the simulator include both http and rtsp streaming? How about progressive download?
Is it likely that the simulator will support streaming in the near future?

Hi,
As of now RTSP streaming is supported on the simulator where as Progressive Download is not supported on the simulator.
Below snippet shows what should be the media data to be filled for RTSP streaming of audio/video:
//fill in the media data here
md.clsData = MMD_FILE_NAME;
md.pData = (void*)"rtspstreaming.url";
md.dwSize = 0;
where the rtspstreaming.url file will have the RTSP URL link for the audio/video for which streaming happens. An Example of an RTSP link is here:
rtsp://199.106.121.102:554/3gpp_iot/butte-e21-m96q15-aac32s22_05.3gp
For further information/clarification kindly revert back to us.
Thanks,
Sreekanth Aila

Hi,
As of now RTSP streaming is supported on the simulator where as Progressive Download is not supported on the simulator.
Below snippet shows what should be the media data to be filled for RTSP streaming of audio/video:
//fill in the media data here
md.clsData = MMD_FILE_NAME;
md.pData = (void*)"rtspstreaming.url";
md.dwSize = 0;
where the rtspstreaming.url file will have the RTSP URL link for the audio/video for which streaming happens. An Example of an RTSP link is here:
rtsp://199.106.121.102:554/3gpp_iot/butte-e21-m96q15-aac32s22_05.3gp
For further information/clarification kindly revert back to us.
Thanks,
Sreekanth Aila

To make sure I understand this clearly -
1. The rtsp URL must be in a local file, and that file name is passed to the player.
2. The player cannot take a URL directly, but only via a local file.
As for HTTP streaming and progressive download (Shoutcast streaming and MP3 files), am I correct in assuming that we could use IWeb to to move the bytes from a remote server and use ISource to pass them to the player?
Thanks,
Paul

To make sure I understand this clearly -
1. The rtsp URL must be in a local file, and that file name is passed to the player.
2. The player cannot take a URL directly, but only via a local file.
As for HTTP streaming and progressive download (Shoutcast streaming and MP3 files), am I correct in assuming that we could use IWeb to to move the bytes from a remote server and use ISource to pass them to the player?
Thanks,
Paul

Hi,
Please see below inline responses for your queries:
1. The rtsp URL must be in a local file, and that file name is passed to the player.
[Sreekanth] Yes, this URL file must be a local file and you need to pass file name (media.URL) as md.pData for the media data to be set.
2. The player cannot take a URL directly, but only via a local file.
[Sreekanth] Yes, the IMedia interface doesn't impose the feature of accepting the URL directly
As for HTTP streaming and progressive download (Shoutcast streaming and MP3 files), am I correct in assuming that we could use IWeb to to move the bytes from a remote server and use ISource to pass them to the player?
[Sreekanth] Yes, You can use either IWeb or IFileMgr and pass them to the ISource for HTTP streaming, Please note that HTTP streaming is not supported on Simulator as of now and it is recommended to use the .3GPP file format for HTTP streaming.
For further information/clarification kindly revert back to me.
Thanks,
Sreekanth Aila

Hi,
Please see below inline responses for your queries:
1. The rtsp URL must be in a local file, and that file name is passed to the player.
[Sreekanth] Yes, this URL file must be a local file and you need to pass file name (media.URL) as md.pData for the media data to be set.
2. The player cannot take a URL directly, but only via a local file.
[Sreekanth] Yes, the IMedia interface doesn't impose the feature of accepting the URL directly
As for HTTP streaming and progressive download (Shoutcast streaming and MP3 files), am I correct in assuming that we could use IWeb to to move the bytes from a remote server and use ISource to pass them to the player?
[Sreekanth] Yes, You can use either IWeb or IFileMgr and pass them to the ISource for HTTP streaming, Please note that HTTP streaming is not supported on Simulator as of now and it is recommended to use the .3GPP file format for HTTP streaming.
For further information/clarification kindly revert back to me.
Thanks,
Sreekanth Aila

With local video file, I created iSource using IFILEMGR. MMD_ISOURCE is configured wityh the created iSource object but always ended with IMEDIA_SetMediaDataEx() with error value 14(BADPARAM) . Please can anybody help me to figureout the issue with the below code.
static void PlayVideoUsingIsource(video_test_app * pMe)
{
int nErr;
AEECLSID cls;
AEERect rImage, rText;
IMediaVideo *pMediaVideo;
boolean bEnable = FALSE;
ISourceUtil *psu = NULL;
AEEMediaDataEx md;
DBGPRINTF("PlayVideoUsingIsource >>>> ");
SETAEERECT( &rImage, 0, 0, 320 , 240 );
SETAEERECT( &rText, 0, 180, pMe->deviceInfo.cxScreen, 40 );
if (SUCCESS != ISHELL_CreateInstance(pMe->piShell, AEECLSID_FILEMGR, (void **)&pMe->pfm))
return FALSE;
pMe->pIFile = IFILEMGR_OpenFile(pMe->pfm,"fs:/~/media/dobeer.3gp", _OFM_READWRITE);
if (NULL == pMe->pIFile)
{
pMe->pIFile = IFILEMGR_OpenFile(pMe->pfm, "fs:/~/media/dobeer.3gp", _OFM_CREATE);
if (NULL == pMe->pIFile) return FALSE;
}
ISHELL_CreateInstance(pMe->piShell,AEECLSID_SOURCEUTIL,(void **)&psu);
ISOURCEUTIL_SourceFromAStream(psu,(IAStream *)pMe->pIFile, &pMe->pISource2);
ISOURCEUTIL_Release(psu);
cls = ISHELL_GetHandler(pMe->piShell, AEECLSID_MediaVideo, "video/mp4");
if(ISHELL_CreateInstance(pMe->piShell, cls, (void**)&pMe->pMedia) != SUCCESS)
{
DBGPRINTF_ERROR("Error Creating Media Object");
return ;
}
ZEROAT(&md);
md.clsData= MMD_ISOURCE;// pDatais ISource
md.pData= (void *)pMe->pISource2;
md.dwSize= 0;
md.dwStructSize= sizeof(md); // Size of AEEMediaDataExstructure
md.dwCaps= 0; // What capabilities to enable. 0 means all.
md.bRaw= FALSE; // Is this Raw data? Set it to no (FALSE)
md.dwBufferSize= 0; // Internal buffer size. 0 means use default.
md.pSpec= NULL; // Valid only for raw data
md.dwSpecSize= 0; // Valid only for raw data
DBGPRINTF("Before IMEDIA_SetMediaDataEx");
nErr = IMEDIA_SetMediaDataEx(pMe->pMedia, &md,1); // Set the media source
//nErr =IMedia_SetMediaData(pMe->pMedia, &pMe->md);
nErr = IMedia_RegisterNotify( pMe->pMedia, (PFNMEDIANOTIFY) IMediaEventHandler, (void *) pMe );
DBGPRINTF("IMedia_RegisterNotify: %d", nErr);
if(IMedia_SetRect(pMe->pMedia, &rImage, NULL) != SUCCESS)
{
DBGPRINTF_ERROR("Error Setting Rect %d", nErr);
return ;
}
nErr = IMedia_GetTotalTime( pMe->pMedia );
DBGPRINTF("IMedia_GetTotalTime: %d", nErr);

With local video file, I created iSource using IFILEMGR. MMD_ISOURCE is configured wityh the created iSource object but always ended with IMEDIA_SetMediaDataEx() with error value 14(BADPARAM) . Please can anybody help me to figureout the issue with the below code.
static void PlayVideoUsingIsource(video_test_app * pMe)
{
int nErr;
AEECLSID cls;
AEERect rImage, rText;
IMediaVideo *pMediaVideo;
boolean bEnable = FALSE;
ISourceUtil *psu = NULL;
AEEMediaDataEx md;
DBGPRINTF("PlayVideoUsingIsource >>>> ");
SETAEERECT( &rImage, 0, 0, 320 , 240 );
SETAEERECT( &rText, 0, 180, pMe->deviceInfo.cxScreen, 40 );
if (SUCCESS != ISHELL_CreateInstance(pMe->piShell, AEECLSID_FILEMGR, (void **)&pMe->pfm))
return FALSE;
pMe->pIFile = IFILEMGR_OpenFile(pMe->pfm,"fs:/~/media/dobeer.3gp", _OFM_READWRITE);
if (NULL == pMe->pIFile)
{
pMe->pIFile = IFILEMGR_OpenFile(pMe->pfm, "fs:/~/media/dobeer.3gp", _OFM_CREATE);
if (NULL == pMe->pIFile) return FALSE;
}
ISHELL_CreateInstance(pMe->piShell,AEECLSID_SOURCEUTIL,(void **)&psu);
ISOURCEUTIL_SourceFromAStream(psu,(IAStream *)pMe->pIFile, &pMe->pISource2);
ISOURCEUTIL_Release(psu);
cls = ISHELL_GetHandler(pMe->piShell, AEECLSID_MediaVideo, "video/mp4");
if(ISHELL_CreateInstance(pMe->piShell, cls, (void**)&pMe->pMedia) != SUCCESS)
{
DBGPRINTF_ERROR("Error Creating Media Object");
return ;
}
ZEROAT(&md);
md.clsData= MMD_ISOURCE;// pDatais ISource
md.pData= (void *)pMe->pISource2;
md.dwSize= 0;
md.dwStructSize= sizeof(md); // Size of AEEMediaDataExstructure
md.dwCaps= 0; // What capabilities to enable. 0 means all.
md.bRaw= FALSE; // Is this Raw data? Set it to no (FALSE)
md.dwBufferSize= 0; // Internal buffer size. 0 means use default.
md.pSpec= NULL; // Valid only for raw data
md.dwSpecSize= 0; // Valid only for raw data
DBGPRINTF("Before IMEDIA_SetMediaDataEx");
nErr = IMEDIA_SetMediaDataEx(pMe->pMedia, &md,1); // Set the media source
//nErr =IMedia_SetMediaData(pMe->pMedia, &pMe->md);
nErr = IMedia_RegisterNotify( pMe->pMedia, (PFNMEDIANOTIFY) IMediaEventHandler, (void *) pMe );
DBGPRINTF("IMedia_RegisterNotify: %d", nErr);
if(IMedia_SetRect(pMe->pMedia, &rImage, NULL) != SUCCESS)
{
DBGPRINTF_ERROR("Error Setting Rect %d", nErr);
return ;
}
nErr = IMedia_GetTotalTime( pMe->pMedia );
DBGPRINTF("IMedia_GetTotalTime: %d", nErr);