GSOC Proposal: Webcams in Phonon

Trever Fischer tdfischer at fedoraproject.org
Mon Mar 29 18:46:26 BST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, I'm Trever Fischer (tdfischer on IRC, when my ISP permits). I'd like
to work
on getting webcam support into Phonon. I've read the description from the
videolan wiki
(http://wiki.videolan.org/SoC_2010#High-Level_Capture_API_for_Phonon_.28read:_Webcam_Support.29),
and its really what I've been planning on doing for a while
(http://wm161.net/2009/12/29/webcams-in-phonon/)
but school got in the way. Doing GSOC in summer, I won't have 21 credit hours
and running a good sized student organization pounding down on me :)

Between classes, I've been working on adding v4l2 support to xine with the
new
v4l2 plugin I wrote, and which is now in their mercurial repository. That
gives
me a working backend for my one good webcam, which doesn't support v4l1.

My proposal for adding video devices to phonon follows. Any comments or
criticisms are welcome!

- --
Phonon Video Devices - Trever Fischer

Phonon is a KDE API for handling multimedia, which is designed to hide all
the
annoying details involved such as codecs, outputting to devices, routing
'types'
of multimedia to different devices, and recording media.

Currently, Phonon lacks a working API for video capture. It currently
requires
only 2 lines of code (not counting GUI setup) to play any kind of video file:

     Phonon::VideoPlayer *player =
         new Phonon::VideoPlayer(Phonon::VideoCategory, parentWidget);
     player->play(url);
(taken from http://doc.trolltech.com/4.6/phonon-overview.html#playback)

It should be just as easy to play a webcam's input. Idealy, the code would be
similar to:

    Phonon::VideoPlayer *player =
        new Phonon::VideoPlayer(Phonon::VideoCategory, parentWidget);
    QList<Solid::Device> webcams =
        Solid::Device::listFromType(Solid::DeviceInterface::Video);
    Solid::Video webcam = webcams[0].as<Solid::Video>()
    player->play(webcam);

As you can see, the Solid hardware libary would be involved in the
enumeration
and description of devices. We should be able to take a video device from
Solid
and pass it immediately off to Phonon, which then handles opening the
device and
creating a stream.

The tasks for this project would be:

1. Design a video capture API for Phonon which:
1.a Allows for low-level tweaking of the device such as specifying video
formats, audio formats, buffer sizes, color correction, etc. Pretty much
    everything allowed for under Video4Linux2, the Windows API, and the
Mac API.
1.b Allows the simple 2 lines of phonon code above.
1.c Follows the strict qt-only design currently used.
2. Implement video capture support into the VLC and/or xine backends.
3. Build a simple video viewer application for testing, which can then
turn into
a useful webcam capture application, similar to Photobooth for Mac OSX.

1. Design a video capture API

There currently is an experimental audio and video capture API in the
Phonon git
epository under phonon/experimental which hasn't had any significant commits
since November 20th, 2009, not counting the commits I myself made in December
2009 to phonon/experimental/videocapture/ which fixed a regression of losing
v4l2 support for my webcam. Regardless of age, this experimental API can
serve
as an excellent starting point for the first task.

2. Implement video capture support into the VLC and/or xine backends.

A working API is useless if there isn't a working backend.

Support for the new video capture API would need to be added first to the
existing VLC backend, and to the other backends if time permits.

3. Build a simple video viewer application for testing

A good API needs real-world use to find bugs, inconsistencies, and design
problems. As part of this proposal, a simple application would need to be
created that uses the capture API to take snapshots and record video.
Later on,
this application can be extended to provide a use similar to Photobooth
for the
OSX operating system. In Photobooth, the user starts the application which
then
displays a window showing the video stream from the primary webcam. From
there
they can take snapshots and record video, while at the same time applying
various entertaining image processing effects. Effects and a friendly
interface
are beyond the scope of this project, as we only need a quick demo
application.

Further work:
Once the project is complete, further work could be done to improve the
capture application to provide the experience described above. The video
capture support would also need to be implemented in the other phonon
backends.

Time:
I would expect to use at least a third of the time on designing and
implementing
the API which will be used far into the future. The other two thirds would
likely be spent on implementing the required backend support into the VLC
backend. If I am successful in producing a good design, writing a simple
capture
application would take a few hours at most.

Biography:
I am currently finishing my 3rd year of my undergraduate masters in Computer
Science at the University of Akron in Akron, Ohio, USA. I first started using
KDE on my Fedora Core 3 system around the time 3.3 was recently released.
Since
then I have become my campus' Fedora Ambassador, created the microblog plasma
data engine, the Bubblemon plasma widget, device-automounter for
automatically
mounting removable storage, and various patches and commits to other parts of
KDE.

In general I can be found in #kde, #kde-devel, #fedora, or #kde-cafe on
freenode
as tdfischer, whenever my ISP decides today is the day I don't get a 30
minute
ping.

- --
Trever Fischer (tdfischer)
Fedora Ambassador, KDE Hacker
http://wm161.net
GPG: C40F2998 hkp://wwwkeys.pgp.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkuw53IACgkQNg53/sQPKZhrkwCZAXvp+WNQTf1BNgVnJoa/NlmH
vzcAn07w8mVNRukkzcKwYOCR+gYXEDVY
=JiK2
-----END PGP SIGNATURE-----



More information about the kde-multimedia mailing list