Direct Show 9声子错误"Pins无法连接" [英] Direct Show 9 phonon Error "Pins cannot connect"

查看:117
本文介绍了Direct Show 9声子错误"Pins无法连接"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将Direct Show 9后端与qt的phonon框架一起使用时出现以下错误:

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)

有人知道此错误的含义和/或如何解决?声子的Direct Show 9后端有问题吗?

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?

推荐答案

显然,问题与元数据不正确有关.如果Id3标签不正确,则直接在它们上显示9个后端扼流圈.我通过编写以下函数解决了这个问题:

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只是其中具有Phonon :: MediaSource成员的结构,称为source.该函数通过使用taglib剥离歌曲的所有元数据并将新歌曲另存为临时文件来工作.该函数还会旋转用于临时文件的文件名,以便它不会创建无限数量的临时副本文件.希望这对遇到此错误的其他人有所帮助.

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.

这篇关于Direct Show 9声子错误"Pins无法连接"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆