尝试将 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
只是一个结构体,其中包含名为 source
的 Phonon::MediaSource 成员。该函数的工作原理是使用 taglib 去除歌曲的所有元数据并将新歌曲保存为临时文件。该函数还轮换临时文件使用的文件名,这样就不会创建无限数量的临时副本文件。我希望这对遇到此错误的其他人有所帮助。
关于qt - 直接显示 9 声子错误 "Pins cannot connect",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10560349/