First, control playback
1.1 Pause/Play/stop
VC + + Code:
////////////////////////////////////////////////////////////////////////////////
Funtion:play or change the play speed to normal;
///////////////////////////////////////////////////////////////////////////////
void Cplayerdlg::onplay ()
{
Todo:add your control notification handler code here
Play ();
}
void Cplayerdlg::P Lay ()
{
M_nspeed=0;
OnThrow0 ();
#ifdef _test_callback
if (M_bconvert)
Hik_playm4_setdeccallback (Port,deccbfun);
Else
M_pmainmenu->enablemenuitem (Id_file_close, FALSE);
#endif
if (m_bplaying)
{
Hik_playm4_play (Port,getdlgitem (idc_show)->m_hwnd);
}
Else
{
if (M_bstreamtype)
{
:: SetFilePointer (M_hstreamfile,m_nheadsize,0,file_begin);
Hik_playm4_resetsourcebuffer (PORT);
SetEvent (M_heventinput);
}
m_bplaying = Hik_playm4_play (Port,getdlgitem (idc_show)->m_hwnd);
M_bsound=hik_playm4_playsound (PORT);
if (m_bplaying)
SetTimer (Play_timer,500,null);
}
if (m_bplaying)
Setplaystate ();
Else
{
CString Cserror;
Cserror.format ("Play the" file Faild. %d) ", Hik_playm4_getlasterror (PORT));
AfxMessageBox (Cserror);
}
}
//////////////////////////////////////////////////////////////////////////////
Funtion:pause.
//////////////////////////////////////////////////////////////////////////////
void Cplayerdlg::onpause ()
{
Todo:add your control notification handler code here
if (m_bplaying)
{
M_bpause=!m_bpause;
Pause (M_bpause);
}
}
void Cplayerdlg::P ause (BOOL bpause)
{
if (m_bpaused = = Bpause)
Return
M_bpaused=bpause;
Hik_playm4_pause (Port,bpause);
TRACE ("PAUSE%d\n", m_bpaused);
}
/////////////////////////////////////////////////////////////////////////////
Function:stop
/////////////////////////////////////////////////////////////////////////////
void Cplayerdlg::onstop ()
{
Todo:add your control notification handler code here
if (m_bplaying)
{
Stop ();
}
if (M_bconvert)
{
if (outfile!=null)
Closewrifffiles ();
if (yuvbuf!=null)
{
Free (YUVBUF);
Yuvbuf=null;
}
m_bconvert=0;
//
}
}
void Cplayerdlg::stop ()
{
CButton *pbutton;
if (!m_bplaying)
Return
KillTimer (Play_timer);
if (Hik_playm4_stopsound ())
{
M_bsound=false;
Pbutton = (CButton *) GetDlgItem (idc_sound);
Pbutton->seticon (M_hsoundstopicon);
}
Continue before stop. Add by LGL at 9-19;
M_bpause=false;
Stop
M_bplaying =! Hik_playm4_stop (PORT);
if (!m_bplaying)
{
Setstopstate ();
if (M_bstreamtype)
ResetEvent (M_heventinput);
}
}