Random crashes while playing videos through Phonon on Windows



  • Hi,

    I'm having trouble with some simple video playback code. Let's say I have 3 video files. I want to play them in a loop, every video for 10 seconds. Videos shorter than 10 seconds should be played multiple times. This is the meat of my code:

    @#include "mainwindow.hpp"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    pos(-1),
    timer(new QTimer(this)),
    videoPlayer(new Phonon::VideoPlayer(this))
    {
    connect(timer, SIGNAL(timeout()), this, SLOT(advance()));
    connect(videoPlayer, SIGNAL(finished()), this, SLOT(playbackFinished()));
    timer->setInterval(10000);
    playlist.push_back("../phonontest/media/237.mp4");
    playlist.push_back("../phonontest/media/299.mov");
    playlist.push_back("../phonontest/media/300.avi");
    }

    void MainWindow::showEvent(QShowEvent *event)
    {
    QMainWindow::showEvent(event);
    videoPlayer->setGeometry(10, 10, width()-20, height()-20);
    videoPlayer->show();
    timer->start();
    advance();
    }

    void MainWindow::advance()
    {
    pos = (pos + 1) % playlist.size();
    videoPlayer->stop();
    videoPlayer->hide();
    videoPlayer->show();
    videoPlayer->play(playlist[pos]);
    }

    void MainWindow::playbackFinished()
    {
    videoPlayer->play(playlist[pos]);
    }@

    A complete project can be found at "Bitbucket":http://bitbucket.org/haikoschol/phonontest

    Screenshots of the crash and resulting debugger session:

    http://img714.imageshack.us/f/phononcrash.png/

    http://img682.imageshack.us/f/phononcrashdebugger.png/

    edit: In order to get mov and mp4 files to play I installed the K-lite codec pack. Just remembered that and tried running the app with only avi and wmv files. So far it has not crashed, so the problem might be due to the other codecs.



  • Apologies for replying to myself. After deinstalling the 3rd party codecs and testing for a while it crashed again, but only once, where before it would crash much more often. This seems to happen when I try to play an MPEG-4 H.264 file.

    BTW, I don't understand why the file doesn't play without any 3rd party codec on Windows 7. Windows Media Player plays it just fine. Shouldn't everything that works in WMP also work in Phonon::VideoPlayer?

    This is a huge problem for the app I'm writing. The customers expect to be able to play common video files, especially if they work in the default media player. WMV can not be used either, since that doesn't work with the Mac version (see "WMV Playback using Phonon::VideoWidget and Flip4Mac fails in 32-Bit builds":http://developer.qt.nokia.com/forums/viewthread/628).

    Any help would be greatly appreciated...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.