Merge request: Implement video capture device support

Casian Andrei skeletk13 at gmail.com
Mon Jun 28 18:41:01 CEST 2010


Hello,

I worked on Phonon video capture devices last month, as part of GSoC. I have
reached a stage where using a V4L capture device with Phonon and Phonon-VLC
works, so I am proposing a merge request. There is much more work to be
done.

Phonon
===========================================================================
What is provided:
- a method to get a video capture device list
- a method to set the desired capture device by using MediaSource.

Currently it works with V4L devices by using Phonon-VLC.

There are also changes to AudioCaptureDevices, but these are not tested.

There is a test application for video capture. It works fine on my system.
I've
tested it with 2 v4l devices attached. The lines that "make contact" with
the
changes are:

// The part for grabbing a video capture device list
QList<Phonon::VideoCaptureDevice> l =
Phonon::BackendCapabilities::availableVideoCaptureDevices();
m_deviceModel = new Phonon::VideoCaptureDeviceModel(l, 0);

// The part for setting the current video capture device
Phonon::VideoCaptureDevice vc = m_deviceModel->modelData(mi); // mi is the
model index
Phonon::MediaSource mediaSource(vc);

There are other ways of doing the job, including an ugly one (by specifying
the device name directly)


These video capture changes are only implemented in the Phonon-VLC backend.

Some of the changes just uncomment things for VideoCaptureDevice and are
like those for AudioOutputDevice or AudioCaptureDevice.

Summary of the changes:
------------------------------------
backendcapabilities.h --
availableVideoCaptureDevices()
signals for changed video devices

factory_p.h --
signals for changed video devices

globalconfig.h --
deviceProperties(Phonon::ObjectDescriptionType, index)
audioOutputDeviceProperties(index)
audioCaptureDeviceProperties(index)
videoCaptureDeviceProperties(index)

videoCaptureDeviceListFor(Phonon::Category)
videoCaptureDeviceFor(Phonon::Category)

phononnamespace.h.in --
added an enum for CaptureDeviceType. It can be either invalid, or V4LVideo
or Audio. It is used by the MediaSource to know that it uses a capture
device and act accordingly (by using deviceName). This enum may be used for
other types of capture devices, for instance ones that don't have anything
to do with a device name. V4L isn't platform independent, but this name can
be changed because it is mostly used internally. The exception is when
creating a MediaSource by providing a platform-dependent device name.

mediasource.h --
constructors for creating a media source from Phonon::AudioCaptureDevice or
Phonon::VideoCaptureDevice or directly by giving Phonon::V4LVideo and
/dev/videoX

added captureDeviceType, audioCaptureDevice, videoCaptureDevice to the
MediaSource data

objectdescription.h --
added VideoCaptureDeviceType


Phonon-VLC:
=================================================================
What is provided:
- get video capture device list (v4l currently)
- handle v4l capture devices in MediaObject::setSource()

The most changes are in the DeviceManager. The AudioOutputDevice class has
been
changed into a more generic DeviceInfo class. The DeviceManager is able to
provide
lists for audioCaptureDevices, videoCaptureDevices and audioOutputDevices.

The backend can pass a list of v4l devices to Phonon.

There are 2 new files (header + cpp) for grabbing a list of v4l capture
devices. scanDevices() probes what it can find in /dev/videoX. The code is
adapted from vlc
from v4l2 access.


-------------------
Best regards,
Casian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/phonon-backends/attachments/20100628/42ba0308/attachment.htm 


More information about the Phonon-backends mailing list