LibVLC中播放、录制

video

1:首先官网下载vlc库

LibVLC中播放、录制_第1张图片

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

你可能感兴趣的:(libvlc播放录制,停止录制)