本文整理汇总了C++中CChannel::InitAV方法的典型用法代码示例。如果您正苦于以下问题:C++ CChannel::InitAV方法的具体用法?C++ CChannel::InitAV怎么用?C++ CChannel::InitAV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChannel
的用法示例。
在下文中一共展示了CChannel::InitAV方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Play
void CShowVideo::Play(LPCTSTR strIp, LONG nPort, SHORT nNum)
{
CRect rect;
GetClientRect(&rect);
CString url(strIp);
int nBasePort = nPort;
int nLoop = (int)sqrt((float)nNum);
//
m_strLog.Format(_T("控件Play,正在运行,rect=%d,%d,%d,%d"), rect.left, rect.right, rect.Width(),
rect.Height());
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
int xGap = 0, yGap = 0;
int width = rect.Width()-0;
int height = rect.Height()-0;
int x = rect.left + xGap;
int y = rect.top + yGap;
int video_width, audio_width = 40, video_height, audio_height;
video_width = (width - (audio_width*nLoop + xGap*(nLoop + 1))) / nLoop;
video_height = audio_height = (height - yGap*(nLoop + 1)) / nLoop;
for (int i = 0; i < nLoop; ++i)
for (int j = 0; j < nLoop; ++j)
{
CChannel* pchannel = NULL;
pchannel = new CChannel(GetSafeHwnd()/*, i*/);
int video_x = x + i%nLoop*(video_width + audio_width + xGap);
int video_y = y + (i + j) % nLoop*(video_height + yGap);
int audio_x = x + video_width + i%nLoop*(video_width + audio_width + xGap);
int audio_y = video_y;
pchannel->putVideoOrAudioRect(video_x, video_y, video_width, video_height, TRUE);//设置视频位置
pchannel->putVideoOrAudioRect(audio_x, audio_y, audio_width, audio_height, FALSE);//设置音频位置
#if _DEBUG
m_strLog.Format(_T("视频频位置,video_x:%d, video_y:%d, video_width:%d, video_height:%d"),
video_x, video_y, video_width, video_height);
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
m_strLog.Format(_T("音频位置,audio_x:%d, audio_y:%d, audio_width:%d, audio_height:%d"),
audio_x, audio_y, audio_width, audio_height);
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
#endif
BOOL bRet = pchannel->InitAV(url, nBasePort);
if (!bRet)
{
delete pchannel;
m_strLog.Format(_T("%s:%d 初始化InitAV失败"), url, nBasePort);
CWinLog::GetInstance()->WriteLog(m_strLog, emErrorLog);
continue;
}
//初始化成功,加入CChannel数组中
m_vtrChannel.push_back(pchannel);
++nBasePort;
}
m_strLog.Format(_T("控件Play,运行完毕,Channel size=%d"), m_vtrChannel.size());
CWinLog::GetInstance()->WriteLog(m_strLog, emRunLog);
}