Guidelines and HOWTOs/Debugging/Phonon: Difference between revisions
Apachelogger (talk | contribs) can someone please move the install stuff somewhere else?!?!?! |
m Fix syntax highlighting. |
||
Line 4: | Line 4: | ||
Set these environment variables: | Set these environment variables: | ||
< | <syntaxhighlight lang="bash"> | ||
$ export PHONON_DEBUG=5 | $ export PHONON_DEBUG=5 | ||
$ export PHONON_PULSEAUDIO_DEBUG=5 | $ export PHONON_PULSEAUDIO_DEBUG=5 | ||
Line 10: | Line 10: | ||
$ export PHONON_GST_DEBUG=5 | $ export PHONON_GST_DEBUG=5 | ||
$ export PHONON_XINE_DEBUG=5 | $ export PHONON_XINE_DEBUG=5 | ||
</ | </syntaxhighlight> | ||
Then run your program. The terminal will fill up with gobs of debugging output. | Then run your program. The terminal will fill up with gobs of debugging output. | ||
Line 24: | Line 24: | ||
Pulseaudio and phonon try their hardest to get along. Sometimes, it doesn't work. Luckily, there is a way to test gstreamer and pulseaudio to see who is at fault. | Pulseaudio and phonon try their hardest to get along. Sometimes, it doesn't work. Luckily, there is a way to test gstreamer and pulseaudio to see who is at fault. | ||
< | <syntaxhighlight lang="bash"> | ||
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! pulsesink | $ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! pulsesink | ||
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! alsasink | $ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! alsasink | ||
</ | </syntaxhighlight> | ||
If they both work flawlessly, blame Phonon-GStreamer. | If they both work flawlessly, blame Phonon-GStreamer. | ||
Line 52: | Line 52: | ||
Recreating the playback stream of some video file can be done as such: | Recreating the playback stream of some video file can be done as such: | ||
< | <syntaxhighlight lang="bash"> | ||
$ gst-launch filesrc location=/path/to/video ! decdebin2 name=dec ! audioresample ! audioconvert ! pulsesink \ | $ gst-launch filesrc location=/path/to/video ! decdebin2 name=dec ! audioresample ! audioconvert ! pulsesink \ | ||
dec. ! ffmpegcolorspace ! xvimagesink | dec. ! ffmpegcolorspace ! xvimagesink | ||
</ | </syntaxhighlight> | ||
DVD playback is a bit different: | DVD playback is a bit different: | ||
Line 66: | Line 66: | ||
This is built with the following: | This is built with the following: | ||
< | <syntaxhighlight lang="bash"> | ||
$ gst-launch rsndvdbin ! dvdspu ! ffmpegcolorspace ! queue ! xvimagesink \ | $ gst-launch rsndvdbin ! dvdspu ! ffmpegcolorspace ! queue ! xvimagesink \ | ||
rsndvdbin0 ! dvdspu0.subpicture \ | rsndvdbin0 ! dvdspu0.subpicture \ | ||
rsndvdbin0 ! queue ! audioresample ! audioconvert ! pulsesink | rsndvdbin0 ! queue ! audioresample ! audioconvert ! pulsesink | ||
</ | </syntaxhighlight> | ||
= Building Phonon from source = | = Building Phonon from source = | ||
Line 79: | Line 79: | ||
Deb-based distros, run <pre>sudo apt-get build-dep phonon</pre>to be sure you have all dependencies installed. | Deb-based distros, run <pre>sudo apt-get build-dep phonon</pre>to be sure you have all dependencies installed. | ||
<br> | <br /> | ||
OpenSuSE:<pre>sudo zypper si -d phonon</pre> | OpenSuSE: | ||
<pre>sudo zypper si -d phonon</pre> | |||
== Install git == | == Install git == | ||
Line 96: | Line 97: | ||
== Define the PATH and local environment == | == Define the PATH and local environment == | ||
Append the following to $HOME/.bashrc:< | Append the following to <tt>$HOME/.bashrc</tt>: | ||
<syntaxhighlight lang="bash"> | |||
export PATH=$HOME/kde/bin:$PATH | |||
export PATH=/usr/lib/ccache:$PATH | |||
export LD_LIBRARY_PATH=$HOME/kde/lib:$LD_LIBRARY_PATH | |||
</syntaxhighlight> | |||
Reload your edited .bashrc:< | Reload your edited .bashrc: | ||
<syntaxhighlight lang="bash"> | |||
NOTE: if you are not using the bash shell, edit your proper shell config file (~/.zshrc or ~/.tcshrc or whatever it may be). | source $HOME/.bashrc | ||
</syntaxhighlight> | |||
NOTE: if you are not using the bash shell, edit your proper shell config file (<tt>~/.zshrc</tt> or <tt>~/.tcshrc</tt> or whatever it may be). | |||
== Make KDE aware of Phonon’s location == | == Make KDE aware of Phonon’s location == | ||
< | <syntaxhighlight lang="bash"> | ||
echo 'export KDEDIR=$HOME/kde' >> $HOME/.kde/env/myenv.sh | echo 'export KDEDIR=$HOME/kde' >> $HOME/.kde/env/myenv.sh | ||
echo 'export KDEDIRS=$KDEDIR' >> $HOME/.kde/env/myenv.sh</ | echo 'export KDEDIRS=$KDEDIR' >> $HOME/.kde/env/myenv.sh | ||
Some distributions call the above folder $HOME/.kde4/ , such as OpenSuSE. | </syntaxhighlight> | ||
Some distributions call the above folder <tt>$HOME/.kde4/</tt>, such as OpenSuSE. | |||
== Install locally== | == Install locally== | ||
Install in your $HOME dir):< | Install in your $HOME dir): | ||
<syntaxhighlight lang="bash"> | |||
mkdir $HOME/kde && cd kde && mkdir src && cd src | mkdir $HOME/kde && cd kde && mkdir src && cd src | ||
git clone git://anongit.kde.org/phonon | git clone git://anongit.kde.org/phonon | ||
cd phonon && mkdir build && cd build | cd phonon && mkdir build && cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/phonon | cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/phonon | ||
sudo make install | |||
</syntaxhighlight> | |||
To update your build, it's even easier: | |||
<syntaxhighlight lang="bash"> | |||
To update your build, it's even easier: < | |||
cd ~/kde/src/phonon | cd ~/kde/src/phonon | ||
git pull | git pull | ||
cd build && sudo make install | |||
cd build && sudo make install</ | </syntaxhighlight> | ||
== Build locally from a tarball == | == Build locally from a tarball == | ||
This is 4.4.4 for example:< | This is 4.4.4 for example: | ||
<syntaxhighlight lang="bash"> | |||
cd ~/kde/src/ | cd ~/kde/src/ | ||
wget http://download.kde.org/download.php?url=stable/phonon/4.4.4/src/phonon-4.4.4.tar.bz2 | wget http://download.kde.org/download.php?url=stable/phonon/4.4.4/src/phonon-4.4.4.tar.bz2 | ||
tar xf phonon-4.4.4.tar.bz2 | tar xf phonon-4.4.4.tar.bz2 | ||
cd phonon-4.4.4 && mkdir build && cd build | cd phonon-4.4.4 && mkdir build && cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/phonon-4.4.4 | cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/phonon-4.4.4 | ||
sudo make install | |||
sudo make install</ | </syntaxhighlight> |
Revision as of 16:26, 27 June 2011
Environment Variables
In general, there is one easy way to give Phonon devs all the information they need to help fix your problem.
Set these environment variables:
$ export PHONON_DEBUG=5
$ export PHONON_PULSEAUDIO_DEBUG=5
$ export PHONON_VLC_DEBUG=5
$ export PHONON_GST_DEBUG=5
$ export PHONON_XINE_DEBUG=5
Then run your program. The terminal will fill up with gobs of debugging output.
Phonon-GStreamer debugging
Even more verbose output
Phonon-gst has some fancier debug options available. In addition to PHONON_GST_DEBUG, there is PHONON_GST_GST_DEBUG. Setting it to 8 or so will cause the gstreamer libraries to produce copious quantities of debug output. We're talking thousands of lines of what seems to be useless noise. Roughly 1% of it is useful, but the phonon-gst devs can easily decipher it and drill down to the important bits.
Pulseaudio
Pulseaudio and phonon try their hardest to get along. Sometimes, it doesn't work. Luckily, there is a way to test gstreamer and pulseaudio to see who is at fault.
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! pulsesink
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! alsasink
If they both work flawlessly, blame Phonon-GStreamer.
If the first works but the second doesn't, you might have an exotic sound setup that involves tweaking the alsasink parameters to reflect what pulseaudio does to alsa.
If the second works but the first doesn't, you can blame pulseaudio.
Another way to confirm this is by setting the PHONON_GST_AUDIOSINK environment variable. Setting it to e.g. "pulsesink" uses the pulseaudio sink.
Recreating the phonon-gst pipeline
Phonon-GStreamer creates predicable pipelines. In general, they look like this:
filesrc -> decodebin2 -> queue -> audioresample -> audioconvert -> pulsesink \ -> ffmpegcolorspace -> queue -> xvimagesink
If the input stream isn't coming from a file, it is likely coming in via KIO which pipes it into an abstractmediastream. If pulseaudio isn't used, then replace pulsesink with something of alsasink, osssink, or somesuch.
Recreating the playback stream of some video file can be done as such:
$ gst-launch filesrc location=/path/to/video ! decdebin2 name=dec ! audioresample ! audioconvert ! pulsesink \
dec. ! ffmpegcolorspace ! xvimagesink
DVD playback is a bit different:
(subpicture stream) /--->---\ rsndvdbin -> dvdspu -> ffmpegcolorspace -> queue -> xvimagesink \-> queue -> audioresample -> audioconvert -> pulsesink
This is built with the following:
$ gst-launch rsndvdbin ! dvdspu ! ffmpegcolorspace ! queue ! xvimagesink \
rsndvdbin0 ! dvdspu0.subpicture \
rsndvdbin0 ! queue ! audioresample ! audioconvert ! pulsesink
Building Phonon from source
If you want to have a newer Phonon build than 4.4.3 which is currently shipped by most distributions in KDE 4.6, you can build from source (git). Phonon is now located on git.kde.org.
Get Dependencies
Deb-based distros, run
sudo apt-get build-dep phonon
to be sure you have all dependencies installed.
OpenSuSE:
sudo zypper si -d phonon
Install git
In Kubuntu, Debian, etc.:
sudo apt-get install git-core
In Archlinux:
sudo pacman -Sy git
In Gentoo:
sudo emerge -av dev-util/git
In OpenSuSE:
sudo zypper install git
Install ccache to speed up compilation
Install the package from your distribution and set the size of the cache to 2 GB with the command
ccache -M 2G
This will take 2Gb of space in your local directory. Enable the use of ccache by adding it to your local .bashrc, described below.
Define the PATH and local environment
Append the following to $HOME/.bashrc:
export PATH=$HOME/kde/bin:$PATH
export PATH=/usr/lib/ccache:$PATH
export LD_LIBRARY_PATH=$HOME/kde/lib:$LD_LIBRARY_PATH
Reload your edited .bashrc:
source $HOME/.bashrc
NOTE: if you are not using the bash shell, edit your proper shell config file (~/.zshrc or ~/.tcshrc or whatever it may be).
Make KDE aware of Phonon’s location
echo 'export KDEDIR=$HOME/kde' >> $HOME/.kde/env/myenv.sh
echo 'export KDEDIRS=$KDEDIR' >> $HOME/.kde/env/myenv.sh
Some distributions call the above folder $HOME/.kde4/, such as OpenSuSE.
Install locally
Install in your $HOME dir):
mkdir $HOME/kde && cd kde && mkdir src && cd src
git clone git://anongit.kde.org/phonon
cd phonon && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/phonon
sudo make install
To update your build, it's even easier:
cd ~/kde/src/phonon
git pull
cd build && sudo make install
Build locally from a tarball
This is 4.4.4 for example:
cd ~/kde/src/
wget http://download.kde.org/download.php?url=stable/phonon/4.4.4/src/phonon-4.4.4.tar.bz2
tar xf phonon-4.4.4.tar.bz2
cd phonon-4.4.4 && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull $HOME/kde/src/phonon-4.4.4
sudo make install