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


C++ VideoCapture::EnumDevices方法代码示例

本文整理汇总了C++中VideoCapture::EnumDevices方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoCapture::EnumDevices方法的具体用法?C++ VideoCapture::EnumDevices怎么用?C++ VideoCapture::EnumDevices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VideoCapture的用法示例。


在下文中一共展示了VideoCapture::EnumDevices方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Answer

void SipClient::Answer()
{
    VideoCapture cap;
    if (cap.EnumDevices() <= 0)
    {
        m_sVideoSendPort.Empty(); // disable video send
    }

    super::Answer(
        WString2String(m_sAudioReceivePort).c_str(),
        WString2String(m_sAudioSendPort).c_str(),
        WString2String(m_sVideoReceivePort).c_str(),
        WString2String(m_sVideoSendPort).c_str()
        );
}
开发者ID:AbrahamXu,项目名称:SipUALib,代码行数:15,代码来源:SipClient.cpp

示例2: Dial

void SipClient::Dial()
{
    VideoCapture cap;
    if (cap.EnumDevices() <= 0)
    {
        m_sVideoSendPort.Empty(); // disable video send
    }

    super::Invite(
        WString2String(m_sCalleeId).c_str(),
        WString2String(m_sProxyIp).c_str(),
        WString2String(m_sProxyPort).c_str(),
        WString2String(m_sAudioReceivePort).c_str(),
        WString2String(m_sAudioSendPort).c_str(),
        WString2String(m_sVideoReceivePort).c_str(),
        WString2String(m_sVideoSendPort).c_str(),
        "meeting"
        );

    SPRINTF_S(dbg_str, "Local Audio Port: %s",
        super::GetAudioReceivePort().c_str());
    DEBUG_INFO(dbg_str);
}
开发者ID:AbrahamXu,项目名称:SipUALib,代码行数:23,代码来源:SipClient.cpp

示例3: 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
//.........这里部分代码省略.........
开发者ID:AbrahamXu,项目名称:SipUALib,代码行数:101,代码来源:SipClient.cpp


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