Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-05

V4L1 and V4L2 all in one unit

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd

Hi,

after some more research into the entire V4L topic and after looking into the 5dpo package which contains an almost complete V4L2 implementation (but unfortunately no code for V4l1 and I need both versions) I have made a little unit that solves my problem in a very simple way:

* It is using V4l1 API only
* It is using the libv4l1.so wrapper library for V4L2 compatibility
* libv4l1 will also transparently decode all known image formats and encodings of the V2 cameras (V2 does not allow decoding inside the driver anymore) into uncompressed BGR24 or YUV420p on the fly.

I have made a little camera application with it (similar to xawtv) and it was the first day in my life where I could see how all my cameras (V1 and V2) could work with the *same* application (some worked only with xawtv, one worked only with mplayer, one did never work before at all).

This unit will be part of a small application that I will soon release under GPL. The Unit is licensed under modified LGPL.

Attached is the v4l1 unit. Enjoy!

Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v4l1.pas
Type: text/x-pascal
Size: 20500 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110502/790865b0/attachment-0001.bin>

Reply by email

Sven Barth
to Bernd

I just thought that you should know this:

V4L1 support was removed from the 2.6.38 kernel, so devices that weren't switched to V4L2 till then won't work anymore (I don't know a list of those though...)

Regards,
Sven

Bernd wrote 34 lines
Hi, after some more research into the entire V4L topic and after looking into the 5dpo package which contains an almost complete V4L2 implementation (but unfortunately no code for V4l1 and I need both versions) I have made a little unit that solves my problem in a very simple way: * It is using V4l1 API only * It is using the libv4l1.so wrapper library for V4L2 compatibility * libv4l1 will also transparently decode all known image formats and encodings of the V2 cameras (V2 does not allow decoding inside the driver anymore) into uncompressed BGR24 or YUV420p on the fly. I have made a little camera application with it (similar to xawtv) and it was the first day in my life where I could see how all my cameras (V1 and V2) could work with the *same* application (some worked only with xawtv, one worked only with mplayer, one did never work before at all). This unit will be part of a small application that I will soon release under GPL. The Unit is licensed under modified LGPL. Attached is the v4l1 unit. Enjoy! Bernd -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Bernd
to Sven Barth

2011/5/2 Sven Barth :

V4L1 support was removed from the 2.6.38 kernel, so devices that weren't switched to V4L2 till then won't work anymore

Yes, this is true. Unfortunately there are still old cameras that have only a V1 driver..

But even if v4l1 support is removed from the kernel this unit should still continue to work with the remaining V2 cameras because it does not use any V1 ioctls that would have to be handled by the kernel itself, it is using only ioctls that would be emulated by libv4l1.

Reply by email

Mark Morgan Lloyd
to Bernd
Bernd wrote 12 lines
2011/5/2 Sven Barth : > V4L1 support was removed from the 2.6.38 kernel, so devices that weren't > switched to V4L2 till then won't work anymore Yes, this is true. Unfortunately there are still old cameras that have only a V1 driver.. But even if v4l1 support is removed from the kernel this unit should still continue to work with the remaining V2 cameras because it does not use any V1 ioctls that would have to be handled by the kernel itself, it is using only ioctls that would be emulated by libv4l1.

I've not got any systems with cameras up to 2.4.38 yet, but I'm grateful for Sven's warning.

In practice I find the libv4l compatibility shim to be extremely useful.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to Bernd: 2011/5/2 Sven Barth : Yes, this is true. Unfortunately there are still old cameras that…
Bernd wrote 12 lines
2011/5/2 Sven Barth: > V4L1 support was removed from the 2.6.38 kernel, so devices that weren't > switched to V4L2 till then won't work anymore Yes, this is true. Unfortunately there are still old cameras that have only a V1 driver.. But even if v4l1 support is removed from the kernel this unit should still continue to work with the remaining V2 cameras because it does not use any V1 ioctls that would have to be handled by the kernel itself, it is using only ioctls that would be emulated by libv4l1.

I can neither confirm nor deny that your unit will work, because (as I've written earlier) I use my own v4l2 unit and also I don't have any v4l1 device.

If you want to test a distro with an up to date kernel, then you should try ArchLinux as it uses a rolling release like Gentoo does, but without the "compile everything yourself" concept ;)

Regards,
Sven

Reply by email