void CMainFrame::OnClose() { // TODO: 在此添加消息处理程序代码和/或调用默认值 capCaptureAbort(m_hWndCap); capDriverDisconnect(m_hWndCap); Sleep(100); capSetCallbackOnError(m_hWndCap,NULL); capSetCallbackOnStatus(m_hWndCap,NULL); capSetCallbackOnVideoStream(m_hWndCap,NULL); delete lpbiIn; delete lpbiTmp; delete lpbiOut; if (m_vfwState==ENCDEC){ ICDecompressEnd(hic2); ICClose(hic2); ICSeqCompressFrameEnd(&pc); ICCompressEnd(hic1); ICClose(hic1); AVIStreamClose(ps); if(m_pFile != NULL) AVIFileRelease(m_pFile); } enc_stop(); dec_stop(); Sleep(100); CFrameWnd::OnClose(); }
void main(void) { const char *outrecfilename = "F:\\╡Бйтнд╪Ч\\test3.yuv"; const char *filename = "F:\\╡Бйтнд╪Ч\\test.m4v"; int frame, size, got_picture; FILE *fin, *fout; uint8_t inbuf[INBUF_SIZE ], *inbuf_ptr; int v_YuvInfo[5]; int32 used_bytes; xvid_dec_stats_t xvid_dec_stats; char *pZoom; int i; int h; fin = fopen(filename, "rb"); if (!fin) { fprintf(stderr, "could not open %s\n", filename); exit(1); } fout = fopen(outrecfilename, "wb"); if (!fin) { fprintf(stderr, "could not open %s\n", outrecfilename); exit(1); } dec_init(0, 0); size=0; used_bytes=0; i=0; while (1) { size += fread(inbuf+size, 1, INBUF_SIZE-size, fin); inbuf_ptr = inbuf; used_bytes=dec_main(inbuf_ptr, v_YuvInfo, size, &xvid_dec_stats, pZoom, 0); if(used_bytes>0 && xvid_dec_stats.type>0) { for(h=0;h< YDIM;h++) fwrite(v_YuvInfo[0]+v_YuvInfo[3]*h, 1, XDIM, fout ); for(h=0;h<YDIM/2;h++) fwrite(v_YuvInfo[1]+v_YuvInfo[3]*h/2, 1, XDIM/2, fout ); for(h=0;h<YDIM/2;h++) fwrite(v_YuvInfo[2]+v_YuvInfo[3]*h/2, 1, XDIM/2, fout ); } if(used_bytes>0) { size -= used_bytes; inbuf_ptr += used_bytes; memmove(inbuf, inbuf_ptr, size); } i++; if(i>500)break; } dec_stop(); fclose(fin); fclose(fout); }