📄 videocodecmanage_dlg.cpp
字号:
/*
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006-2008 Beijing, pengzhen (pengzhenxp@yahoo.com.cn) //
// //
///////////////////////////////////////////////////////////////////////////////
*/
// VideoCodecmanage_dlg.cpp : implementation file
//
#include "stdafx.h"
#include "H265V.h"
#include "VideoCodecManage_Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "VideoCodecManage_Dlg1.cpp"
/////////////////////////////////////////////////////////////////////////////
// CVideoCodecManage_Dlg property page
IMPLEMENT_DYNCREATE(CVideoCodecManage_Dlg, CPropertyPage)
CVideoCodecManage_Dlg::CVideoCodecManage_Dlg( UINT nIDCaption ) :
CPropertyPage( CVideoCodecManage_Dlg::IDD, nIDCaption )
{
//{{AFX_DATA_INIT(CVideoCodecManage_Dlg)
//}}AFX_DATA_INIT
m_iItem = 0 ;
m_iSubItem = name_video_codec_sub_id ;
m_iItemStep = 1 ;
m_pCurItemText = TEXT("") ;
LoadItemValue( TRUE ) ;
}
CVideoCodecManage_Dlg::~CVideoCodecManage_Dlg()
{
}
void CVideoCodecManage_Dlg::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVideoCodecManage_Dlg)
DDX_Control(pDX, IDC_BUTTON_ALL, m_pButtonAll);
DDX_Control(pDX, IDC_BUTTON_DEFAULT, m_pButtonDefault);
DDX_Control(pDX, IDC_SLIDER_ITEM, m_pSliderItem);
DDX_Control(pDX, IDC_EDIT_ITEM, m_pEditItem);
DDX_Control(pDX, IDC_STATIC_ITEM, m_pItemCtrl);
DDX_Control(pDX, IDC_STATIC_NAME, m_pNameCtrl);
DDX_Control(pDX, IDC_LIST_MANAGE_VIDEO_CODEC, m_pListCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVideoCodecManage_Dlg, CPropertyPage)
//{{AFX_MSG_MAP(CVideoCodecManage_Dlg)
ON_NOTIFY(NM_CLICK, IDC_LIST_MANAGE_VIDEO_CODEC, OnClickListManageVideoCodec)
ON_WM_HSCROLL()
ON_BN_CLICKED(IDC_BUTTON_DEFAULT, OnButtonDefault)
ON_BN_CLICKED(IDC_BUTTON_ALL, OnButtonAll)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVideoCodecManage_Dlg message handlers
BOOL CVideoCodecManage_Dlg::OnInitDialog()
{
CPropertyPage::OnInitDialog();
m_pListCtrl.ListSetInfo( m_pColumnTitle , sizeof(m_pColumnTitle)/sizeof(CString) );
m_pListCtrl.SetColumnWidth(name_video_codec_sub_id , 80 );
m_pListCtrl.SetColumnWidth(ms_t_video_codec_sub_id , 80 );
//m_pButtonDefault.ShowWindow( SW_HIDE );
//m_pButtonAll.ShowWindow( SW_HIDE );
//m_pButtonDefault.SetWindowText( TEXT("Default") );
//m_pButtonAll.SetWindowText( TEXT("All") );
LoadItemValue( FALSE ) ;
SetItemControlContext() ;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CVideoCodecManage_Dlg::OnSetActive()
{
LoadItemValue( FALSE ) ;
AddStringList( &m_pListCtrl );
//m_iItem = 0 ;
m_iSubItem = name_video_codec_sub_id ;
SetItemControlContext() ;
return CPropertyPage::OnSetActive();
}
void CVideoCodecManage_Dlg::ListInsertString(CManageListCtrl *lpList, int nItem )
{
lpList->DeleteItem( nItem );
lpList->InsertItem(nItem, TEXT(""), 0);
CString lpStr;
int iSubItem = name_video_codec_sub_id+1 ;
lpList ->ListAddString( m_pVideoCodecName[nItem] , nItem, name_video_codec_sub_id );
for( ; iSubItem < VideoCodecManage_SubItems; iSubItem++)
{
lpStr = GetCurSubItemText( iSubItem , m_iItemValue [nItem][iSubItem ] ) ;
lpList ->ListAddString( lpStr , nItem, iSubItem );
}
lpList->SetCheck( nItem , nItem==m_iItem ); //check
}
void CVideoCodecManage_Dlg::AddStringList(CManageListCtrl *lpList )
{
int nItem;
lpList->DeleteAllItems( );
for( nItem=0 ; nItem < VideoCodecManage_Items ; nItem++)
{
ListInsertString(lpList, nItem );
}
}
void CVideoCodecManage_Dlg::OnClickListManageVideoCodec(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMList = (NM_LISTVIEW*)pNMHDR; *pResult = 0;
if( ( pNMList->iItem < 0 ) | ( pNMList->iItem >= m_pListCtrl.GetItemCount() ) ) return ;
//if( ( pNMList->iItem < 0 ) | ( pNMList->iItem >= VideoCodecManage_Items ) ) return ;
m_iItem = pNMList->iItem ; m_iSubItem = pNMList->iSubItem;
SetItemControlContext() ;
for( int nItem=0 ; nItem < VideoCodecManage_Items ; nItem++)
{
m_pListCtrl.SetCheck( nItem , nItem==m_iItem ); //check
}
}
void CVideoCodecManage_Dlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if( m_iSubItem != name_video_codec_sub_id )
{
//if( pScrollBar->GetDlgCtrlID() == IDC_SLIDER_ITEM )
int iValue = m_pSliderItem.GetPos() * m_iItemStep ;
if( m_iItemValue[ m_iItem ][ m_iSubItem ] != iValue )
{
m_pCurItemText = GetCurSubItemText( m_iSubItem , iValue ) ;
m_pEditItem.SetWindowText( m_pCurItemText );
LoadSubItemValue( m_iItem, m_iSubItem, m_pCurItemText, iValue );
SetVideoCodecRegItemValue() ;
}
}
CPropertyPage::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CVideoCodecManage_Dlg::OnButtonDefault()
{
if( m_iSubItem != name_video_codec_sub_id )
{
int iValue = m_iItemValue[VideoCodecManage_Items][ m_iSubItem ] ;
m_pCurItemText = GetCurSubItemText( m_iSubItem , iValue ) ;
m_pEditItem.SetWindowText( m_pCurItemText );
int nItem = m_iItem ;
//for( nItem=0 ; nItem < VideoCodecManage_Items ; nItem++)
{
LoadSubItemValue( nItem, m_iSubItem, m_pCurItemText, iValue );
}
m_pSliderItem.SetPos( iValue / m_iItemStep );
SetVideoCodecRegItemValue() ;
}
}
void CVideoCodecManage_Dlg::OnButtonAll()
{
if( m_iSubItem != name_video_codec_sub_id )
{
int iValue = m_iItemValue[m_iItem][ m_iSubItem ] ;
m_pEditItem.SetWindowText( m_pCurItemText );
for( int nItem=0 ; nItem < VideoCodecManage_Items ; nItem++)
{
LoadSubItemValue( nItem, m_iSubItem, m_pCurItemText, iValue );
}
SetVideoCodecRegItemValue() ;
}
}
CString CVideoCodecManage_Dlg::GetCurSubItemText( int nSubItem , int iValue )
{
CString lpStr;
switch( nSubItem )
{
case have_b_video_codec_sub_id : /* have picture 'B' */
case abr_video_codec_sub_id : /* adaptive bit rate */
case me_c_video_codec_sub_id : /* chroma join motion_estimate (ME) */
lpStr = ( iValue & 0x01 ) ? TEXT("yes") : TEXT("no") ;
break ;
case ms_t_video_codec_sub_id : /* motion_search type */
{
CString lpStr1[] =
{
TEXT("diamond"),
TEXT("big_diamond"),
TEXT("small_diamond"),
TEXT("square")
};
lpStr = lpStr1 [ iValue & 0x03 ] ;
}
break ;
default :
lpStr.Format( TEXT("%d"), iValue );
break ;
}
return lpStr ;
}
void CVideoCodecManage_Dlg::SetItemControlContext()
{
if( m_iSubItem == name_video_codec_sub_id )
{
m_pNameCtrl.SetWindowText( m_pVideoCodecName[m_iItem] );
}
else
{
TCHAR lpCurItemText1[200] ;
m_pCurItemText = TEXT("") ;
if( m_pListCtrl.GetItemText( m_iItem, m_iSubItem ,
lpCurItemText1 , 100) != CB_ERR ) m_pCurItemText = lpCurItemText1 ;
m_pNameCtrl.SetWindowText( m_pVideoCodecName[m_iItem] );
m_pItemCtrl.SetWindowText(m_pColumnTitleText[m_iSubItem] );
m_pEditItem.SetWindowText( m_pCurItemText );
m_iItemStep = 1;
switch( m_iSubItem )
{
case bps_video_codec_sub_id : m_iItemStep =50; /* bits/second */
m_pSliderItem.SetRange( 50/m_iItemStep, 1000/m_iItemStep, TRUE ); break ;
case fps_video_codec_sub_id : /* frames/second */
m_pSliderItem.SetRange( 1, 30, TRUE ); break ;
case gop_video_codec_sub_id : m_iItemStep =25; /* GOP */
m_pSliderItem.SetRange( 0, 1000/m_iItemStep, TRUE ); break ;
case have_b_video_codec_sub_id : /* have_b */
m_pSliderItem.SetRange( 0, 1, TRUE ); break ;
case abr_video_codec_sub_id : /* adaptive bit rate */
m_pSliderItem.SetRange( 0, 1, TRUE ); break ;
case me_c_video_codec_sub_id : /* motion estimate */
m_pSliderItem.SetRange( 0, 1, TRUE ); break ;
case ms_t_video_codec_sub_id : //* motion_search type */
m_pSliderItem.SetRange( 0, 3, TRUE ); break ;
case prp_video_codec_sub_id : /* previous process */
m_pSliderItem.SetRange( 0, 3, TRUE ); break ;
case pop_video_codec_sub_id : /* post process */
m_pSliderItem.SetRange( 0, 3, TRUE ); break ;
}
m_pSliderItem.SetPos( m_iItemValue[m_iItem][ m_iSubItem ] / m_iItemStep );
}
}
void CVideoCodecManage_Dlg::SetVideoCodec( void* lp_dvp_ctx0 )
{
dvp_ctx* lp_dvp_ctx = (dvp_ctx*) lp_dvp_ctx0 ;
int nItem = lp_dvp_ctx->wavelets ;
lp_dvp_ctx->bps = (int)(m_video_bps(nItem)*1000) ; /* bits/second */ /* <300*1000> */
lp_dvp_ctx->fps = (int)(m_video_fps(nItem)) ; /* frames/second */ /* <25,30> */
lp_dvp_ctx->gop = (int)(m_video_gop(nItem)) ; /* group of picture */ /* none 'P', if gop = 0 */
lp_dvp_ctx->have_b = (int)(m_video_have_b(nItem)) ; /* have picture 'B' */ /* none 'B', if have_b = 0 */
//lp_dvp_ctx->ratio = (int)(m_video_ms_t(nItem)) ; /* ratio of background to foreground */ /* none background, if ratio = 0 */
lp_dvp_ctx->abr = (int)(m_video_abr(nItem)) ; /* adaptive bit rate */ /* 0 : CBR, 1 : ABR */
lp_dvp_ctx->me_c = (int)(m_video_me_c(nItem)) ; /* chroma join motion_estimate (ME) */ /* 0 : no, 1 : yes */
lp_dvp_ctx->ms_t = (int)(m_video_ms_t(nItem)) ; /* motion_search type */ /* 0 : diamond, 1 : advance diamond, 2 : small diamond, 3 : square,*/
lp_dvp_ctx->prp = (int)(m_video_prp(nItem)) ; /* previous process */ /* <0,1,2,3> */
lp_dvp_ctx->pop = (int)(m_video_pop(nItem)) ; /* post process */ /* <0,1,2,3> */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -