我使用下面的代码来设置字幕文件,但由于某种原因,它不起作用。
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
发布于 2015-06-30 06:06:27
如果您在Windows上,QDir::toNativeSeparators将帮助:
const QString selectedFile = QFileDialog::getOpenFileName(this, "Open");
const QString nativePath = QDir::toNativeSeparators(selectedFile);
libvlc_video_set_subtitle_file(player, nativePath.toUtf8().constData());https://stackoverflow.com/questions/31118311
复制相似问题