vlc+mfc,搭建简单的播放器
核心代码如下
const char* const m_vlcArgs[] = { "-I", "dummy", /* Don't use any interface */ "--ignore-config", /* Don't use VLC's config */ }; libvlc_exception_init(&m_vlcEx); m_vlcInst = libvlc_new(sizeof(m_vlcArgs) / sizeof(m_vlcArgs[0]), m_vlcArgs, &m_vlcEx); m_vlcMedia = libvlc_media_new(m_vlcInst, strVPath.GetBuffer(0), &m_vlcEx); m_vlcMplay = libvlc_media_player_new_from_media(m_vlcMedia, &m_vlcEx); libvlc_media_release(m_vlcMedia); libvlc_media_player_set_drawable(m_vlcMplay, (libvlc_drawable_t)m_hWndVideo, &m_vlcEx); libvlc_media_player_play(m_vlcMplay, &m_vlcEx);
strVPath是本地视频地址,不支持中文路径,不过UTF-8编码后应该就支持了
显示控件是STATIC_PIC就可
代码下载