Phonon/qmusicplayer: Play sound files failed when using decodebin2 pipe
-
Hi Qt experts,
I'm using qt-everywhere-opensource-src-4.7.1 in my system and I find that I can't
play sound files successfully with qmusicplayer or qmediaplayer demo, there is no
error happens in the console.
If I modify phonon to use "decodebin" pipe instead of the default "decodebin2",
sound files can play successfully:--- qt-everywhere-opensource-src-4.7.1.orig/src/3rdparty/phonon/gstreamer/mediaobject.cpp
+++ qt-everywhere-opensource-src-4.7.1/src/3rdparty/phonon/gstreamer/mediaobject.cpp
@@ -495,7 +495,7 @@
gst_object_ref (GST_OBJECT (m_pipeline));
gst_object_sink (GST_OBJECT (m_pipeline));- m_decodebin = gst_element_factory_make ("decodebin2", NULL);
- m_decodebin = gst_element_factory_make ("decodebin", NULL);
g_signal_connect (m_decodebin, "new-decoded-pad", G_CALLBACK (&cb_newpad), this);
g_signal_connect (m_decodebin, "unknown-type", G_CALLBACK (&cb_unknown_type), this);
g_signal_connect (m_decodebin, "no-more-pads", G_CALLBACK (&cb_no_more_pads), this);
==============================================
Moreover, I can play sound files successfully using gst-launch:
gst-launch filesrc location=/root/Explosion.wav ! decodebin2 ! alsasink
gst-launch filesrc location=/root/Explosion.wav ! decodebin ! alsasink
I have little knowledge about Qt, but I think there maybe something wrong with Phonon.
Any help is highly appreciated, thanks in advance!
-
Sorry for the messy code, but the most important part keeps well.
-
Below are some debug info when play the audio file failed:
root@localhost:/> PHONON_GST_DEBUG=3 ./qmusicplayer -qws
"PGST(2): Using GStreamer 0.10.21"
"PGST(2): AudioOutput using alsa audio sink"
"PGST(3): Found new audio device default (DeviceManager 0xdcd10)"
"PGST(2): AudioOutput Using fake audio sink"
"PGST(3): Found new audio device hw:0,0 (DeviceManager 0xdcd10)"
"PGST(2): AudioOutput using alsa audio sink"
"PGST(2): virtual bool Phonon::Gstreamer::AudioOutput::setOutputDevice(int)0 (AudioOutput 0xae660)"
"PGST(2): Backend connected Phonon::Gstreamer::MediaObject to Phonon::Gstreamer::AudioOutput"
QDesktopServices::storageLocation 4 not implemented
"PGST(2): Begin source load (MediaObject 0x204100)"
"PGST(2): Audio track connected (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (typefind) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (decodebin21) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (filesrc0) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (pipeline1) (MediaObject 0x204100)"
"PGST(3): gstreamer: pipeline state set to ready (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (wavparse0) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (typefind) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (filesrc0) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (fakesink4) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (tee2) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (queue3) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (bin3) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (tee2) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (queue3) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (decodebin21) (MediaObject 0x204100)"
"PGST(3): Bus: tag (wavparse0) (MediaObject 0x204100)"
"PGST(2): Meta tags found (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (fakesink4) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (bin3) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (pipeline1) (MediaObject 0x204100)"
"PGST(2): gstreamer: pipeline state set to paused (MediaObject 0x204100)"
"PGST(2): Stream is seekable (MediaObject 0x204100)"
"PGST(2): phonon state request: Stopped (MediaObject 0x204100)"
"PGST(3): Bus: async-done (pipeline1) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (fakesink4) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (tee2) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (queue3) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (bin3) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (wavparse0) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (typefind) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (decodebin21) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (filesrc0) (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (pipeline1) (MediaObject 0x204100)"
"PGST(2): Audio track connected (MediaObject 0x13f020)"
"PGST(2): Begin source load (MediaObject 0x13f020)"
"PGST(2): phonon state changed: Stopped (MediaObject 0x204100)"
"PGST(3): gstreamer: pipeline state set to ready (MediaObject 0x204100)"
"PGST(3): Bus: state-changed (typefind) (MediaObject 0x13f020)"
"PGST(3): Bus: state-changed (decodebin20) (MediaObject 0x13f020)"
"PGST(3): Bus: state-changed (filesrc1) (MediaObject 0x13f020)"
"PGST(3): Bus: state-changed (pipeline0) (MediaObject 0x13f020)"
"PGST(3): gstreamer: pipeline state set to ready (MediaObject 0x13f020)"