⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertiesdlg.cpp

📁 VIS H.323 Library V2.1 Release
💻 CPP
字号:
/*
  VIS H.323 Video Conference System
      --Sample for VIS H.323 DLL Library 2.1 Release

  For more information,visit our homepage 
  
    [http://www.115studio.com]

  or mail to us for tech support and bug report

    [support@115studio.com]

  2000-2004 115Studio
  
  2004-04-05
*/
// PropertiesDlg.cpp : implementation file
//

#include "stdafx.h"
#include "visconf.h"
#include "PropertiesDlg.h"
#include "MyEndPoint.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPropertiesDlg dialog


CPropertiesDlg::CPropertiesDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPropertiesDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPropertiesDlg)
	m_jitter = 60;
	m_quality = 50;
	m_remoteApp = _T("");
	m_remoteIP = _T("");
	m_remotePartyName = _T("");
	m_silenceDetection = -1;
	m_threshold = 0;
	m_transmitFPS = 10;
	m_transmitFormat = -1;
	//}}AFX_DATA_INIT
	m_connID=0;
	m_audioDataSent=0;
	m_audioDataRcvd=0;
	m_videoDataSent=0;
	m_videoDataRcvd=0;
	m_videoFrameSent=0;
	m_videoFrameRcvd=0;
	m_hDrawDIB=NULL;
	memset(&m_bmi,0,sizeof(m_bmi));
	m_bmi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
	m_bmi.bmiHeader.biPlanes=1;	
	m_bmi.bmiHeader.biBitCount=24;
}


void CPropertiesDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropertiesDlg)
	DDX_Control(pDX, IDC_TRANSMIT_FORMAT, m_comboTransmitFormat);
	DDX_Control(pDX, IDC_SPIN_TRANSMIT_FPS, m_spinTransmitFPS);
	DDX_Control(pDX, IDC_SPIN_THRESHOLD, m_spinThreshold);
	DDX_Control(pDX, IDC_SPIN_QUALITY, m_spinQuality);
	DDX_Control(pDX, IDC_SPIN_JITTER, m_spinJitter);
	DDX_Control(pDX, IDC_SILENCE_DETECTION, m_comboSilenceDetection);
	DDX_Text(pDX, IDC_JITTER, m_jitter);
	DDV_MinMaxUInt(pDX, m_jitter, 30, 1000);
	DDX_Text(pDX, IDC_QUALITY, m_quality);
	DDV_MinMaxUInt(pDX, m_quality, 0, 100);
	DDX_Text(pDX, IDC_REMOTE_APP, m_remoteApp);
	DDX_Text(pDX, IDC_REMOTE_IP, m_remoteIP);
	DDX_Text(pDX, IDC_REMOTE_PARTY_NAME, m_remotePartyName);
	DDX_CBIndex(pDX, IDC_SILENCE_DETECTION, m_silenceDetection);
	DDX_Text(pDX, IDC_THRESHOLD, m_threshold);
	DDV_MinMaxUInt(pDX, m_threshold, 0, 100);
	DDX_Text(pDX, IDC_TRANSMIT_FPS, m_transmitFPS);
	DDV_MinMaxUInt(pDX, m_transmitFPS, 1, 30);
	DDX_CBIndex(pDX, IDC_TRANSMIT_FORMAT, m_transmitFormat);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropertiesDlg, CDialog)
	//{{AFX_MSG_MAP(CPropertiesDlg)
	ON_WM_TIMER()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropertiesDlg message handlers

BOOL CPropertiesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here	
	//
	m_spinJitter.SetRange32(30,1000);
	m_spinThreshold.SetRange32(0,100);
	m_spinTransmitFPS.SetRange32(1,30);
	m_spinQuality.SetRange32(0,100);
	
	char name[256]="";
	g_pep->GetRemotePartyName(m_connID,name,256);
	m_remotePartyName=name;
	g_pep->GetRemoteApplication(m_connID,name,256);
	m_remoteApp=name;
	g_pep->GetRemoteAddress(m_connID,name,256);
	m_remoteIP=name;	

	m_comboSilenceDetection.AddString("None");
	m_comboSilenceDetection.AddString("Fixed threshold");
	m_comboSilenceDetection.AddString("Adaptive threshold");
	g_pep->GetSilenceDetectionMode(m_connID,(enum SilenceDetectionMode&)m_silenceDetection,(DWORD&)m_threshold);
	g_pep->GetMaxAudioDelayJitter(m_connID,(DWORD&)m_jitter);
	
	m_comboTransmitFormat.AddString("QCIF - 176*144");
	m_comboTransmitFormat.AddString("CIF  - 352*288");
	g_pep->GetVideoSize(m_connID,(enum VideoFormat&)m_transmitFormat);
	if(m_transmitFormat==VS_QCIF)
		m_transmitFormat=0;
	else
		m_transmitFormat=1;
	g_pep->m_VideoMixer.GetFPS(m_connID,TRUE,(DWORD&)m_transmitFPS);
	g_pep->GetVideoQuality(m_connID,(DWORD&)m_quality);
	UpdateData(FALSE);
	
	m_audioDataSent=g_pep->GetAudioDataSent(m_connID);
	m_audioDataRcvd=g_pep->GetAudioDataReceived(m_connID);
	m_videoDataSent=g_pep->GetVideoDataSent(m_connID);
	m_videoDataRcvd=g_pep->GetVideoDataReceived(m_connID);
	m_videoFrameSent=g_pep->GetVideoFrameSent(m_connID);
	m_videoFrameRcvd=g_pep->GetVideoFrameReceived(m_connID);

	
	SetTimer(1,2000,NULL);
	m_hDrawDIB=DrawDibOpen();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPropertiesDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	DWORD as,ar,vs,vr,vfs,vfr;

	as=g_pep->GetAudioDataSent(m_connID);
	ar=g_pep->GetAudioDataReceived(m_connID);
	vs=g_pep->GetVideoDataSent(m_connID);
	vr=g_pep->GetVideoDataReceived(m_connID);
	vfs=g_pep->GetVideoFrameSent(m_connID);
	vfr=g_pep->GetVideoFrameReceived(m_connID);
	if(as>0)
		SetDlgItemInt(IDC_AUDIO_OUT_KBPS,(as-m_audioDataSent)/2000,FALSE);// k bit per sec: *8/2/1000
	else
		SetDlgItemInt(IDC_AUDIO_OUT_KBPS,0);
	if(ar>0)
		SetDlgItemInt(IDC_AUDIO_IN_KBPS,(ar-m_audioDataRcvd)/2000,FALSE);
	else
		SetDlgItemInt(IDC_AUDIO_IN_KBPS,0);

	if(vs>0)
		SetDlgItemInt(IDC_VIDEO_OUT_KBPS,(vs-m_videoDataSent)/2000,FALSE);
	else
		SetDlgItemInt(IDC_VIDEO_OUT_KBPS,0);
	if(vr>0)
		SetDlgItemInt(IDC_VIDEO_IN_KBPS,(vr-m_videoDataRcvd)/2000,FALSE);
	else
		SetDlgItemInt(IDC_VIDEO_IN_KBPS,0);

	if(vfs>0)
		SetDlgItemInt(IDC_VIDEO_OUT_FPS,(vfs-m_videoFrameSent)/2,FALSE);
	else
		SetDlgItemInt(IDC_VIDEO_OUT_FPS,0);
	if(vr>0)
		SetDlgItemInt(IDC_VIDEO_IN_FPS,(vfr-m_videoFrameRcvd)/2,FALSE);
	else
		SetDlgItemInt(IDC_VIDEO_IN_FPS,0);
	
	m_audioDataSent=as;
	m_audioDataRcvd=ar;
	m_videoDataSent=vs;
	m_videoDataRcvd=vr;
	m_videoFrameSent=vfs;
	m_videoFrameRcvd=vfr;

	CDialog::OnTimer(nIDEvent);
}

void CPropertiesDlg::OnDestroy() 
{
	KillTimer(1);
	m_mutex.Lock();
	m_mutex.Unlock();

	CDialog::OnDestroy();

	DrawDibClose(m_hDrawDIB);
	m_hDrawDIB=NULL;
	m_connID=0;
}
//Render the video
void CPropertiesDlg::Render(DWORD connID,BYTE *frame, int w, int h)
{
	if(connID!=m_connID)
		return;
	m_mutex.Lock();
	if(m_hDrawDIB&&m_hWnd&&IsWindowVisible())
	{
		CWnd *p=GetDlgItem(IDC_VIDEO);
		if(p)
		{
			CDC *pdc=p->GetDC();
			if(pdc)
			{
				CRect rc;
				p->GetClientRect(&rc);
				m_bmi.bmiHeader.biWidth=w;
				m_bmi.bmiHeader.biHeight=h;
				DrawDibDraw(m_hDrawDIB,pdc->GetSafeHdc(),0,0,rc.Width(),rc.Height(),&m_bmi.bmiHeader,frame,0,0,m_bmi.bmiHeader.biWidth,m_bmi.bmiHeader.biHeight,DDF_NOTKEYFRAME);

				p->ReleaseDC(pdc);
			}
		}
	}
	m_mutex.Unlock();
}

void CPropertiesDlg::OnOK() 
{
	//Apply the setup for connection
	KillTimer(1);
	UpdateData(TRUE);

	g_pep->SetSilenceDetectionMode(m_connID,(enum SilenceDetectionMode)m_silenceDetection,m_threshold);
	g_pep->SetMaxAudioDelayJitter(m_connID,m_jitter);
	
	g_pep->SetVideoSize(m_connID,(m_transmitFormat==0)?VS_QCIF:VS_CIF);
	g_pep->m_VideoMixer.SetFPS(m_connID,TRUE,m_transmitFPS);
	g_pep->SetVideoQuality(m_connID,m_quality);
	
	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -