您当前的位置: 首页 > 

鱼儿-1226

暂无认证

  • 0浏览

    0关注

    1100博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

打开摄像头属性页(调整画质面板)

鱼儿-1226 发布时间:2020-07-31 10:28:12 ,浏览量:0

bool show_property_pages(const wchar_t* camera, int index)

    {

        if (camera == NULL || camera[0] == 0)

        {

            XLOG_ERROR("invalid parameters");

            return false;

        }

 

        AVInputFormat* ifmt = av_find_input_format("dshow");

        if (ifmt == NULL)

        {

            XLOG_ERROR("av_find_input_format(\"dshow\") == null");

            return false;

        }

 

        AVFormatContext* pFormatCtx = avformat_alloc_context();

        if (pFormatCtx == NULL)

        {

            XLOG_ERROR("avformat_alloc_context == null");

            return false;

        }

 

        std::string strUrlUtf8;

        std::wstring wstrUrl = L"video=";

        wstrUrl += camera;

        utils::UTF16toUTF8(wstrUrl.c_str(), strUrlUtf8);

 

        AVDictionary* opts = NULL;

        av_dict_set_int(&opts, "show_video_device_dialog", true, 0);

        if (index > 0)

            av_dict_set_int(&opts, "video_device_number", index, 0);

 

        int ffErr = avformat_open_input(&pFormatCtx, strUrlUtf8.c_str(), ifmt, &opts);

        av_dict_free(&opts);

        avformat_close_input(&pFormatCtx);

        XLOG_TRACE("avformat_open_input == %d", ffErr);

 

        return true;

    }

 

};//cap

关注
打赏
1604459285
查看更多评论
立即登录/注册

微信扫码登录

0.0453s