
I've got it working a long time ago, but since this Akademy it is finally available in KDE trunk: Phonon now can give the raw video frames (as RGB, YV12 or YUY2) to an application and Quasar gained a node to upload those frames as textures and uses Shaders to convert YUV formats to RGB and then do arbitrary effects with them. The cool part about that, obviously, is that the data intensive calculations are happening on the graphics card (you need OpenGL 2 for this to work). To demonstrate the power of this I wrote a simple example that connects the PhononInputNode to an EdgeDetection node and then to a RenderNode. I did a screencapture of the result, but that looks a lot worse than the real performance, which is totally smooth and, of course, doesn't show much CPU usage.
You can also see me adjusting the threshold value of the edge detection filter with a keyboard shortcut.
Here's the code:
m_input = new PhononInputNode();
connect(m_input, SIGNAL(needUpdate()), SLOT(updateGL()));
m_compo.addNode(m_input);
m_displayNode = m_compo.createNode("/output/render");
m_saturationNode = m_compo.createNode("/color/edgedetect");
Quasar::link(m_input, "output", m_saturationNode, "texture");
Quasar::link(m_saturationNode, "output", m_displayNode, "texture");
Phonon::createPath(m_media, m_input);
m_compo.prepare();
connect(m_media, SIGNAL(finished()), m_media, SLOT(play()));
m_media->play();
Things to note:
- the PhononInputNode is both a Phonon::MediaNode and a Quasar::Node
- the Quasar API is not final, especially wrt. PhononInputNode