Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Random crashes while playing videos through Phonon on Windows
Forum Updated to NodeBB v4.3 + New Features

Random crashes while playing videos through Phonon on Windows

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haikoschol
    wrote on 25 Aug 2010, 16:06 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      haikoschol
      wrote on 27 Aug 2010, 10:56 last edited by
      #2

      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...

      1 Reply Last reply
      0

      1/2

      25 Aug 2010, 16:06

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved