LibVLC中播放、录制

2024-01-08 17:37:58

video

1:首先官网下载vlc库

2:将下载的库添加到工程目录

3:添加功能接口

bool QtVLCWidget::playMedia(const char* url, PlayType type)
{
	if (type == PT_Url)
	{
		m_media = libvlc_media_new_location(url);
	}
	else if (type == PT_LocalFile)
	{
		m_media = libvlc_media_new_path(url);
	}

    if (m_media == nullptr) {
        fprintf(stderr, "unable to create media %s", url);
        return false;
    }
    m_mp = libvlc_media_player_new_from_media (m_vlc, m_media);
    if (m_mp == nullptr) {
        fprintf(stderr, "unable to create media player");
        libvlc_media_release(m_media);
        return false;
    }
libvlc_video_set_output_callbacks(m_mp,
		mVLC->isOpenGLES() ? libvlc_video_engine_gles2 : libvlc_video_engine_opengl,
		VLCVideo::setup,
		VLCVideo::cleanup,
		VLCVideo::setReportCallbacks,
		VLCVideo::resizeRenderTextures,
		VLCVideo::swap,
		VLCVideo::make_current,
		VLCVideo::get_proc_address,
		nullptr,
		nullptr,
		mVLC.get());

    libvlc_media_player_play (m_mp);

    return true;
}

参考链接:https://download.csdn.net/download/weixin_38887743/88717306

文章来源:https://blog.csdn.net/weixin_38887743/article/details/135461501
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。