尝试将 Direct Show 9 后端与 qt 的声子框架一起使用时,出现以下错误:
Pins cannot connect due to not supporting the same transport. (0x80040266)
有谁知道这个错误意味着什么和/或如何修复它?这是 Direct Show 9 声子后端的问题吗?
显然这个问题与错误的元数据有关。如果 Id3 标签不正确,直接显示 9 后端就会卡住。我通过编写以下函数解决了这个问题:
void removeTags(UDJ::DataStore::song_info_t& song){
static int fileCount =0;
if(song.source.fileName().endsWith(".mp3")){
UDJ::Logger::instance()->log("On windows and got mp3, copying and striping metadata tags");
QString tempCopy = QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/striped" + QString::number(fileCount) +".mp3";
if(QFile::exists(tempCopy)){
UDJ::Logger::instance()->log("Prevoius file existed, deleting now");
if(QFile::remove(tempCopy)){
UDJ::Logger::instance()->log("File removal worked");
}
}
bool fileCopyWorked = QFile::copy(song.source.fileName(), tempCopy);
if(!fileCopyWorked){
UDJ::Logger::instance()->log("File copy didn't work");
return;
}
TagLib::MPEG::File file(tempCopy.toStdString().c_str());
file.strip();
file.save();
Phonon::MediaSource newSource(tempCopy);
song.source = newSource;
if(fileCount == 3){
fileCount =0;
}
else{
fileCount++;
}
}
}
song_info_t
只是一个带有 Phonon::MediaSource 成员的结构体,名为source
。该函数的工作原理是使用 taglib 去除歌曲的所有元数据并将新歌曲保存为临时文件。该函数还轮换临时文件使用的文件名,这样就不会创建无限数量的临时副本文件。我希望这对遇到此错误的其他人有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)