Results 1 to 7 of 7

Thread: Phonon AbstractMediaStream

  1. #1
    Join Date
    Apr 2008
    Posts
    17
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Phonon AbstractMediaStream

    I am trying to play audio data incoming by QUdpSocket. I use Phonon::AbstractMediaStream with Phonon::MediaSource, but AbstractMediaStream::needData is never called. I do not know what I do wrong.

    thanks for advices!

    Regards,
    Michal
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2008
    Posts
    47
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Phonon AbstractMediaStream

    Which backend are you using?

    Only Xine-backend supports the AbstractMediaStream (AMS) class (as implemented by Matthias Kretz).

    The backends DS9, GStreamer and QT were implemented by Qt and the trolls decided to not support AbstractMediaStream - you don't find this class in Qt docu, but in Phonon docu.

    Qt told me that they will look into it again with 4.6 version.

    All my tests with DS9 and GStreamer confirmed the issue.

    In case you are already using Xine backend, please also show the MediaObject call.
    Do you call e.g. mymediaobject->play()?

    Update:
    Your implementation:
    - You may be writing to AMS before needData was called. You shouldn't do that.
    - NeedData may be called but your buffer maybe empty (here GStreamer has the issue), so you write 0 bytes to AMS. Also bad - Xine can handle it, afaicr. Ensure that you write something or it is the end of the stream.
    - You can now use xine-backend without KDE dependencies out of the KDE4.2 phonon release

    If you are dependend on GStreamer you can only implement your own QIODevice then for asynchronous datastream (wich I needed to do at the end as proposed by the trolls).
    I know: For asynchronous datastreams, AMS is so much easier to handle than implementing your own QIODevice.
    Last edited by muellerp; 29th January 2009 at 19:21.

  3. #3
    Join Date
    Apr 2008
    Posts
    17
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Phonon AbstractMediaStream

    I use DirectSound9. So AbstractMediaStream is not suitable for me. Thanks for that.

    If I understood well, the only solution is to write my own implementation of sequential mode QIOdevice class. Could it work depending on DirectSound9 as well as on Linux native audio interface?

    Is there some example of such implementation? Could you provide some link to example or tutorial?

  4. #4
    Join Date
    Jul 2008
    Posts
    47
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Phonon AbstractMediaStream

    Just out of curiosity:
    The UDP socket you have is a QIODevice already.
    Why don't you use it for the medioobject as source?

    You only need to implement your own QIODevice for the case (like me) where you have a custom format.
    I assume you have the native media data in your UDP stream that you anyway just want to pass to Phonon.

    If this doesn't work:
    Qt is cross platform and it should work on all platforms.
    The only thing not guaranteed is that some media formats are only supported by some phonon backends. E.g. Xine can really play everything out of the box while for DS9 you may first need to install some codecs and for gstreamer or QT it may not exist. But bread and butter formats are working on all backends.
    As an example: Just use the Qt sources as I did (all classes that are derived from qiodevice). I wouldn't say that my code is good enough as an example to look in, but if you want - look for QtVomp in google. The class is iostream.
    Last edited by muellerp; 30th January 2009 at 04:55.

  5. The following user says thank you to muellerp for this useful post:

    kodiak (2nd February 2009)

  6. #5
    Join Date
    Apr 2008
    Posts
    17
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Phonon AbstractMediaStream

    I have tried to use QUdpSocket as a source. Unfortunately it does not work in my configuration. Phonon::MediaObject get error state.

    I will migrate to msvc 2008 and hope it will help. What do you think? Trolltech docs stands that there should be msvs 2008 used to compile phonon. I will write in this thread results of my environment upgrade.

    Thanks for your QIODevice implementation. I will try to write my own if upgrade does not help.

  7. #6
    Join Date
    Jul 2008
    Posts
    47
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Phonon AbstractMediaStream

    Quote Originally Posted by kodiak View Post
    I have tried to use QUdpSocket as a source. Unfortunately it does not work in my configuration. Phonon::MediaObject get error state.

    I will migrate to msvc 2008 and hope it will help. What do you think? Trolltech docs stands that there should be msvs 2008 used to compile phonon. I will write in this thread results of my environment upgrade.

    Thanks for your QIODevice implementation. I will try to write my own if upgrade does not help.
    I don't think 2008 instead of 2005 will make a big difference.

    Please try if Phonon understands your format:
    1) Take the stream and store it "as is" in a file
    2) Open the file with the phonon demo or example player
    If it plays with one of these players then it is not a Phonon issue.

    I assume it is rather the issue with how you are passing the data to phonon. Phonon is state based and asynchronous. So you cannot assume that e.g. once you have called mediaobject->play() it is already playing. It is only playing when stateChanged is called with new state playing.

    What states is phonon getting in? Buffering, loading, playing... before it gets into error state?

  8. #7
    Join Date
    Apr 2008
    Posts
    17
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Phonon AbstractMediaStream

    Phonon understand format very well. If I store incoming datagrams in QByteArray and than pass to phonon through QBuffer => QMediaSource then it plays good, but not streaming. I did some simple implenetation of QIODevice reading directly from file and it also works if ::isSequential method returns false. If ::isSequential returns true, the media object gets ErrorState.

    MediaObject::stateChanged is emited only once: LoadingState => ErrorState

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.