void CMainDlg::StartCaptureVideo(int iChannel,bool sub) { SYSTEMTIME systemTime; GetLocalTime(&systemTime); SetupDateTime(m_channelHandle[iChannel], &systemTime); m_recordFileName[iChannel].Format("%s%dY%dM%dD%dH%d",m_settingDlg->m_capturePath,systemTime.wYear,systemTime.wMonth,systemTime.wDay,systemTime.wHour,iChannel); m_fileHandle[iChannel] = CreateFile(m_recordFileName[iChannel], GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); InsertOneRecord(iChannel,0,systemTime,m_recordFileName[iChannel]); if (sub) { m_recordFileName[iChannel+BLM_CHANNEL_MAX].Format("%s%dY%dM%dD%dH%dSub",m_settingDlg->m_capturePath,systemTime.wYear,systemTime.wMonth,systemTime.wDay,systemTime.wHour,iChannel); m_fileHandle[iChannel+BLM_CHANNEL_MAX] = CreateFile(m_recordFileName[iChannel], GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); InsertOneRecord(iChannel,1,systemTime,m_recordFileName[iChannel]); SetupSubChannel(m_channelHandle[iChannel], 1); CaptureIFrame(m_channelHandle[iChannel]); StartSubVideoCapture(m_channelHandle[iChannel]); m_isVideoCapture[iChannel+BLM_CHANNEL_MAX] = TRUE; } SetupSubChannel(m_channelHandle[iChannel], 0); CaptureIFrame(m_channelHandle[iChannel]); int iRet = StartVideoCapture(m_channelHandle[iChannel]); m_isVideoCapture[iChannel] = TRUE; }
HANDLE CHikVision::OpenChannel( int nChannelNum ) { // PlateCfg.ini // [WintonePlate] // Recorder=true HANDLE hChannel = ChannelOpen( nChannelNum ); int nRet = 0; if ( bRecorder && ( INVALID_HANDLE != hChannel ) ) { nRet = StartVideoCapture( hChannel ); } return hChannel; }
void EncodedStream::start(){ if (m_channel_id >= 0){ if (m_g_real_handler != NULL || m_g_real_handler_ext != NULL){ SetStreamPackType(m_channel_handle, 3);//2:hikvision pack, 3:ps pack SetEncoderPictureFormat(m_channel_handle, ENC_DCIF_FORMAT); SetStreamType(m_channel_handle, STREAM_TYPE_VIDEO); SetDefaultQuant(m_channel_handle, 18, 18, 23);//use the default, the less the better (range:12-30) SetIBPMode(m_channel_handle, 100, 2, 0, FPS);//the last is framerate SetupBitrateControl(m_channel_handle, 2000000);//unit:bps SetBitrateControlMode(m_channel_handle, brCBR);//use cbr, or brVBR StartVideoCapture(m_channel_handle); } if (m_g_real_ori_handler != NULL){ m_yuv_buf_size = WIDTH * HEIGHT * 3 / 2; m_yuv_buf = new unsigned char[m_yuv_buf_size]; SetImageStream(m_channel_handle, true, 25, WIDTH, HEIGHT, m_yuv_buf); } } }