Beispiel #1
0
int CHikVision::GetStreamData( HANDLE hChannel, BOOL bStart, quint8 *pData, int nIndex )
{
    int nRet = 0;
    nRet = SetImageStream( hChannel, bStart, nFps[ nIndex ], 704, 576, pData );

    return nRet;
}
void EncodedStream::stop(){
	if (m_channel_id >= 0){
		if (m_g_real_handler != NULL || m_g_real_handler_ext != NULL){
			StopVideoCapture(m_channel_handle);
		}
		if (m_g_real_ori_handler != NULL){
			SetImageStream(m_channel_handle, false, 25, WIDTH, HEIGHT, NULL);
		}
	}

}
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);
		}
	}

}