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

Developer

Forums

Forums:

Hi,

I captured images with Icamera interface successfully.Now iam doing video capturing with Icamera.But video capturing is not working properly.

I tried this on simulator.

Steps that i followed are listed bellow,

When displaying camera preview i called Icamera_Stop. Is this is must for getting the event CAM_STATUS_DONE. In CAM_STATUS_DONE i called the function capture video.
Capture video code is following,

md.clsData = MMD_FILE_NAME;
md.pData = (void*)"/video/me.mp4";
md.dwSize = 0;

ICAMERA_Start(pme->m_pICamera,CAM_MODE_MOVIE,0);

//ICAMERA_RegisterNotify(pme->m_pICamera,(PFNCAMERANOTIFY)ZenModel_VideoCameraNotify,pme);

result = ICAMERA_SetMediaData(pme->m_pICamera,&md,CAM_FILE_FORMAT_MPG4);
ICAMERA_SetParm(pme->m_pICamera, CAM_PARM_PREVIEW_TYPE, CAM_PREVIEW_MOVIE, 0);
ICAMERA_SetVideoEncode(pme->m_pICamera,AEECLSID_MEDIAMPEG4, 0);
ICAMERA_RecordMovie(pme->m_pICamera);
ICAMERA_SetParm(pme->m_pICamera, CAM_PARM_VIDEO_ENCODE, CAM_ENCODE_RAW, 0);

result = ICAMERA_RecordMovie(pme->m_pICamera);

Then I got the error EBADSTATE.

Help me

Is this the actual code that you are using, because there are some repeated and unnecessary calls that make it look like you might have copied this from multiple places?
If it is the actual code, then I think your main issue (getting EBADSTATE) is that calling ICAMERA_Start(CAM_MODE_MOVIE) means that you have started the camera in movie record mode before you are doing anything else. After that, all of the rest of the calls probably will return EBADSTATE, since you can't call most of them while the camera is already recording a movie.
It looks like you are calling ICAMERA_RecordMovie twice (three times, if you consider that ICAMERA_Start(CAM_MODE_MOVIE) is basically doing the same thing, I believe). Also, you are setting the video encoding to MPEG4 first and then setting it to RAW after, as well as setting the preview type even though you aren't doing a preview here. I would probably write it something more like this:
md.clsData = MMD_FILE_NAME;
md.pData = (void*)"/video/me.mp4";
md.dwSize = 0;
result = ICAMERA_SetMediaData(pme->m_pICamera,&md,CAM_FILE_FORMAT_MPG4);
if (result == SUCCESS)
{
ICAMERA_SetVideoEncode(pme->m_pICamera,AEECLSID_MEDIAMPEG4, 0);
result = ICAMERA_RecordMovie(pme->m_pICamera);

Is this the actual code that you are using, because there are some repeated and unnecessary calls that make it look like you might have copied this from multiple places?
If it is the actual code, then I think your main issue (getting EBADSTATE) is that calling ICAMERA_Start(CAM_MODE_MOVIE) means that you have started the camera in movie record mode before you are doing anything else. After that, all of the rest of the calls probably will return EBADSTATE, since you can't call most of them while the camera is already recording a movie.
It looks like you are calling ICAMERA_RecordMovie twice (three times, if you consider that ICAMERA_Start(CAM_MODE_MOVIE) is basically doing the same thing, I believe). Also, you are setting the video encoding to MPEG4 first and then setting it to RAW after, as well as setting the preview type even though you aren't doing a preview here. I would probably write it something more like this:
md.clsData = MMD_FILE_NAME;
md.pData = (void*)"/video/me.mp4";
md.dwSize = 0;
result = ICAMERA_SetMediaData(pme->m_pICamera,&md,CAM_FILE_FORMAT_MPG4);
if (result == SUCCESS)
{
ICAMERA_SetVideoEncode(pme->m_pICamera,AEECLSID_MEDIAMPEG4, 0);
result = ICAMERA_RecordMovie(pme->m_pICamera);