📄 preview.cpp
字号:
// Preview.cpp : implementation file
//
#include "stdafx.h"
#include "cardtest.h"
#include "Preview.h"
#include "video.h"
#include "ddutil.h"
#include "vdec.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPreview dialog
CPreview::CPreview(CWnd* pParent, CCard* pCard)
: CDialog(CPreview::IDD, pParent)
{
//{{AFX_DATA_INIT(CPreview)
m_bOverlayMode = TRUE;
m_nChannel = 0;
m_nVideoSrc = 0;
m_bViewOn = TRUE;
//m_bSa03Bit[0] = FALSE;
//m_bSa03Bit[1] = FALSE;
//m_bSa03Bit[2] = FALSE;
//m_bSa03Bit[3] = FALSE;
//m_bSa03Bit[4] = FALSE;
//m_bSa03Bit[5] = TRUE;
//m_bSa03Bit[6] = FALSE;
//m_bSa03Bit[7] = FALSE;
//}}AFX_DATA_INIT
//m_pParent=(CCardtestDlg*)pParent;
m_pCard=pCard;
}
void CPreview::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPreview)
DDX_Check(pDX, IDC_OVERLAY, m_bOverlayMode);
DDX_Radio(pDX, IDC_CH1, m_nChannel);
DDX_Radio(pDX, IDC_CVBS, m_nVideoSrc);
DDX_Check(pDX, IDC_VIEWON, m_bViewOn);
//DDX_Check(pDX, IDC_SA03BIT0, m_bSa03Bit[0]);
//DDX_Check(pDX, IDC_SA03BIT1, m_bSa03Bit[1]);
//DDX_Check(pDX, IDC_SA03BIT2, m_bSa03Bit[2]);
//DDX_Check(pDX, IDC_SA03BIT3, m_bSa03Bit[3]);
//DDX_Check(pDX, IDC_SA03BIT4, m_bSa03Bit[4]);
//DDX_Check(pDX, IDC_SA03BIT5, m_bSa03Bit[5]);
//DDX_Check(pDX, IDC_SA03BIT6, m_bSa03Bit[6]);
//DDX_Check(pDX, IDC_SA03BIT7, m_bSa03Bit[7]);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPreview, CDialog)
//{{AFX_MSG_MAP(CPreview)
ON_BN_CLICKED(IDC_VIEWON, OnViewon)
ON_BN_CLICKED(IDC_OVERLAY, OnOverlayMode)
ON_BN_CLICKED(IDC_CH1, OnChChanged)
ON_WM_ACTIVATE()
ON_BN_CLICKED(IDC_CH2, OnChChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPreview message handlers
BOOL CPreview::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
ULONG PhyAddress;
m_pCard->TransAddress(g_ParaOverlay.VirtualAddress, &PhyAddress);
m_pCard->SetDisplayPara(&g_ParaOverlay, PhyAddress);
int nDefautChannel;
if(m_pCard->m_nBoardVersion==REVSS3000)
nDefautChannel=1;
else
nDefautChannel=0;
if(m_pCard->Init7113(nDefautChannel))
g_Main->OutString("初始化7113成功。");
else
g_Main->OutString("初始化7113失败。");
int nVideoFormat=m_pCard->GetVideoType(nDefautChannel);
switch(nVideoFormat){
case VIDEOTYPE_NONE:
g_Main->OutString("未检测到视频源。");
break;
case VIDEOTYPE_NTSC:
g_Main->OutString("检测到NTSC视频源。");
break;
case VIDEOTYPE_PAL:
g_Main->OutString("检测到PAL视频源。");
break;
}
if(m_pCard->CheckDouble()){
if(m_pCard->Init7113(1))
g_Main->OutString("初始化第二路7113成功。");
else
g_Main->OutString("初始化第二路7113失败。");
int nVideoFormat=m_pCard->GetVideoType(1);
switch(nVideoFormat){
case VIDEOTYPE_NONE:
g_Main->OutString("第二路未检测到视频源。");
break;
case VIDEOTYPE_NTSC:
g_Main->OutString("第二路检测到NTSC视频源。");
break;
case VIDEOTYPE_PAL:
g_Main->OutString("第二路检测到PAL视频源。");
break;
}
}
else{
GetDlgItem(IDC_CHANNEL)->EnableWindow(FALSE);
GetDlgItem(IDC_CH1)->EnableWindow(FALSE);
GetDlgItem(IDC_CH2)->EnableWindow(FALSE);
}
m_pCard->InitMTV118("0 2 - 0 4 - 0 5 / C H a b c d ");
if(!m_pCard->CheckVideoSrc()){
GetDlgItem(IDC_SRCS)->EnableWindow(FALSE);
GetDlgItem(IDC_CVBS)->EnableWindow(FALSE);
GetDlgItem(IDC_SVIDEO)->EnableWindow(FALSE);
}
m_pVideoWindow=new CVideo(this, m_pCard);
m_pVideoWindow->Create();
m_pVideoWindow->SetOverlayMode(0);
if(m_pCard->m_nBoardVersion==REVSS3000)
m_pVideoWindow->SetChannel(0);
else
m_pVideoWindow->SetChannel(nDefautChannel);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPreview::OnCancel()
{
// TODO: Add extra cleanup here
m_pCard->Overlay(NULL, 0, FALSE);
delete m_pVideoWindow;
CDialog::OnCancel();
}
void CPreview::OnViewon()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_bViewOn)
m_pVideoWindow->ShowWindow(SW_SHOWNORMAL);
else
m_pVideoWindow->ShowWindow(SW_HIDE);
}
void CPreview::OnOverlayMode()
{
// TODO: Add your control notification handler code here
UpdateData();
ULONG PhyAddress;
if(m_bOverlayMode){
m_pCard->TransAddress(g_ParaOverlay.VirtualAddress, &PhyAddress);
m_pCard->SetDisplayPara(&g_ParaOverlay, PhyAddress);
m_pVideoWindow->SetOverlayMode(2);
}
else{
m_pCard->TransAddress(g_ParaPrimary.VirtualAddress, &PhyAddress);
m_pCard->SetDisplayPara(&g_ParaPrimary, PhyAddress);
m_pVideoWindow->SetOverlayMode(1);
}
}
void CPreview::OnChChanged()
{
// TODO: Add your control notification handler code here
UpdateData();
m_pVideoWindow->SetChannel(m_nChannel);
}
void CPreview::OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
{
// if(nState!=WA_INACTIVE)
// m_pVideoWindow->ShowWindow(SW_SHOWNORMAL);
}
void CPreview::VideoClosed()
{
m_bViewOn=FALSE;
UpdateData(FALSE);
}
void CPreview::OnOK()
{
// TODO: Add extra validation here
}
/*void CPreview::OnApply()
{
// TODO: Add your control notification handler code here
UpdateData();
int i;
int mask;
UCHAR nSa03=0;
UCHAR nSa09=0;
UCHAR nSa0E=0;
UCHAR nVipAdd=m_nChannel?0x4a:0x48;
for(i=0,mask=0x01; i<8; i++){
if(m_bSa03Bit[i])
nSa03|=mask;
mask<<=1;
}
for(i=0,mask=0x01; i<8; i++){
if(m_bSa09Bit[i])
nSa09|=mask;
mask<<=1;
}
for(i=0,mask=0x01; i<8; i++){
if(m_bSa0EBit[i])
nSa0E|=mask;
mask<<=1;
}
CString s;
s.Format("%02x", nSa03);
GetDlgItem(IDC_SA03)->SetWindowText(s);
s.Format("%02x", nSa09);
GetDlgItem(IDC_SA09)->SetWindowText(s);
s.Format("%02x", nSa0E);
GetDlgItem(IDC_SA0E)->SetWindowText(s);
m_pCard->IICWrite(nVipAdd, 0x03, nSa03);
m_pCard->IICWrite(nVipAdd, 0x09, nSa09);
m_pCard->IICWrite(nVipAdd, 0x0E, nSa0E);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -