Direct Show 9 phonon Error “Pins cannot connect”

╄→гoц情女王★ 提交于 2019-12-10 23:46:39

问题


I'm getting the following error when trying to use the Direct Show 9 backend with qt's phonon framework:

Pins cannot connect due to not supporting the same transport. (0x80040266)

Does anyone know what this error means and/or how to fix it? Is this a problem with the Direct Show 9 backend for phonon?


回答1:


Apparently the problem has to do with bad metadata. If the Id3 tags aren't just right, the direct show 9 backend chokes on them. I solved the problem by writing the following function:

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 is just a struct with a Phonon::MediaSource member in it called source. The function works by using taglib to strip off all of the metadata for a song and save the new song as a temporary file. The function also rotates the filename is uses for the temporary file so that it doesn't create an infinite number of temporary copy files. I hope this helps anyone else who is having this error.



来源:https://stackoverflow.com/questions/10560349/direct-show-9-phonon-error-pins-cannot-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!