当我尝试在qt的phonon框架中使用Direct Show 9后端时,我得到了以下错误:
Pins cannot connect due to not supporting the same transport. (0x80040266)有人知道这个错误的含义和/或如何修复它吗?这是电话的Direct Show 9后端的问题吗?
发布于 2012-05-21 03:41:59
显然,这个问题与糟糕的元数据有关。如果Id3标签不是恰到好处,direct show 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剥离歌曲的所有元数据,并将新歌曲保存为临时文件。该函数还轮换临时文件所使用的文件名,这样它就不会创建无限数量的临时副本文件。我希望这对其他有这个错误的人有所帮助。
https://stackoverflow.com/questions/10560349
复制相似问题