public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <j.w.r.degoede@hhs.nl>
To: video4linux-list@redhat.com, spca50x-devs@lists.sourceforge.net
Subject: video4linux 1 compatibilty wrapper for video4linux 2 devices
Date: Fri, 06 Jun 2008 00:07:25 +0200	[thread overview]
Message-ID: <4848639D.5050400@hhs.nl> (raw)

[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]

Hi All,

As some of you know using v4l1 apps with v4l2 drivers doesn't work very well, 
most v4l2 drivers don't implement the VIDIOCGMBUF ioctl at all, and those that 
do, often only deliver pixelformats which v4l1 applications don't expect / 
can't handle.

In order to fix this at the kernel level we would need to put conversion from 
formats like jpeg and bayer to bgr24 or yuv420 in to the kernel, but one of the 
points of v4l2 is to drop all that conversion code from the kernel and do it in 
userspace where it belongs.

Trying to not do conversion in the kernel, but still make apps think its done 
in the kernel. leads to IMHO overly complex solutions like this:
http://www.linuxtv.org/v4lwiki/index.php/V4L2UserspaceLibrary

Thus inspired by similar solutions for using applications which want to output 
sound to oss with arts, I've created a c-library wrapper which intercepts the 
following calls to video4linux2 devices:

open
close
read
ioctl
mmap

And emulates v4l1, including doing format conversions where necessary. I've 
tested this with my pac207 v4l2 driver and the uvc driver.

Using ekiga and spcaview in both mmap and read modus. And read modus even works 
on the uvc driver (which doesn't support read), as the wrapper emulates it 
using mmap

To give this a try:
tar xvfz v4l1-compat-0.1.tar.gz
cd v4l1-compat
make
export LD_PRELOAD=`pwd`/v4l1-compat.so
<run v4l1 application>

---

Future plans:
1) bugfix where necessary
2) maybe add v4l2 -> v4l2 emulating more supported formats (iow do conversion)
    so that for example xawtv which wants rgb or yuv, can work with bayer /
    jpg webcams too.


But the biggest future plan is splitting the current wrapper into a real libray 
called v4l-lib and a wrapper using it. The lib would offer v4l_open, v4l_ioctl, 
etc which will behave exactly as the real ones, except that it will do things 
like conversion where necessary. The idea here is that applications can very 
easily be ported to this new lib (just replace open with v4l_open, etc) and 
then we have one central place to things like decoding of certain pixformats, 
but also (in a far future) certain image enhancement algorithm's

Applications which don't want this can keep using the plain open, ioctl, etc. 
But for applications who do want things like conversion done for them, they can 
now gain that with little effort.

This would for example make it possible to use camorama with v4l2 cams with 
very little effort.

Regards,

Hans





[-- Attachment #2: v4l1-compat-0.1.tar.gz --]
[-- Type: application/x-gzip, Size: 27119 bytes --]

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

                 reply	other threads:[~2008-06-05 22:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4848639D.5050400@hhs.nl \
    --to=j.w.r.degoede@hhs.nl \
    --cc=spca50x-devs@lists.sourceforge.net \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox