首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >libvlc_video_set_subtitle_file不工作

libvlc_video_set_subtitle_file不工作
EN

Stack Overflow用户
提问于 2015-06-29 14:28:11
回答 1查看 309关注 0票数 0

我使用下面的代码来设置字幕文件,但由于某种原因,它不起作用。

代码语言:javascript
复制
QString selectedFile = QFileDialog::getOpenFileName(this, "Open");

if(selectedFile == NULL) {
    return;
}

qDebug("Before %d %d", libvlc_video_get_spu(player), libvlc_video_get_spu_count(player));

//int a = libvlc_video_set_subtitle_file(player, selectedFile.toStdString().c_str());
int a = libvlc_video_set_subtitle_file(player, selectedFile.toLatin1().data());

qDebug("A = %d",a);

qDebug("After %d %d", libvlc_video_get_spu(player), libvlc_video_get_spu_count(player));

在设置特定文件之前和之后,字幕索引和计数是相同的,函数返回1 (int a)。

但是,使用libvlc_video_set_spu设置字幕是可行的。

我使用的是VLC 2.2.1

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-30 06:06:27

如果您在Windows上,QDir::toNativeSeparators将帮助:

代码语言:javascript
复制
const QString selectedFile = QFileDialog::getOpenFileName(this, "Open");
const QString nativePath = QDir::toNativeSeparators(selectedFile);
libvlc_video_set_subtitle_file(player, nativePath.toUtf8().constData());
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31118311

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档