Part I kde bug.
During the last 2 weeks I had to fight against a KDE4 (kdelibs) bug: I was no more able to build a proper KDE System Configuration Cache ksycoca. Everything was set up according to the docs, the debug output of kde apps was not spotting any problem, some components were even able to run... but I could not use kcmshell (the KDE control center application and framework).
The problem with ksycoca was triggered by the presence of the /etc/xdg/menus/applications.menu file. That file is installed by the gnome-menus package on kubuntu dapper (the distro I'm using). The effect of the the bug is that kbuildsycoca is no more able to find the proper KDE4 .menu files after processing /etc/xdg/menus/applications.menu.
Finding that out was really difficolt (I'd never been able to do that on my own, Vir and dfaure helped a lot on freenode #phonon and #kde4-devel): first we had to find out that the problem was ksycoca related, then we had to figure out that this problem was caused by the presence of /etc/xdg/menus/applications.menu even if kbuildsycoca does not print a single warning or error when analyzing that file.
Part II: ByteStreamNode properly coded.
My prevoius attempt to write the ByteStreamNode was succesfull in practice, but it was coded without compliance to the NMM architecture (I was not skilled enought).
Thanks to the the help of Marco (my menthor) I finally understood how to pass data to remote running nodes using NMM proxies and interface. NMM is a so powerfull architecture that understanding all of it at a time is hard even if the docs are very usefull and cover most aspect.
Using sample code that Marco sent me I could code a proper NMM::Interface for ByteStreamNode.
The interface is:
module NMM{
interface IByteStreamNode {
void sendBuffer2(in TransferBuffer2 buffer);
int getSize();
int getMaxSize();
};
}
Using ByteStreamNode and its interface IByteStreamNode it is possible to inject arbitrary data from applications into NMM flow graphs. To achieve this the application developer creates the flow graph as described in the NMM documentiation using NMM::ByteStreamNode as the source node and using its interface to send data to the node. Data sent to the node is buffered into a streamqueue from where processBuffer (the "main/core" function of NMM nodes) extracts it later. The application can query the current fill size and maximum allowed size of the internal streamqueue using the interface functions getSize and getMaxSize.
The only cave at for using ByteStreamNode is that the first chunk of data must be passed to the node (using sendBuffer2) before initOutput is called in order to let initOutput to find data mime-type (using libmagic).
The phonon nmm backend uses ByteStreamNode as a fallback when a NMM unsupported protocol is specified in the url to be played. For such urls NMM throws an exception in GraphHandler::stage1 which is catched by Phonon and used to trigger the creation of a Phonon::ByteStream object. That object is responsible for calling GraphHandler::stage1_bs and passing data to the returned IByteStreamNode interface. Another task for Phonon::ByteStream is to suspend and resume the KIO::TransferJob as soon as the ByteStreamNode's internal StreamQueue gets full or empty.
Part III: plans
After all this learning and coding I'm becoming more experienced with both NMM andn Phonon.
I thought I would have been able to proceed faster, but KDE4 beeing not mature and NMM beeing a completely new concept to me really slowed me down since now.
My next steps will be:
- Resurrect the config-app
- Implement AudioOutputDevice selection (the interface that let users chose which NMM audio output node to use)
- VolumeControlNode: a software volume slider node