In my quest of bringing Phonon, the best multimedia abstraction library from KDE, to QML and Qt Quick I have reached another big iteration.
Following iteration 1 there is a now a new branch called ‘qml-i2‘ for iteration 2.
While i1 was using only existing experimental technology of Phonon, namely the VideoDataOutput class, i2 has moved away from this and now features a closer relation with the Phonon backend (currently only GStreamer).
Also I spent half an hour on creating an alternative appearance for the demo player. It is using Nokia Meego 1.2 Harmattan Qt Quick Components and I already ran it on a Nokia N950, the developer version of the Nokia N9 – looks really slick.
Hot new stuff:
- Closer to backend
- Redrawing only of space occupied by video frame
- Pull instead of push frame access -> no memcopy
- Faster due to above
- Still raster/qimage based frame drawing
- Demo player in demos/qml/videoplayer much improved
- Harmattan demo player
The overall architecture is really simple to explain:
There are 3 QML Elements for Audio, Video and the Media control itself. The Video element uses a class called VideoGraphicsObject which implements the drawing logic. The VideoGraphicsObject connects to a backend implementation via a well defined interface. The backend implementation does magic in order to obtain raw video data from the video pipeline, emits a signal that a new frame is ready and the VideoGraphicsObject does the drawing.
What is particularly interesting is the way we currently access the frame data. The backend implementation holds exactly one frame, consequently either the pipeline or the VideoGraphicsObject hold a lock on the frame. This has three particular advantages for the time being: a) it does avoid any sort of object copy b) it allows the pipeline to adapt to drawing speed and frequency c) always the most current frame is drawn, even if the drawing operation was delayed.
To test qml-i2 you’ll need both the qml-i2 branch from the Phonon git repository as well as the qml-i2 branch from the Phonon GStreamer git repository. After installing both you should be able to run the demo player in Phonon’s demos/qml/videplayer folder.