Qt 声子排队不再工作
在最近对声子库进行软件更新之后,我注意到我编写的媒体播放应用程序不再能够循环曲目。下面是有问题的代码。第一首曲目已设置,一旦接近完成,将再次播放Qt 声子排队不再工作,qt,phonon,Qt,Phonon,在最近对声子库进行软件更新之后,我注意到我编写的媒体播放应用程序不再能够循环曲目。下面是有问题的代码。第一首曲目已设置,一旦接近完成,将再次播放 void Alarm::Start(bool useCustom) { if(useCustom) { media->setCurrentSource(Phonon::MediaSource(this->_CustPath)); this->_UsingCustomPath=true;
void Alarm::Start(bool useCustom)
{
if(useCustom)
{
media->setCurrentSource(Phonon::MediaSource(this->_CustPath));
this->_UsingCustomPath=true;
}else{
FileIO::ExtractAudio();
media->setCurrentSource(Phonon::MediaSource(this->_DefaultPath));
this->_UsingCustomPath=false;
}
media->play();
connect(media,SIGNAL(aboutToFinish()),this,SLOT(RepeatAllTheThings()));
this->_isPlaying=true;
}
void Alarm::RepeatAllTheThings()
{
if(this->_UsingCustomPath)
{
media->enqueue(this->_CustPath);
}else{
media->enqueue(this->_DefaultPath);
}
}
运行调试程序几次后,我注意到以下消息:
"Ignoring source as no aboutToFinish handling is in progress"
快速的谷歌搜索并不能说明这条消息的多少。看起来已经添加了一个私有变量(我无权访问)的检查()
有人知道我是不是刚刚在声子中发现了一个新的bug,或者我是如何错误地使用排队方法的吗
编辑:
上面的代码只失败了大约1/2的时间。非常困惑。目前运行的phonon gstreamer 4.6.3解决了以下问题:
media->play();
connect(media,SIGNAL(finished()),this,SLOT(RepeatAllTheThings()));
void Alarm::RepeatAllTheThings()
{
if(this->_UsingCustomPath)
{
media->setCurrentSource(Phonon::MediaSource(this->_CustPath));
}else{
media->setCurrentSource(Phonon::MediaSource(this->_DefaultPath));
}
media->play();
}
解决此问题的方法是:
media->play();
connect(media,SIGNAL(finished()),this,SLOT(RepeatAllTheThings()));
void Alarm::RepeatAllTheThings()
{
if(this->_UsingCustomPath)
{
media->setCurrentSource(Phonon::MediaSource(this->_CustPath));
}else{
media->setCurrentSource(Phonon::MediaSource(this->_DefaultPath));
}
media->play();
}
如果使用此选项,则切换视频时会出现一条黑色斜线(无间隙播放)。如果使用此选项,则切换视频时会出现一条黑色斜线(无间隙播放)