Qt World Summit: Register Today!

Phonon, how to switch between different audio streams in one media file?

  • Hi everyone!
    Does anybody knows, how to switch between different audio streams if my media file has more than one?
    Because by default, if I use Phonon::VideoPlayer, it plays the last stream that media file contents.
    I've tried to play aroud the Phonon::MediaController but had no result...
    As I understood somehow I need to get QList Phonon::AudioChannelDescription from Phonon::MediaController but when I call
    availableAudioChannels it comes empty.

    Phonon::MediaController * contr = new Phonon::MediaController(videoPlayer->mediaObject());
    qDebug() << contr->availableAudioChannels().isEmpty(); // returns true

  • I can't find availableAudioChannels() method on http://doc.qt.nokia.com/ site, but I can find this:

    "Warning: The Phonon::MediaController class is not yet supported by Qt backends.":http://doc.qt.nokia.com/5.0-snapshot/phonon-mediacontroller.html (in Qt 5.0 documentation)

    and this:


    If everything is as it should be (backend is properly coupled with Phonon, backend can play multiple streams, you have latest Qt libs with latest Phonon) then it should work (if it compiles fine and is working, who cares what is written in doc :).

    Which platform, which backend, which Qt version?

  • bq. Which platform, which backend, which Qt version? bq.

    Widows, Phonon::VideoPlayer , Qt 4.7.4. It compiles fine, but not working right. I mean it's always palys the last stream in the list. For example if I play the same media in another palyer (Media Player Classic) and if I go to the audio settings, it gives me to choose from audio streams but Phonon::VideoPlayer by default palys the last one and I as i sad i even cant get that list...

  • What backend do you use? VLC?
    I think, it's good to use availableAudioChannelsChanged() signal of MediaController. I have got the result of streaming but using compiled on my own phonon (latest Git) and phonon-vlc (latest Git too) on linux amd64.

Log in to reply