|
|
|
|
|
|
|
|
|
|
|
|
|
|
HOW TO WRITE A PLUGIN
|
|
|
|
|
=====================
|
|
|
|
|
|
|
|
|
|
we need a audio cd player and a grabber and <insert your cool plugin here>
|
|
|
|
|
The Plugin approach is minimalistic.
|
|
|
|
|
|
|
|
|
|
The plugin interface only supports one thing:
|
|
|
|
|
|
|
|
|
|
* open a stream play it and then close it.
|
|
|
|
|
|
|
|
|
|
nothing more.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For this you have a class "decoderPlugin.cpp" derive your decoder
|
|
|
|
|
from this class and then overwrite the decoder_loop method.
|
|
|
|
|
Thats it.
|
|
|
|
|
|
|
|
|
|
The typical structure in decoder loop look like this:
|
|
|
|
|
|
|
|
|
|
void decoder_loop() {
|
|
|
|
|
|
|
|
|
|
1. make instance of decoder and connect it to the input/output
|
|
|
|
|
2. go in loop and check sometime a few mutex variables
|
|
|
|
|
3. leave loop and destroy your decoder
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
For this your have 3 examples how it can be done.
|
|
|
|
|
I think splayPlugin.cpp and mpegPlugin.cpp are clean/good
|
|
|
|
|
examples for "education".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If your decoder supports "seek" you are a bit on your own.
|
|
|
|
|
You can look in splayPlugin.cpp how it is handled there.
|
|
|
|
|
If your decoder supports seek you must overwrite the seek method.
|
|
|
|
|
|
|
|
|
|
Ok, now you have your raw plugin.
|
|
|
|
|
If you want to make it a real KDE compliant player with arts integration
|
|
|
|
|
you need to write an arts plugin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
further readings
|
|
|
|
|
======================
|
|
|
|
|
|
|
|
|
|
* This interface doesn<73>t offer a gui based config dialog
|
|
|
|
|
|
|
|
|
|
To my mind a configuration dialog does not belong into a decoder plugin.
|
|
|
|
|
And that<61>s the main reason why other solutions are not portable:
|
|
|
|
|
The plugin interface depend on a widget lib.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* This version has a completely reworked plugin interface.
|
|
|
|
|
I removed the C bindings. And now the interface is C++.
|
|
|
|
|
This made it much more readable.
|
|
|
|
|
This should make it a bit easier to inlcude new decoders.
|
|
|
|
|
For example look in the directories for mainXYZ.cpp
|
|
|
|
|
|
|
|
|
|
inputPlugin:
|
|
|
|
|
inputInterfaces like file,http,buffered(loopback) ,cdi
|
|
|
|
|
outPlugin :
|
|
|
|
|
output for audio/video
|
|
|
|
|
playerPlugin:
|
|
|
|
|
this is the base class fo new decoders
|
|
|
|
|
splay :
|
|
|
|
|
mpeg I Layer 1,2,3 audio decoder
|
|
|
|
|
mpegplay :
|
|
|
|
|
mpeg I video decoder
|
|
|
|
|
mpgplayer :
|
|
|
|
|
mpeg I audio/video decoder
|
|
|
|
|
tplay :
|
|
|
|
|
wav decoder
|
|
|
|
|
vorbisPlugin:
|
|
|
|
|
vorbis decoder.(GPLed mp3 replacement, better compression,
|
|
|
|
|
better sound ->www.xiph.org)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|