Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

We know that there are some outfits out there doing streaming and, based on our own experience, it must be implemented by the developer since there is no way of doing video AND audio o simply video, for that mater, using any of the sdks so far. We know that Qualcomm is working/has a platform to do that somehow. Now, the question is, has anyone out there had any success streaming, at least, audio (without breaks) using the functions provided by the 2.0 SDK? Does the emulators have an issue with this? (Will they (emulators) be able to play an audio stream?)

If anyone has any info on this, please give us a hint, no code is necesary, just an explenation on how we should go about doing it. Since we have tried all/most audio interfaces in the 2.0 SDK and have yet to produce a working (read: makes any sound at all) module even when the emulator swears that it is playing, and yes our pcs sound hardware is in perfect condition, sound is enabled and we have it at the max volume posible.

Saludos,

Albert

You can emulate audio streaming, by using IMedia buffer play back.

You can emulate audio streaming, by using IMedia buffer play back.

Yes, we know. The thing is that, using the available methods of passing data to IMedia, it just downloads the WHOLE "streamed" file unto the phone BEFORE starting play. We are sending an infinite stream, thus we cannot work with this as is. We do have a theory on how to do it, again, with the use of buffers. But is just that at the moment. Has anyone tried a buffer scheme that aceptably works?
saludos,

Yes, we know. The thing is that, using the available methods of passing data to IMedia, it just downloads the WHOLE "streamed" file unto the phone BEFORE starting play. We are sending an infinite stream, thus we cannot work with this as is. We do have a theory on how to do it, again, with the use of buffers. But is just that at the moment. Has anyone tried a buffer scheme that aceptably works?
saludos,

Use qcelp format and feed this to your application via sockets. You will only 2 media buffers to accomplish this.....obviously you will have to write some code on your server side to convert your audio streams to qcp! Good luck and let me know if you need any further assistance.

Use qcelp format and feed this to your application via sockets. You will only 2 media buffers to accomplish this.....obviously you will have to write some code on your server side to convert your audio streams to qcp! Good luck and let me know if you need any further assistance.

Hi,
What I have to use to read the qcp file from server, I mean Iweb or Isocket. how can I play the QCP file? Is it Imedia that will help to play the file??
Thanks n Regards
Pramod

Hi,
What I have to use to read the qcp file from server, I mean Iweb or Isocket. how can I play the QCP file? Is it Imedia that will help to play the file??
Thanks n Regards
Pramod

All in all, we have discovered that true voice does the trick but lacks quality. Our Senior Programer did some magic and is doing all with mp3. Don't ask, i have no clue as to what he is doing at the moment but involves some serious tinkering with isource and imedia. In any case, yes, imedia is the way to go since, if you are dealing with concurent audio and video streams, will let you have to media playing "at the same time" Check the documentation on Imedia, is pretty helpfull and will tell you how to play a qcp file. The idea is something like this:
1. Get the file (via web, use Iweb or a socket, but all in all iweb is simpler if you have a web server wating for your requests, IMO)
2. Pass the source to a buffer
3. as soon as you have enough buffering done, pass that to imedia and start to play it
4. At the same time make another request to get another chunk of sound.
5. repeat steps 2 - 4.
One major hurdle with qcp is that, unlike mp3 that each frame has its own info, the headers are at the head of the file (duh!). So, if you snap the file in a couple of chunks, the subsequet parts will be without its defining info. Unless you do some hacks to the server feeds you wont be able to play much of the sound file.
Hope that helps.
Saludos,
Alhiem

All in all, we have discovered that true voice does the trick but lacks quality. Our Senior Programer did some magic and is doing all with mp3. Don't ask, i have no clue as to what he is doing at the moment but involves some serious tinkering with isource and imedia. In any case, yes, imedia is the way to go since, if you are dealing with concurent audio and video streams, will let you have to media playing "at the same time" Check the documentation on Imedia, is pretty helpfull and will tell you how to play a qcp file. The idea is something like this:
1. Get the file (via web, use Iweb or a socket, but all in all iweb is simpler if you have a web server wating for your requests, IMO)
2. Pass the source to a buffer
3. as soon as you have enough buffering done, pass that to imedia and start to play it
4. At the same time make another request to get another chunk of sound.
5. repeat steps 2 - 4.
One major hurdle with qcp is that, unlike mp3 that each frame has its own info, the headers are at the head of the file (duh!). So, if you snap the file in a couple of chunks, the subsequet parts will be without its defining info. Unless you do some hacks to the server feeds you wont be able to play much of the sound file.
Hope that helps.
Saludos,
Alhiem

In my humble opinion,my fellow programmers, this buffer based paying is not going to work.
I've been trying to make audio work for a long time.. Fortunately,streaming is working fine in some of the latest devices, such as Samsung A990, and Motorola V3c. But, most of the other devices, W42H,W21K , the sudio is a disastor :(
The funny part is, most of the devices do not support Streaming and Ivocoder interface.. so, we r left with nothing, other than silence, (crying :( )
I'm attaching the full code I've tried with.
As the test files,I used Sinwave of 3sec 300ms and 200ms.. there is huge glitch between each buffer playing, and a noticable gap.. When it comes to 200ms file, its HORRIBLE.. Is there any way out from this BREW situation?
This is the code I tried
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEEFile.h" // File interface definitions
#include "AEESound.h" // Sound Interface definitions
#include "AEEStdLib.h" // The Std library, for DBGPRINTF
#include "testapp.bid" // The BID file
#define WAVFILE "wavfile.wav"
typedef struct _MYAPPDATA
{
AEEApplet m_applet;
IMedia* lpIMediaPlayer;
AEEMediaData mediaData;
IShell* lpShell;
MYAPPDATA, *LPMYAPPDATA;
static boolean testapp_HandleEvent(IApplet * pi, AEEEvent eCode,
uint16 wParam, uint32 dwParam);
static int InitTestApp(IApplet* lpme);
static void PlayFile (IApplet* lpme);
static void CloseApp (IApplet* lpme);
static void CallBackFunc(void* lpUser, AEEMediaCmdNotify* lpNotify);
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;
if(ClsId == AEECLSID_TESTAPP){
if(AEEApplet_New(sizeof(MYAPPDATA), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)testapp_HandleEvent,NULL)
== TRUE)
{
InitTestApp((IApplet*)*ppObj);
DBGPRINTF("Init Success");
return (AEE_SUCCESS);
}
}
return (EFAILED);

static boolean testapp_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode)
{
case EVT_APP_START:
DBGPRINTF("--Here we go.. the App started");
PlayFile(pi);
return(TRUE);
case EVT_APP_STOP:
DBGPRINTF("--Here we go.. the App Ending");
CloseApp(pi);
return TRUE;
default:
break;
}
return FALSE;

static int InitTestApp(IApplet* lpme)
{
int iRet;
LPMYAPPDATA lpME = (LPMYAPPDATA)lpme;
iRet = ISHELL_CreateInstance(lpME->m_applet.m_pIShell,AEECLSID_MEDIAADPCM,(void**)&lpME->lpIMediaPlayer);
if (iRet != SUCCESS || lpME->lpIMediaPlayer == NULL)
{
DBGPRINTF("---Error:IMedia creation failed,%d",iRet);
return -1;
}
lpME->lpShell = lpME->m_applet.m_pIShell;
return 0;

void PlayFile(IApplet* lpme)
{
int nRet;
LPMYAPPDATA lpME = (LPMYAPPDATA)lpme;
IFileMgr* lpIFileMgr = NULL;
IFile* lpIFile = NULL;
boolean bRet = FALSE;
ISHELL_CreateInstance(lpME->m_applet.m_pIShell, AEECLSID_FILEMGR, (void**)&lpIFileMgr);
if ( lpIFileMgr == NULL )
{
DBGPRINTF("---Error : Filemanager error");
return ;
}
if ( IFILEMGR_Test(lpIFileMgr, WAVFILE) == SUCCESS )
{
FileInfo fi;
lpME->mediaData.clsData = MMD_BUFFER;
lpIFile = IFILEMGR_OpenFile(lpIFileMgr, WAVFILE, _OFM_READ);
IFILE_GetInfo(lpIFile, &fi);
lpME->mediaData.pData = MALLOC(fi.dwSize);
if(lpME->mediaData.pData == NULL)
{
DBGPRINTF("---Error : Mem Alloc error");
return ;
}
MEMSET(lpME->mediaData.pData,0,fi.dwSize);
IFILE_Read(lpIFile, lpME->mediaData.pData, fi.dwSize);
lpME->mediaData.dwSize = fi.dwSize;
nRet = IMEDIA_SetVolume(lpME->lpIMediaPlayer, 100);
nRet = IMEDIA_SetMediaData(lpME->lpIMediaPlayer, &lpME->mediaData);
nRet = IMEDIA_Play(lpME->lpIMediaPlayer);
nRet = IMEDIA_RegisterNotify(lpME->lpIMediaPlayer, &CallBackFunc, lpme);
if ( lpIFile != NULL )
{
IFILE_Release(lpIFile);
lpIFile = NULL;
}
}
else
{
DBGPRINTF("--Error : File not present");
}

void CallBackFunc(void* lpUser, AEEMediaCmdNotify* lpNotify)
{
LPMYAPPDATA lpME = (LPMYAPPDATA)lpUser;
DBGPRINTF("----Callback,%d,%d",lpNotify->nCmd,lpNotify->nStatus);
if ( lpNotify->nCmd == MM_CMD_PLAY )
{
switch ( lpNotify->nStatus )
{
case MM_STATUS_DONE: // playback done
case MM_STATUS_ABORT: // playback aborted
{
if ( lpNotify->nStatus == MM_STATUS_DONE )
{
/* continuous play it! */
IMEDIA_Seek(lpME->lpIMediaPlayer, MM_SEEK_START, 0);
IMEDIA_Play(lpME->lpIMediaPlayer);
IMEDIA_RegisterNotify(lpME->lpIMediaPlayer, &CallBackFunc, lpUser);
}
}
break;
}
}

static void CloseApp(IApplet* lpme)
{
LPMYAPPDATA lpME = (LPMYAPPDATA)lpme;
IMEDIA_Stop(lpME->lpIMediaPlayer);
IMEDIA_RegisterNotify(lpME->lpIMediaPlayer, NULL, NULL);
FREE(lpME->mediaData.pData);
}

In my humble opinion,my fellow programmers, this buffer based paying is not going to work.
I've been trying to make audio work for a long time.. Fortunately,streaming is working fine in some of the latest devices, such as Samsung A990, and Motorola V3c. But, most of the other devices, W42H,W21K , the sudio is a disastor :(
The funny part is, most of the devices do not support Streaming and Ivocoder interface.. so, we r left with nothing, other than silence, (crying :( )
I'm attaching the full code I've tried with.
As the test files,I used Sinwave of 3sec 300ms and 200ms.. there is huge glitch between each buffer playing, and a noticable gap.. When it comes to 200ms file, its HORRIBLE.. Is there any way out from this BREW situation?
This is the code I tried
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEEFile.h" // File interface definitions
#include "AEESound.h" // Sound Interface definitions
#include "AEEStdLib.h" // The Std library, for DBGPRINTF
#include "testapp.bid" // The BID file
#define WAVFILE "wavfile.wav"
typedef struct _MYAPPDATA
{
AEEApplet m_applet;
IMedia* lpIMediaPlayer;
AEEMediaData mediaData;
IShell* lpShell;
MYAPPDATA, *LPMYAPPDATA;
static boolean testapp_HandleEvent(IApplet * pi, AEEEvent eCode,
uint16 wParam, uint32 dwParam);
static int InitTestApp(IApplet* lpme);
static void PlayFile (IApplet* lpme);
static void CloseApp (IApplet* lpme);
static void CallBackFunc(void* lpUser, AEEMediaCmdNotify* lpNotify);
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;
if(ClsId == AEECLSID_TESTAPP){
if(AEEApplet_New(sizeof(MYAPPDATA), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)testapp_HandleEvent,NULL)
== TRUE)
{
InitTestApp((IApplet*)*ppObj);
DBGPRINTF("Init Success");
return (AEE_SUCCESS);
}
}
return (EFAILED);

static boolean testapp_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode)
{
case EVT_APP_START:
DBGPRINTF("--Here we go.. the App started");
PlayFile(pi);
return(TRUE);
case EVT_APP_STOP:
DBGPRINTF("--Here we go.. the App Ending");
CloseApp(pi);
return TRUE;
default:
break;
}
return FALSE;

static int InitTestApp(IApplet* lpme)
{
int iRet;
LPMYAPPDATA lpME = (LPMYAPPDATA)lpme;
iRet = ISHELL_CreateInstance(lpME->m_applet.m_pIShell,AEECLSID_MEDIAADPCM,(void**)&lpME->lpIMediaPlayer);
if (iRet != SUCCESS || lpME->lpIMediaPlayer == NULL)
{
DBGPRINTF("---Error:IMedia creation failed,%d",iRet);
return -1;
}
lpME->lpShell = lpME->m_applet.m_pIShell;
return 0;

void PlayFile(IApplet* lpme)
{
int nRet;
LPMYAPPDATA lpME = (LPMYAPPDATA)lpme;
IFileMgr* lpIFileMgr = NULL;
IFile* lpIFile = NULL;
boolean bRet = FALSE;
ISHELL_CreateInstance(lpME->m_applet.m_pIShell, AEECLSID_FILEMGR, (void**)&lpIFileMgr);
if ( lpIFileMgr == NULL )
{
DBGPRINTF("---Error : Filemanager error");
return ;
}
if ( IFILEMGR_Test(lpIFileMgr, WAVFILE) == SUCCESS )
{
FileInfo fi;
lpME->mediaData.clsData = MMD_BUFFER;
lpIFile = IFILEMGR_OpenFile(lpIFileMgr, WAVFILE, _OFM_READ);
IFILE_GetInfo(lpIFile, &fi);
lpME->mediaData.pData = MALLOC(fi.dwSize);
if(lpME->mediaData.pData == NULL)
{
DBGPRINTF("---Error : Mem Alloc error");
return ;
}
MEMSET(lpME->mediaData.pData,0,fi.dwSize);
IFILE_Read(lpIFile, lpME->mediaData.pData, fi.dwSize);
lpME->mediaData.dwSize = fi.dwSize;
nRet = IMEDIA_SetVolume(lpME->lpIMediaPlayer, 100);
nRet = IMEDIA_SetMediaData(lpME->lpIMediaPlayer, &lpME->mediaData);
nRet = IMEDIA_Play(lpME->lpIMediaPlayer);
nRet = IMEDIA_RegisterNotify(lpME->lpIMediaPlayer, &CallBackFunc, lpme);
if ( lpIFile != NULL )
{
IFILE_Release(lpIFile);
lpIFile = NULL;
}
}
else
{
DBGPRINTF("--Error : File not present");
}

void CallBackFunc(void* lpUser, AEEMediaCmdNotify* lpNotify)
{
LPMYAPPDATA lpME = (LPMYAPPDATA)lpUser;
DBGPRINTF("----Callback,%d,%d",lpNotify->nCmd,lpNotify->nStatus);
if ( lpNotify->nCmd == MM_CMD_PLAY )
{
switch ( lpNotify->nStatus )
{
case MM_STATUS_DONE: // playback done
case MM_STATUS_ABORT: // playback aborted
{
if ( lpNotify->nStatus == MM_STATUS_DONE )
{
/* continuous play it! */
IMEDIA_Seek(lpME->lpIMediaPlayer, MM_SEEK_START, 0);
IMEDIA_Play(lpME->lpIMediaPlayer);
IMEDIA_RegisterNotify(lpME->lpIMediaPlayer, &CallBackFunc, lpUser);
}
}
break;
}
}

static void CloseApp(IApplet* lpme)
{
LPMYAPPDATA lpME = (LPMYAPPDATA)lpme;
IMEDIA_Stop(lpME->lpIMediaPlayer);
IMEDIA_RegisterNotify(lpME->lpIMediaPlayer, NULL, NULL);
FREE(lpME->mediaData.pData);
}

rbenhardt wrote:Use qcelp format and feed this to your application via sockets. You will only 2 media buffers to accomplish this.....obviously you will have to write some code on your server side to convert your audio streams to qcp! Good luck and let me know if you need any further assistance.
hi, could u pls let us know how u did that..? Can u pls go thru the code I attached in this page.. Can we try the same with a QCP File.. Do u thing there wont be any gap if its a QCP file..?

rbenhardt wrote:Use qcelp format and feed this to your application via sockets. You will only 2 media buffers to accomplish this.....obviously you will have to write some code on your server side to convert your audio streams to qcp! Good luck and let me know if you need any further assistance.
hi, could u pls let us know how u did that..? Can u pls go thru the code I attached in this page.. Can we try the same with a QCP File.. Do u thing there wont be any gap if its a QCP file..?

Please see this thread http://brewforums.qualcomm.com/showthread.php?t=1752
You have to implement ISource interface by yourself and pass that to the IMedia interface. This would allow you to do streaming but not possible to achieve audio/video perfect synchronization (not until BREW 3.1.4 and paritcular AMSS chipset patch).

Please see this thread http://brewforums.qualcomm.com/showthread.php?t=1752
You have to implement ISource interface by yourself and pass that to the IMedia interface. This would allow you to do streaming but not possible to achieve audio/video perfect synchronization (not until BREW 3.1.4 and paritcular AMSS chipset patch).

How does the old veriosn of BREW , 2.x etc, play a file frame by frame.. ? Cant we make an application which tries to play audio as chunks of buffer, say a Video player?
Is there a way AT ALL? .. :eek:

How does the old veriosn of BREW , 2.x etc, play a file frame by frame.. ? Cant we make an application which tries to play audio as chunks of buffer, say a Video player?
Is there a way AT ALL? .. :eek: