// VideoPlay.cpp: implementation of the CVideoPlay class.
//
//
#include "stdafx.h"
#include "VideoPlay.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//
// Construction/Destruction
//
CVideoPlay::CVideoPlay(HWND hwnd)
{
pigb = NULL;
pimc = NULL;
pimex = NULL;
pivw = NULL;
pmp = NULL;
pVCap = NULL;
CappFg = NULL;
CapPigb = NULL;
m_hwnd=hwnd;
}
CVideoPlay::~CVideoPlay()
{
HELPER_RELEASE(pivw);
HELPER_RELEASE(pigb);
HELPER_RELEASE(pimc);
HELPER_RELEASE(pimex);
HELPER_RELEASE(pmp);
HELPER_RELEASE(CapPigb);
HELPER_RELEASE(CappFg);
HELPER_RELEASE(pVCap);
}
//显示视频播放窗口
void CVideoPlay::DisplayVideoWin()
{
RECT grc;
if(pivw)
{
//设置窗口所有者
pivw->put_Owner((OAHWND)m_hwnd);
//设置窗口尺寸
pivw->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN);
//设置窗口位置
::GetClientRect(m_hwnd, &grc);;
pivw->SetWindowPosition(grc.left, grc.top, grc.right, grc.bottom);
//显示窗口
pivw->put_Visible(OATRUE);
}
}
//停止播放视频
void CVideoPlay::StopPlay()
{
if(pimc)
{
//停止播放视频
pimc->Stop();
HELPER_RELEASE(pimc);
}
if (pivw)
{
//关闭视频播放窗口
pivw->put_Visible(OAFALSE);
pivw->put_Owner(NULL);
HELPER_RELEASE(pivw);
}
HELPER_RELEASE(CapPigb);
HELPER_RELEASE(CappFg);
HELPER_RELEASE(pVCap);
}