QMediaPlayer资源错误 [英] QMediaPlayer resource error

查看:1852
本文介绍了QMediaPlayer资源错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 8 Pro x64上使用Qt Creator 2.7.2(Qt 5.1)。我有QMediaPlayer的麻烦。在我的电脑上有一些MP3文件在Windows Media Player上运行良好,但QMediaPlayer无法播放。以下语句:

  void MainWindow :: onPlayerStateChanged(QMediaPlayer :: State state)
{
qDebug )<< onPlayerStateChanged< state
<< media_player.error()<< media_player.errorString();
// ....
}

播放器的 stateChanged 信号引发以下输出:

  onPlayerStateChanged QMediaPlayer :: PlayingState QMediaPlayer :: NoError
DirectShowPlayerService :: doRender:未解决的错误代码80040266
onPlayerStateChanged QMediaPlayer :: StoppedState QMediaPlayer :: ResourceError
DirectShowPlayerService :: doRender:未解决的错误代码80040266

解决方案



我有一个类似的问题:我试图用QMediaPlayer播放一些MP3文件。其中一个文件生成那个错误,而其他人玩得很好(在Windows 7)。在Linux上,他们都很好。



所以我对我的MP3文件运行'file'命令,注意到有问题的MP3文件有ID3版本2.4.0标签,而所有其他人都有ID3版本2.3.0。我使用ID3标签编辑器完全删除了该文件的ID3标签,然后文件成功播放。



这里的一个猜测:DirectShow,由QMediaPlayer使用后端,阻止ID3版本2.4,并且只能识别旧版本。而QMediaPlayer在Linux上使用GStreamer作为后端,这没有这个问题。


I'm using Qt Creator 2.7.2 (Qt 5.1) on Windows 8 Pro x64. I'm having trouble with QMediaPlayer. There are some MP3 files on my PC which run fine on Windows Media Player, but QMediaPlayer can't play them. Following statement:

void MainWindow::onPlayerStateChanged(QMediaPlayer::State state)
{
    qDebug() << "onPlayerStateChanged" << state
             << media_player.error() << media_player.errorString();
    // ....
}

is the slot connected to media player's stateChanged signal throws following output:

onPlayerStateChanged QMediaPlayer::PlayingState QMediaPlayer::NoError "" 
DirectShowPlayerService::doRender: Unresolved error code 80040266
onPlayerStateChanged QMediaPlayer::StoppedState QMediaPlayer::ResourceError "" 
DirectShowPlayerService::doRender: Unresolved error code 80040266

Any idea what's wrong?

解决方案

It might have something to to with the ID3 tags of the file.

I had a similar problem: I was trying to play some MP3 files with QMediaPlayer. One of the files generated that error while the others played fine (on Windows 7). On Linux though, they all played fine.

So I ran the 'file' command on my MP3 files and noticed that the problematic MP3 file had a ID3 version 2.4.0 tag while all the others had ID3 version 2.3.0. I deleted the ID3 tag of that file completely using an ID3 tag editor and after that the file played successfully.

A wild guess here: DirectShow, which is used by QMediaPlayer as backend on Windows, chokes on ID3 version 2.4 and only recognizes older versions. And QMediaPlayer on Linux uses GStreamer as backend, which does not have that problem.

这篇关于QMediaPlayer资源错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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