Problem using Phonon with Windows CE



  • Hi,

    I am looking for some advice or pointers regarding a problem that I am having using the QT Phonon classes with Windows CE.

    I have built the QT 6.4.3 library using the MS Visual studio nmake command and the following configuration:

    @configure -platform win32-msvc2005 -xplatform wince50colibri-armv4i-msvc2008 -phonon -nomake demos -nomake examples -phonon-wince-ds9 @

    Everything built fine and generally, everything runs as I would expect on my CE development board. However, I am having a problem using phonon within an application. Again, everything builds as expected and all the runtime dll's and plugins all seem to be loading OK too. However, there are no media mime types available at all and (perhaps, unsurprisingly, given the lack of mime types) it will not play MP3 files, which I thought the DS9 backend provided support for via the DirectShow interface. Instead, it just enters an error state (5) when I attempt to play the media.

    Here a simple class to illustrate the problem, and the output from the debugger when run on the CE development board. Any clues regarding what I would need to do to fix this would be much appreciated. Basically, I need to find a way of playing MP3 files from within QT on Windows CE! The MP3 file does exist on that path and the same program (with a slight change to the path) runs fine under XP, where the state changes from 0 to 2 as I would expect and the media plays. I assume there is a problem with the backend / available codecs but I am at a loss as to how to fix that, and the QT documentation is a little terse in that respect!

    @#include "testaudio.h"

    TestAudio::TestAudio(QWidget *parent) :
    QWidget(parent)
    {
    pMediaObject = new Phonon::MediaObject(this);
    pAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);

    if (pMediaObject && pAudioOutput)
    {
    pMediaObject->setCurrentSource(Phonon::MediaSource("/USB HD/Music/Back in Black/Hells Bells.mp3"));
    connect(pMediaObject, SIGNAL(stateChanged (Phonon::State, Phonon::State)),this, SLOT(stateChanged (Phonon::State, Phonon::State)));
    path = Phonon::createPath(pMediaObject, pAudioOutput);

      QStringList list = Phonon::BackendCapabilities::availableMimeTypes();
      qDebug() << "Available Mime types = " << list.count();
      for (int i = 0; i < list.count(); i++)
        qDebug() << list.at(i);
    
      pMediaObject->play();
    }
    

    else
    qDebug() << "Cannot create objects!!";
    }

    TestAudio::~TestAudio()
    {
    path.disconnect();
    if (pMediaObject)
    {
    delete pMediaObject;
    path.disconnect();
    }
    if (pAudioOutput)
    delete pAudioOutput;
    }

    void TestAudio::stateChanged(Phonon::State newState, Phonon::State oldState)
    {
    qDebug() << "State has changed from" << oldState << "to" << newState;
    }@

    Debugger output:
    @
    Load module: TestAudio.exe
    Load module: commctrl.dll
    Load module: shcore.dll
    Load module: ceshell.dll
    Load module: ole32.dll
    Load module: oleaut32.dll
    Load module: ws2.dll
    Load module: winsock.dll
    Load module: msvcr90d.dll
    Load module: fpcrt.dll
    Load module: phonond4.dll
    Load module: QtGuid4.dll
    Load module: QtCored4.dll
    Load module: coredll.dll
    Load module: mmtimer.dll
    Load module: phonon_ds9d4.dll
    Load module: msdmo.dll
    Load module: quartz.dll
    Load module: icm.dll
    Unload module: icm.dll
    Load module: icm.dll
    Unload module: icm.dll
    Available Mime types = 0
    State has changed from 0 to 5
    @



  • Thanks for that.

    Yes I could try that, but I would rather keep the source code as portable a possible. Even though the final compilation is done using VC, I actually do most of the development using Eclipse/GCC under Ubuntu. IMHO, I find that Linux is a much better platform for software development generally. Using anything from MSDN is guaranteed to cause all sorts of problems - Let's face it, portability and Microsoft API's are generally mutually exclusive and the beauty of QT is it hides all that nasty Redmond code.

    It is not at all clear to me what the problem is. Has anyone used phonon to play MP3's on CE? It would seem incredible that no one has any idea why something so fundamental would fail. Any clues as to where the problem may lie would be much appreciated.



  • I had not realised that they were known to be broken, it would be nice if QT said that in their documentation - I guess it is not their time that gets wasted!

    I will have a look at encapsulating some MS API code into a QT class. All I need to do is play single MP3 files, how hard can it be!!! - I will have to run the code on CE to test it anyway so I guess it is not as bad as it first seems.

    Thanks for taking the time to reply - wish me luck!

    If anyone else has written code for Windows to play MP3 files, using native API calls, please feel free to give me some pointers - I know it is off topic, but given the API is broken, it does not seem an unreasonable request.

    Tim


Log in to reply
 

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