本文整理汇总了C++中VideoCapture::GetPreviewInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoCapture::GetPreviewInfo方法的具体用法?C++ VideoCapture::GetPreviewInfo怎么用?C++ VideoCapture::GetPreviewInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoCapture
的用法示例。
在下文中一共展示了VideoCapture::GetPreviewInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCallStarted
void SipClient::OnCallStarted()
{
if ( IsWorking() )
{
DEBUG_INFO("SipUADemo::OnCallStarted...");
#ifdef WIN32
WSADATA dat;
int iWSRet = WSAStartup(MAKEWORD(2,2),&dat);
ASSERT(iWSRet == 0);
#endif // WIN32
{
VideoCapture cap;
if (cap.EnumDevices(false) > 0)
m_bCaptureAudio = true;
VIDEOSAMPLEINFO vsiLocal;
VIDEOFORMATINFO vfiRemote;
int nVideoDevices = cap.EnumDevices();
HRESULT hr = E_FAIL;
if (nVideoDevices > 0)
hr = cap.GetPreviewInfo(nVideoDevices-1, vsiLocal);
SPRINTF_S(dbg_str,
"Video device detecting: count:%d, HRES:%X"
, nVideoDevices
, hr);
DEBUG_INFO(dbg_str);
//if ( cap.EnumDevices() > 0
// && SUCCEEDED(cap.GetPreviewInfo(cap.EnumDevices()-1, vsiLocal)) )
if ( SUCCEEDED(hr) )
{
m_bCaptureVideo = true;
setVideoSampleInfo(vsiLocal);
//TODO: support codecoder selection (for h264, etc.)
vfiRemote = VIDEOFORMATINFO(
CODEC_FORMAT,
H264_WIDTH,
H264_HEIGHT,
vsiLocal.m_AvgTimePerFrame);
setRemoteVideoFormatInfo(vfiRemote);
}
else
{
//TODO: support codecoder selection (for h264, etc.)
vfiRemote = VIDEOFORMATINFO(
CODEC_FORMAT,
H264_WIDTH,
H264_HEIGHT,
FRAMES_PER_SECOND);
setRemoteVideoFormatInfo(vfiRemote);
}
}
#ifdef RTP_AUDIO_SENDRECV
//Sender
{
if (m_bCaptureAudio)
{
SPRINTF_S(dbg_str,
"Send Audio to [IP]=%s, [Port]=%s"
//", [BasePort]=%s"
, GetRemoteAudioIP().c_str()
, GetRemoteAudioPort().c_str()
//, GetAudioSendPort().c_str()
);
DEBUG_INFO(dbg_str);
uint16_t portbase,destport;
uint32_t destip;
std::string ipstr;
int status;
//ASSERT(GetAudioSendPort().length() > 0);
portbase = 6666 + rand() % 6666;//atoi(GetAudioSendPort().c_str());
if (portbase % 2 == 1)
portbase += 1;
// destination IP address
ipstr = GetRemoteAudioIP();
ASSERT(ipstr.length() > 0);
destip = inet_addr(ipstr.c_str());
if (destip == INADDR_NONE)
{
DEBUG_INFO("Bad IP address specified");
DebugBreak();
}
// The inet_addr function returns a value in network byte order, but
// we need the IP address in host byte order, so we use a call to ntohl
destip = ntohl(destip);
// destination port
ASSERT(GetRemoteAudioPort().length() > 0);
destport = atoi(GetRemoteAudioPort().c_str());
// Now, we'll create a RTP session, set the destination, send some
//.........这里部分代码省略.........