[英]libvlc_video_set_subtitle_file 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));
設置特定文件前后,字幕索引和計數相同,並且該函數返回1(整數a)。
但是,可以使用libvlc_video_set_spu
設置字幕。
我正在使用VLC 2.2.1
如果您使用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.