当前位置: 首页>>代码示例>>C++>>正文


C++ CChannel::InitAV方法代码示例

本文整理汇总了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);
}
开发者ID:LearnCPP,项目名称:LearnFFmpeg,代码行数:59,代码来源:ShowVideo.cpp


注:本文中的CChannel::InitAV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。