Results 1 to 11 of 11

Thread: Playing ogg files without QMediaPlayer

  1. #1
    Join Date
    Dec 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Playing ogg files without QMediaPlayer

    Using Qt 5, i want to play ogg files, but i want the user can choose the outputdevice (i.e. HeadSet, speakers)
    While QMediaplayer is not able to set a outputdevice, i want to play ogg files in an other way.

    I was thinking to use QAudioOutput but it only play uncompressed files
    QAudioDecoder decompresses the files in a QAudioBuffer but i don't know how to play them

    Help needed

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Playing ogg files without QMediaPlayer

    Can't the use choose the output device through the system's audio tools?

    At least on Linux that works independent of the application creating the audio, it is simply controlled by PulseAudio.

    Cheers,
    _

  3. #3
    Join Date
    Dec 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Playing ogg files without QMediaPlayer

    Thanks for your reply
    But no, children may change the outputdevice in the software. This was possible with phonon without pain And this may be portable on other plateform Desktop, laptop, tablet linux windows Android.
    QAudioRecorder can change simply his inputdevice why QMediaPlayer not ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing ogg files without QMediaPlayer

    I think you can couple QAudioDecoder with QAudioOutput. Decoded frames can be written to a device returned from QAudioOutput::start().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Playing ogg files without QMediaPlayer

    Quote Originally Posted by wysota View Post
    I think you can couple QAudioDecoder with QAudioOutput. Decoded frames can be written to a device returned from QAudioOutput::start().
    I think you're right. Unfortunatly, i don't know how to do this.

    jlf

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Playing ogg files without QMediaPlayer

    Quote Originally Posted by frucot View Post
    This was possible with phonon without pain
    That may be a stupid question, but it it works with Phonon, why not use Phonon?

    Cheers,
    _

  7. #7
    Join Date
    Dec 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Playing ogg files without QMediaPlayer

    Because of Qt 5 phonon isn't available.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing ogg files without QMediaPlayer

    Quote Originally Posted by frucot View Post
    Unfortunatly, i don't know how to do this.
    What have you tried so far?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Dec 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Playing ogg files without QMediaPlayer

    I can decode an ogg file with QAudioDecoder *m_decoder and i get a QAudioBuffer by doing m_decoder->read() in a slot called on signal bufferready.
    But i can't pass this QAudioBuffer to QAudioOuput who need a QIODevice*
    I think i may subclass QIODevice to give QAudioOutput the ability to read this QAudioBuffer. right ?
    At this point, i don't know what to do

    sorry for my poor english

  10. #10
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Playing ogg files without QMediaPlayer

    Quote Originally Posted by frucot View Post
    Because of Qt 5 phonon isn't available.
    There was no release yet, true. Might still be easier to use it from source than switching multimedia APIs.

    Cheers,
    _

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing ogg files without QMediaPlayer

    Quote Originally Posted by frucot View Post
    I can decode an ogg file with QAudioDecoder *m_decoder and i get a QAudioBuffer by doing m_decoder->read() in a slot called on signal bufferready.
    But i can't pass this QAudioBuffer to QAudioOuput who need a QIODevice*
    I think i may subclass QIODevice to give QAudioOutput the ability to read this QAudioBuffer. right ?
    At this point, i don't know what to do

    sorry for my poor english
    If you call QAudioOutput::start() it will return an QIODevice instance you should write your audio frames to. So whenerver you have data in the buffer, just write it to the device returned by QAudioOutput.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Playing MP4 and FLV with QMediaPlayer
    By JasonKretzer in forum Newbie
    Replies: 2
    Last Post: 12th September 2013, 22:58
  2. playing mp3 files via QT
    By kerim in forum Qt Programming
    Replies: 2
    Last Post: 21st April 2011, 14:37
  3. Playing 2 wav files continously
    By HanyM.Magdy in forum Qt Programming
    Replies: 3
    Last Post: 5th October 2010, 17:11
  4. QSound problem playing different wav files
    By couker in forum Qt Programming
    Replies: 6
    Last Post: 16th September 2009, 21:38
  5. Playing Media files in Qt 4
    By sar_van81 in forum Qt Programming
    Replies: 2
    Last Post: 18th December 2007, 06:53

Tags for this Thread

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.