📄 setv9dlg.cpp
字号:
/*
* Openmysee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
//
#include "stdafx.h"
#include "GVCapture.h"
#include "SetV9Dlg.h"
#include "GVCaptureDlg.h"
#include "VideoEncParams.h"
#include ".\setv9dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CVideoEncParams g_VideoEncodingParams;
/////////////////////////////////////////////////////////////////////////////
// CSetV9Dlg dialog
CSetV9Dlg::CSetV9Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetV9Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetV9Dlg)
m_nBitrate = 0;
m_nBuffer = 0;
m_nVbrQuality = 0;
m_nQuality = 0;
m_fFrameRate = 0.0f;
m_nMaxKeyDistance = 0;
//}}AFX_DATA_INIT
}
void CSetV9Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetV9Dlg)
DDX_Control(pDX, IDC_VBRQUALITY, m_vbrQuality);
DDX_Text(pDX, IDC_BITRATE, m_nBitrate);
DDV_MinMaxUInt(pDX, m_nBitrate, 0, 24000000);
DDX_Text(pDX, IDC_BUFFERDELAY, m_nBuffer);
DDV_MinMaxUInt(pDX, m_nBuffer, 1000, 128000);
DDX_Text(pDX, IDC_VBRQUALITY, m_nVbrQuality);
DDV_MinMaxUInt(pDX, m_nVbrQuality, 0, 100);
DDX_Text(pDX, IDC_QUALITY, m_nQuality);
DDV_MinMaxUInt(pDX, m_nQuality, 0, 100);
DDX_Text(pDX, IDC_FRAMERATE, m_fFrameRate);
DDV_MinMaxFloat(pDX, m_fFrameRate, 0.f, 60.f);
DDX_Text(pDX, IDC_MAXKEYDISTANCE, m_nMaxKeyDistance);
DDV_MinMaxUInt(pDX, m_nMaxKeyDistance, 1, 100);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetV9Dlg, CDialog)
//{{AFX_MSG_MAP(CSetV9Dlg)
ON_BN_CLICKED(IDC_CBR, OnCbr)
ON_BN_CLICKED(IDC_QUALITY_VBR, OnQualityVbr)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetV9Dlg message handlers
BOOL CSetV9Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// CVideoEncParams* pParams = &(((CV9CaptureDlg*)AfxGetMainWnd())->m_videoEncoderParams);
((CButton*)GetDlgItem(IDC_CBR))->SetCheck(!g_VideoEncodingParams.fIsVBR);
m_vbrQuality.EnableWindow(g_VideoEncodingParams.fIsVBR);
m_nVbrQuality = g_VideoEncodingParams.nVBRQuality;
m_nQuality = g_VideoEncodingParams.nQuality;
m_fFrameRate = g_VideoEncodingParams.fFrameRate;
m_nBitrate = g_VideoEncodingParams.nBitrate;
m_nBuffer = g_VideoEncodingParams.nBufferDelay;
m_nMaxKeyDistance = g_VideoEncodingParams.nKeyDist;
CListBox* pProfiles = (CListBox*)GetDlgItem(IDC_PROFILES);
pProfiles->AddString("Main");
pProfiles->AddString("Simple");
pProfiles->AddString("Complex");
pProfiles->SetCurSel(0);
CListBox* pComplexity = (CListBox*)GetDlgItem(IDC_COMPLEXITY);
CString ComplexityString;
for(int index = 0; index <= g_VideoEncodingParams.ComplexityMax; index++)
{
// Assemble the complexity list entry string
if(index == g_VideoEncodingParams.ComplexityLive)
ComplexityString.Format("%d (Live)", index);
else if(index == g_VideoEncodingParams.ComplexityOffline)
ComplexityString.Format("%d (Offline)", index);
else if(index == g_VideoEncodingParams.ComplexityMax)
ComplexityString.Format("%d (Max)", index);
else
ComplexityString.Format("%d", index);
pComplexity->AddString(ComplexityString);
}
pComplexity->SetCurSel(g_VideoEncodingParams.ComplexityLive);
p_sub[0]=GetDlgItem(IDC_CBR);
p_sub[1]=GetDlgItem(IDC_QUALITY_VBR);
p_sub[2]=GetDlgItem(IDC_FRAMERATE);
p_sub[3]=GetDlgItem(IDC_BITRATE);
p_sub[4]=GetDlgItem(IDC_BUFFERDELAY);
p_sub[5]=GetDlgItem(IDC_MAXKEYDISTANCE);
p_sub[6]=GetDlgItem(IDC_QUALITY);
p_sub[7]=GetDlgItem(IDC_COMPLEXITY);
p_sub[8]=GetDlgItem(IDC_PROFILES);
m_tip[0].Create(p_sub[0],TTS_ALWAYSTIP);
m_tip[0].AddTool(p_sub[0]);
m_tip[0].SetTipTextColor(RGB(0,0,0));
m_tip[1].Create(p_sub[1],TTS_ALWAYSTIP);
m_tip[1].AddTool(p_sub[1]);
m_tip[1].SetTipTextColor(RGB(0,0,0));
m_tip[2].Create(p_sub[2],TTS_ALWAYSTIP);
m_tip[2].AddTool(p_sub[2]);
m_tip[2].SetTipTextColor(RGB(0,0,0));
m_tip[3].Create(p_sub[3],TTS_ALWAYSTIP);
m_tip[3].AddTool(p_sub[3]);
m_tip[3].SetTipTextColor(RGB(0,0,0));
m_tip[4].Create(p_sub[4],TTS_ALWAYSTIP);
m_tip[4].AddTool(p_sub[4]);
m_tip[4].SetTipTextColor(RGB(0,0,0));
m_tip[5].Create(p_sub[5],TTS_ALWAYSTIP);
m_tip[5].AddTool(p_sub[5]);
m_tip[5].SetTipTextColor(RGB(0,0,0));
m_tip[6].Create(p_sub[6],TTS_ALWAYSTIP);
m_tip[6].AddTool(p_sub[6]);
m_tip[6].SetTipTextColor(RGB(0,0,0));
m_tip[7].Create(p_sub[7],TTS_ALWAYSTIP);
m_tip[7].AddTool(p_sub[7]);
m_tip[7].SetTipTextColor(RGB(0,0,0));
m_tip[8].Create(p_sub[8],TTS_ALWAYSTIP);
m_tip[8].AddTool(p_sub[8]);
m_tip[8].SetTipTextColor(RGB(0,0,0));
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetV9Dlg::OnOK()
{
UpdateData(TRUE);
// CVideoEncParams* pParams = &(((CV9CaptureDlg*)AfxGetMainWnd())->m_videoEncoderParams);
g_VideoEncodingParams.fIsVBR = (((CButton*)GetDlgItem(IDC_CBR))->GetCheck() != BST_CHECKED);
g_VideoEncodingParams.nVBRQuality = m_nVbrQuality;
g_VideoEncodingParams.nQuality = m_nQuality;
g_VideoEncodingParams.fFrameRate = m_fFrameRate;
g_VideoEncodingParams.nBitrate = m_nBitrate;
g_VideoEncodingParams.nBufferDelay = m_nBuffer;
g_VideoEncodingParams.nKeyDist = m_nMaxKeyDistance;
CListBox* pProfiles = (CListBox*)GetDlgItem(IDC_PROFILES);
CListBox* pComplexity = (CListBox*)GetDlgItem(IDC_COMPLEXITY);
g_VideoEncodingParams.nProfile = pProfiles->GetCurSel();
g_VideoEncodingParams.nComplexity = pComplexity->GetCurSel();
CDialog::OnOK();
}
void CSetV9Dlg::OnCbr()
{
GetDlgItem(IDC_VBRQUALITY)->EnableWindow(FALSE);
GetDlgItem(IDC_QUALITY)->EnableWindow(TRUE);
GetDlgItem(IDC_BITRATE)->EnableWindow(TRUE);
GetDlgItem(IDC_BUFFERDELAY)->EnableWindow(TRUE);
}
void CSetV9Dlg::OnQualityVbr()
{
GetDlgItem(IDC_VBRQUALITY)->EnableWindow(TRUE);
GetDlgItem(IDC_QUALITY)->EnableWindow(FALSE);
GetDlgItem(IDC_BITRATE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUFFERDELAY)->EnableWindow(FALSE);
}
BOOL CSetV9Dlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(m_tip[0].m_hWnd!=NULL)
m_tip[0].RelayEvent(pMsg);
if(m_tip[1].m_hWnd!=NULL)
m_tip[1].RelayEvent(pMsg);
if(m_tip[2].m_hWnd!=NULL)
m_tip[2].RelayEvent(pMsg);
if(m_tip[3].m_hWnd!=NULL)
m_tip[3].RelayEvent(pMsg);
if(m_tip[4].m_hWnd!=NULL)
m_tip[4].RelayEvent(pMsg);
if(m_tip[5].m_hWnd!=NULL)
m_tip[5].RelayEvent(pMsg);
if(m_tip[6].m_hWnd!=NULL)
m_tip[6].RelayEvent(pMsg);
if(m_tip[7].m_hWnd!=NULL)
m_tip[7].RelayEvent(pMsg);
if(m_tip[8].m_hWnd!=NULL)
m_tip[8].RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}
void CSetV9Dlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_tip[0].UpdateTipText("编码时输出的码流为固定大小",p_sub[0]);
m_tip[1].UpdateTipText("编码时输出的码流可变,质量恒定",p_sub[1]);
m_tip[2].UpdateTipText("请填人帧率(0.00-60.00)",p_sub[2]);
m_tip[3].UpdateTipText("每秒钟输出的码流大小",p_sub[3]);
m_tip[4].UpdateTipText("缓冲值大小对于画面质量和延时有影响",p_sub[4]);
m_tip[5].UpdateTipText("关键帧所允许的最大时间间隔(1-100)秒",p_sub[5]);
m_tip[6].UpdateTipText("清晰度代表的是画面的锐利程度",p_sub[6]);
m_tip[7].UpdateTipText("编码复杂度的数值越高,画面质量越高,但对机器性能的要求也越高",p_sub[7]);
CDialog::OnMouseMove(nFlags, point);
}
void CSetV9Dlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -