On Tue, 09 Mar 2010 14:01:55 +0200, Damyan Ivanov wrote: > > Ack, and it's probably not difficult for someone who speaks C. > I added v4l2.patch and the module compiles.
Cool! > Please someone with a camera, test it. There are sample scripts in > examples/. 1) With your patch: $ for s in examples/*; do echo "=== $s ==="; PERL5LIB=/:examples perl $s; done === examples/autotune === Can't call method "mode" on an undefined value at examples/autotune line 25. === examples/capture === Can't call method "mode" on an undefined value at examples/capture line 85. === examples/dumpepg === Electronic Program Guide <.epg> can't open .epg: No such file or directory at examples/dumpepg line 14 === examples/epgview === === examples/finder === Can't call method "mode" on an undefined value at examples/finder line 10. === examples/getepg === Undefined subroutine &Video::Capture::V4l::VBI::v4l_open called at /usr/lib/perl5/Video/Capture/V4l.pm line 177. === examples/grab === Device: name USB Camera (046d:08a2), type capture, channels 1, audios 0, sizes 48x32-640x480 Channel 0: name zc3xx, tuners 0, flags, type camera, norm 0 Audio Channel 0: volume 0, bass 0, treble 0, flags, name Microphone, mode 0, balance 0, step 1 Picture Settings: brightness 32896, hue 0, colour 0, contrast 32768, whiteness 39321, depth 8, palette 0 Can't call method "mode" on an undefined value at examples/grab line 103. === examples/indexer === Can't call method "mode" on an undefined value at examples/indexer line 10. === examples/linux-dsp-ioctl.ph === === examples/mp2enc === /tmp/vstream did not return a true value at examples/mp2enc line 10. === examples/mpgenc === /tmp/vstream did not return a true value at examples/mpgenc line 10. === examples/nbcmp3 === Undefined subroutine &Video::Capture::V4l::VBI::v4l_open called at /usr/lib/perl5/Video/Capture/V4l.pm line 177. === examples/record === Device: name USB Camera (046d:08a2), type capture, channels 1, audios 0, sizes 48x32-640x480 Channel 0: name zc3xx, tuners 0, flags, type camera, norm 0 Audio Channel 0: volume 0, bass 0, treble 0, flags, name Microphone, mode 0, balance 0, step 1 Picture Settings: brightness 32896, hue 0, colour 0, contrast 32768, whiteness 39321, depth 8, palette 0 Can't call method "mode" on an undefined value at examples/record line 103. === examples/settv === Device: name USB Camera (046d:08a2), type capture, channels 1, audios 0, sizes 48x32-640x480 Channel 0: name zc3xx, tuners 0, flags, type camera, norm 0 Audio Channel 0: volume 0, bass 0, treble 0, flags, name Microphone, mode 0, balance 0, step 1 Picture Settings: brightness 32896, hue 0, colour 0, contrast 32768, whiteness 39321, depth 8, palette 0 Can't call method "mode" on an undefined value at examples/settv line 105. === examples/vbi === Undefined subroutine &Video::Capture::V4l::VBI::v4l_open called at /usr/lib/perl5/Video/Capture/V4l.pm line 177. === examples/vbi-info === Undefined subroutine &Video::Capture::V4l::VBI::v4l_open called at /usr/lib/perl5/Video/Capture/V4l.pm line 177. === examples/xsview === /tmp/vstream did not return a true value at examples/xsview line 9. 2) If I add v4l_open to Video::Capture::V4l::VBI (attachment vbi.diff): $ for s in examples/*; do echo "=== $s ==="; PERL5LIB=/:examples perl $s; done === examples/autotune === Can't call method "mode" on an undefined value at examples/autotune line 25. === examples/capture === Can't call method "mode" on an undefined value at examples/capture line 85. === examples/dumpepg === Electronic Program Guide <.epg> can't open .epg: No such file or directory at examples/dumpepg line 14 === examples/epgview === === examples/finder === Can't call method "mode" on an undefined value at examples/finder line 10. === examples/getepg === Capturing VBI block. Make sure you have tuned in to a channel with EPG! Aquisition may take up to twenty minutes (and more)! Negative offset to vec in lvalue context at examples/getepg line 175. === examples/grab === Device: name USB Camera (046d:08a2), type capture, channels 1, audios 0, sizes 48x32-640x480 Channel 0: name zc3xx, tuners 0, flags, type camera, norm 0 Audio Channel 0: volume 0, bass 0, treble 0, flags, name Microphone, mode 0, balance 0, step 1 Picture Settings: brightness 32896, hue 0, colour 0, contrast 32768, whiteness 39321, depth 8, palette 0 Can't call method "mode" on an undefined value at examples/grab line 103. === examples/indexer === Can't call method "mode" on an undefined value at examples/indexer line 10. === examples/linux-dsp-ioctl.ph === === examples/mp2enc === /tmp/vstream did not return a true value at examples/mp2enc line 10. === examples/mpgenc === /tmp/vstream did not return a true value at examples/mpgenc line 10. === examples/nbcmp3 === panic: sv_setpvn called with negative strlen at examples/nbcmp3 line 27. === examples/record === Device: name USB Camera (046d:08a2), type capture, channels 1, audios 0, sizes 48x32-640x480 Channel 0: name zc3xx, tuners 0, flags, type camera, norm 0 Audio Channel 0: volume 0, bass 0, treble 0, flags, name Microphone, mode 0, balance 0, step 1 Picture Settings: brightness 32896, hue 0, colour 0, contrast 32768, whiteness 39321, depth 8, palette 0 Can't call method "mode" on an undefined value at examples/record line 103. === examples/settv === Device: name USB Camera (046d:08a2), type capture, channels 1, audios 0, sizes 48x32-640x480 Channel 0: name zc3xx, tuners 0, flags, type camera, norm 0 Audio Channel 0: volume 0, bass 0, treble 0, flags, name Microphone, mode 0, balance 0, step 1 Picture Settings: brightness 32896, hue 0, colour 0, contrast 32768, whiteness 39321, depth 8, palette 0 Can't call method "mode" on an undefined value at examples/settv line 105. === examples/vbi === Capturing VBI block. Make sure you have tuned in to a channel! Negative offset to vec in lvalue context at examples/vbi line 53. === examples/vbi-info === VBI capturing started. You can enter the following commands, ended by <return> q quit c clear panic: sv_setpvn called with negative strlen at examples/vbi-info line 44. === examples/xsview === /tmp/vstream did not return a true value at examples/xsview line 9. 3) I'm wondering if we need to replace munmap/ioctl/mmap/read too? I've started to do that some time ago (attachment v4l1.patch) but now I don't see a difference. 4) Testing is a bit difficult for me with my cheap webcam, since it doesn't support many functions; IIUIC some stuff expects a TV card ... Cheers, gregor -- .''`. http://info.comodo.priv.at/ -- GPG Key IDs: 0x8649AA06, 0x00F3CFE4 : :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of Free Software Foundation Europe `- NP: Rolling Stones
Index: debian/patches/v4l2.patch
===================================================================
--- debian/patches/v4l2.patch (revision 53987)
+++ debian/patches/v4l2.patch (working copy)
@@ -33,7 +33,23 @@
#ifndef pTHX_
#define pTHX_
#endif
-@@ -430,6 +432,15 @@ _picture_new(fd)
+@@ -314,6 +316,15 @@ queued(self)
+ OUTPUT:
+ RETVAL
+
++int
++v4l_open (file,oflag)
++ char *file
++ int oflag
++ CODE:
++ RETVAL = v4l1_open (file, oflag);
++ OUTPUT:
++ RETVAL
++
+ MODULE = Video::Capture::V4l PACKAGE = Video::Capture::V4l
+
+ SV *
+@@ -430,6 +441,15 @@ _picture_new(fd)
OUTPUT:
RETVAL
--- a/V4l/V4l.xs
+++ b/V4l/V4l.xs
@@ -10,6 +10,7 @@
#include <string.h>
#include <pthread.h>
#include <linux/videodev.h>
+#include <libv4l1.h>
#define NEED_newCONSTSUB
#include "../gppport.h"
@@ -91,7 +92,7 @@ static int
private_free (pTHX_ SV *obj, MAGIC *mg)
{
struct private *p = (struct private *)mg->mg_ptr;
- munmap (p->mmap_base, p->vm.size);
+ v4l1_munmap (p->mmap_base, p->vm.size);
return 0;
}
@@ -107,9 +108,9 @@ find_private (SV *sv)
{
struct private p;
p.fd = SvIV (*hv_fetch (hv, "fd", 2, 0));
- if (ioctl (p.fd, VIDIOCGMBUF, &p.vm) == 0)
+ if (v4l1_ioctl (p.fd, VIDIOCGMBUF, &p.vm) == 0)
{
- p.mmap_base = (unsigned char *)mmap (0, p.vm.size, PROT_READ|PROT_WRITE, MAP_SHARED, p.fd, 0);
+ p.mmap_base = (unsigned char *)v4l1_mmap (0, p.vm.size, PROT_READ|PROT_WRITE, MAP_SHARED, p.fd, 0);
if (p.mmap_base)
{
sv_magic ((SV*)hv, 0, '~', (char*)&p, sizeof p);
@@ -166,7 +167,7 @@ vbi_snatcher_thread (void *arg)
pthread_mutex_unlock (&vbi_lock);
next->next = 0;
- next->size = read (vbi_fd, next->data, VBI_BPF);
+ next->size = v4l1_read (vbi_fd, next->data, VBI_BPF);
pthread_mutex_lock (&vbi_lock);
@@ -231,7 +232,7 @@ field(self)
RETVAL = newSVpvn ("", 0);
SvGROW (RETVAL, VBI_BPF);
- len = read (fd, SvPV_nolen (RETVAL), VBI_BPF);
+ len = v4l1_read (fd, SvPV_nolen (RETVAL), VBI_BPF);
SvCUR_set (RETVAL, len);
}
@@ -344,7 +345,7 @@ capture(sv,frame,width,height,format = V
vm.height = height;
vm.width = width;
vm.format = format;
- if (ioctl (p->fd, VIDIOCMCAPTURE, &vm) == 0)
+ if (v4l1_ioctl (p->fd, VIDIOCMCAPTURE, &vm) == 0)
{
SV *fr = newSV (0);
SvUPGRADE (fr, SVt_PV);
@@ -372,7 +373,7 @@ sync(sv,frame)
{
struct private *p;
if ((p = find_private (sv))
- && ioctl (p->fd, VIDIOCSYNC, &frame) == 0)
+ && v4l1_ioctl (p->fd, VIDIOCSYNC, &frame) == 0)
XSRETURN_YES;
else
XSRETURN_EMPTY;
@@ -386,11 +387,11 @@ _freq (fd,fr)
if (items > 1)
{
fr = ((fr<<4)+499)/1000;
- ioctl (fd, VIDIOCSFREQ, &fr);
+ v4l1_ioctl (fd, VIDIOCSFREQ, &fr);
}
if (GIMME_V != G_VOID)
{
- if (ioctl (fd, VIDIOCGFREQ, &fr) == 0)
+ if (v4l1_ioctl (fd, VIDIOCGFREQ, &fr) == 0)
RETVAL = (fr*1000+7)>>4;
else
XSRETURN_EMPTY;
@@ -456,7 +457,7 @@ void
get(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCGCAP, old_struct (sv, "Video::Capture::V4l::Capability")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCGCAP, old_struct (sv, "Video::Capture::V4l::Capability")) == 0);
MODULE = Video::Capture::V4l PACKAGE = Video::Capture::V4l::Channel
@@ -464,13 +465,13 @@ void
get(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCGCHAN, old_struct (sv, "Video::Capture::V4l::Channel")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCGCHAN, old_struct (sv, "Video::Capture::V4l::Channel")) == 0);
void
set(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCSCHAN, old_struct (sv, "Video::Capture::V4l::Channel")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCSCHAN, old_struct (sv, "Video::Capture::V4l::Channel")) == 0);
MODULE = Video::Capture::V4l PACKAGE = Video::Capture::V4l::Tuner
@@ -478,13 +479,13 @@ void
get(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCGTUNER, old_struct (sv, "Video::Capture::V4l::Tuner")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCGTUNER, old_struct (sv, "Video::Capture::V4l::Tuner")) == 0);
void
set(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCSTUNER, old_struct (sv, "Video::Capture::V4l::Tuner")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCSTUNER, old_struct (sv, "Video::Capture::V4l::Tuner")) == 0);
MODULE = Video::Capture::V4l PACKAGE = Video::Capture::V4l::Audio
@@ -492,13 +493,13 @@ void
get(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCGAUDIO, old_struct (sv, "Video::Capture::V4l::Audio")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCGAUDIO, old_struct (sv, "Video::Capture::V4l::Audio")) == 0);
void
set(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCSAUDIO, old_struct (sv, "Video::Capture::V4l::Audio")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCSAUDIO, old_struct (sv, "Video::Capture::V4l::Audio")) == 0);
MODULE = Video::Capture::V4l PACKAGE = Video::Capture::V4l::Picture
@@ -506,13 +507,13 @@ void
get(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCGPICT, old_struct (sv, "Video::Capture::V4l::Picture")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCGPICT, old_struct (sv, "Video::Capture::V4l::Picture")) == 0);
void
set(sv)
SV * sv
CODE:
- XSRETURN_bool (ioctl (SvIV (SvRV (sv)), VIDIOCSPICT, old_struct (sv, "Video::Capture::V4l::Picture")) == 0);
+ XSRETURN_bool (v4l1_ioctl (SvIV (SvRV (sv)), VIDIOCSPICT, old_struct (sv, "Video::Capture::V4l::Picture")) == 0);
# accessors/mutators
INCLUDE: ./genacc |
signature.asc
Description: Digital signature

