November 30, 2010

tjnic tjnic
Lab Rat
4 posts

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:

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

  1. #include "testaudio.h"
  2.  
  3. TestAudio::TestAudio(QWidget *parent) :
  4.   QWidget(parent)
  5. {
  6.   pMediaObject = new Phonon::MediaObject(this);
  7.   pAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
  8.  
  9.   if (pMediaObject && pAudioOutput)
  10.     {
  11.       pMediaObject->setCurrentSource(Phonon::MediaSource("/USB HD/Music/Back in Black/Hells Bells.mp3"));
  12.       connect(pMediaObject, SIGNAL(stateChanged (Phonon::State, Phonon::State)),this, SLOT(stateChanged (Phonon::State, Phonon::State)));
  13.       path = Phonon::createPath(pMediaObject, pAudioOutput);
  14.  
  15.       QStringList list = Phonon::BackendCapabilities::availableMimeTypes();
  16.       qDebug() << "Available Mime types = " << list.count();
  17.       for (int i = 0; i < list.count(); i++)
  18.         qDebug() << list.at(i);
  19.  
  20.       pMediaObject->play();
  21.     }
  22.   else
  23.     qDebug() << "Cannot create objects!!";
  24. }
  25.  
  26. TestAudio::~TestAudio()
  27. {
  28.   path.disconnect();
  29.   if (pMediaObject)
  30.     {
  31.       delete pMediaObject;
  32.       path.disconnect();
  33.     }
  34.   if (pAudioOutput)
  35.     delete pAudioOutput;
  36. }
  37.  
  38. void TestAudio::stateChanged(Phonon::State newState, Phonon::State oldState)
  39. {
  40.   qDebug() << "State has changed from" << oldState << "to" << newState;
  41. }

Debugger output:

  1. Load module: TestAudio.exe
  2. Load module: commctrl.dll
  3. Load module: shcore.dll
  4. Load module: ceshell.dll
  5. Load module: ole32.dll
  6. Load module: oleaut32.dll
  7. Load module: ws2.dll
  8. Load module: winsock.dll
  9. Load module: msvcr90d.dll
  10. Load module: fpcrt.dll
  11. Load module: phonond4.dll
  12. Load module: QtGuid4.dll
  13. Load module: QtCored4.dll
  14. Load module: coredll.dll
  15. Load module: mmtimer.dll
  16. Load module: phonon_ds9d4.dll
  17. Load module: msdmo.dll
  18. Load module: quartz.dll
  19. Load module: icm.dll
  20. Unload module: icm.dll
  21. Load module: icm.dll
  22. Unload module: icm.dll
  23. Available Mime types =  0
  24. State has changed from 0 to 5

2 replies

December 4, 2010

tjnic tjnic
Lab Rat
4 posts

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.

December 4, 2010

tjnic tjnic
Lab Rat
4 posts

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

 
  ‹‹ conditional compiling depending on target      Error::"videoWidget.h" doesn’t include <QObject> ››

You must log in to post a reply. Not a member yet? Register here!