MyJPEGVideoSource::~MyJPEGVideoSource() { delete[] fQuantizationTables; #ifdef CONFIG_APP_IPCAM_USE_BSBUFFER //close bs buffer gmi_bs_shm_close(hBsBuffer); #endif }
int main(int argc,char*argv[]) { int ret; void* handle=NULL; int streamid=0; char *file=NULL; void *pBuffer=NULL; u32 bufsize=0; if (argc < 3) { fprintf(stderr,"%s streamid dumpfilename\n",argv[0]); exit(3); } streamid = atoi(argv[1]); file = argv[2]; handle = gmi_bs_shm_open(streamid); if (handle == NULL) { APP_ERROR("\n"); ret = -3; goto out; } ret = GetH264Buffer(handle,&pBuffer,&bufsize); if (ret < 0) { APP_ERROR("\n"); goto out; } if (ret == 1) { fprintf(stderr,"get iframe\n"); } else if (ret == 2) { fprintf(stderr,"get jpeg\n"); } ret = WriteToFile(file,pBuffer,bufsize); if (ret < 0) { APP_ERROR("\n"); goto out; } ret = 0; out: if (handle) { gmi_bs_shm_close(handle); } handle = NULL; if (pBuffer) { free(pBuffer); } pBuffer = NULL; bufsize = 0; return ret; }