[英]libvlc_video_set_subtitle_file not working
I'm using the following code to set the subtitle file, but for some reason it's not working. 我正在使用以下代码来设置字幕文件,但是由于某些原因,它无法正常工作。
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));
Subtitle index and count are the same before and after setting the specific file, and the function returns 1 (int a). 设置特定文件前后,字幕索引和计数相同,并且该函数返回1(整数a)。
However, setting the subtitle with libvlc_video_set_spu
works. 但是,可以使用
libvlc_video_set_spu
设置字幕。
I'm using VLC 2.2.1 我正在使用VLC 2.2.1
If you are on Windows, QDir::toNativeSeparators
will help: 如果您使用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());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.