#include "vfw.h" #pragma comment(lib, "vfw32.lib")
#pragma comment(lib, "Winmm.lib") AVIFileInit ( ) ; PAVIFILE pAviFile = nullptr ; int nRet = AVIFileOpen ( & pAviFile, "10.82.27.20_00_201908231542_part0.avi" , OF_READ, NULL ) ; if ( nRet == 0 ) { AVIFILEINFO aviFileInfo = { 0 } ; AVIFileInfo ( pAviFile, & aviFileInfo, sizeof ( AVIFILEINFO) ) ; PAVISTREAM pAviStrem = nullptr ; AVIFileGetStream ( pAviFile, & pAviStrem, streamtypeVIDEO, 0 ) ; AVISTREAMINFO aviStreamInfo = { 0 } ; AVIStreamInfo ( pAviStrem, & aviStreamInfo, sizeof ( AVISTREAMINFO) ) ; char * szBuf = new char [ 500 * 1024 ] ; memset ( szBuf, 0 , 500 * 1024 ) ; const int headerSize = sizeof ( CMD_HEADER) + sizeof ( AV_VIDEO_INFO) ; while ( ! m_bExit) { for ( int i = 0 ; i < aviFileInfo. dwLength; i++ ) { AVIStreamRead ( pAviStrem, i, 1 , szBuf + headerSize, 500 * 1024 - headerSize, NULL , NULL ) ; } } AVIFileRelease ( pAviFile) ; } AVIFileExit ( ) ;