Bug#569091: Uses obsolete V4L1 API

gregor herrmann gregoa at debian.org
Wed Mar 10 19:15:31 UTC 2010


On Wed, 10 Mar 2010 11:07:21 +0100, gregor herrmann wrote:

> But the question with the LED is good. I admit that I haven't checked
> yesterday but it worked the last time I checked, and I will have a
> look later today.

> AFAICS some are and some partly. IIRC I tried with a simpler script
> some time ago (which I have deleted of course but maybe we can write
> up something quickly).

Good news:

What I did:
* Simplify examples/grab (by commenting out the $tuner lines),
  attached, diff below.
* With libvideo-capture-v4l-perl 0.902-1:

  The LED lights up, and:

gregoa at nerys:/tmp$ ./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

.unable to sync at ./grab line 120.

  The LED extinguishes.  

* With libvideo-capture-v4l-perl 0.902-2:

  LED comes up, output:

gregoa at nerys:/tmp$ ./grab
Device: name USB Camera (046d:08a2), type capture, channels 1, audios
0, sizes 320x240-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 24, palette 4

................................................................^C
  
  So it looks like the sync works until I press Ctrl-C.


There's definitely a difference :)


Cheers,
gregor



grab diff:

--- /home/gregoa/src/svn-pkg-perl/trunk/libvideo-capture-v4l-perl/examples/grab 2007-07-30 21:03:29.000000000 +0200
+++ /tmp/grab   2010-03-10 20:06:45.000000000 +0100
@@ -99,10 +99,10 @@
 print_picture $grab->picture;
 
 my $channel = $grab->channel (0);
-my $tuner = $grab->tuner (0);
-$tuner->mode(TUNER_PAL);
+#my $tuner = $grab->tuner (0);
+#$tuner->mode(TUNER_PAL);
 $channel->norm(MODE_PAL);
-$tuner->set;
+#$tuner->set;
 $channel->set;
 
 $RTL2 = 154250;
  
-- 
 .''`.   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: Goingtomemphis
-------------- next part --------------
#!/usr/bin/perl

use Video::Capture::V4l;

sub print_capability {
   my $c=shift;
   print "Device: ";
   print "name ",$c->name;
   print ", type";
   for (qw(capture tuner teletext overlay chromakey clipping frameram scales monochrome subcapture)) {
      print " $_" if eval "\$c->$_";
   }
   print ", channels ",$c->channels;
   print ", audios ",$c->audios;
   print ", sizes ",$c->minwidth,"x",$c->minheight,"-",$c->maxwidth,"x",$c->maxheight;
   print "\n";
}

sub print_channel {
   my $c=shift;
   print "Channel ",$c->channel,": ";
   print "name ",$c->name;
   print ", tuners ",$c->tuners;
   print ", flags";
   for (qw(tuner audio)) {
      print " $_" if eval "\$c->$_";
   }
   print ", type";
   for (qw(tv camera)) {
      print " $_" if eval "\$c->$_";
   }
   # PAL, NTSC, SECAM, PAL-NC, PAL-M, PAL-N, NTSC-Japan
   print ", norm ",$c->norm;
   print "\n";
}

sub print_tuner {
   my $c=shift;
   print "Tuner ",$c->tuner,": ";
   print "name ",$c->name;
   print ", range ",$c->rangelow,"-",$c->rangehigh;
   print ", flags";
   for (qw(pal ntsc secam low norm stereo_on rds_on mbs_on)) {
      print " $_" if eval "\$c->$_";
   }
   print ", mode ",$c->mode;
   print ", signal ",$c->signal;
   print "\n";
}

sub print_audio {
   my $c=shift;
   print "Audio Channel ",$c->audio,": ";
   print "volume ",$c->volume;
   print ", bass ",$c->bass;
   print ", treble ",$c->treble;
   print ", flags";
   for (qw(mute mutable volume bass treble)) {
      print " $_" if eval "\$c->$_";
   }
   print ", name ",$c->name;
   print ", mode ",$c->mode;
   print ", balance ",$c->balance;
   print ", step ",$c->step;
   print "\n";
}

sub print_picture {
   my $c=shift;
   print "Picture Settings: ";
   print "brightness ",$c->brightness;
   print ", hue ",$c->hue;
   print ", colour ",$c->colour;
   print ", contrast ",$c->contrast;
   print ", whiteness ",$c->whiteness;
   print ", depth ",$c->depth;
   print ", palette ",$c->palette;
   print "\n";
}

$grab = new Video::Capture::V4l
   or die "Unable to open Videodevice: $!";

print_capability $grab->capability;
for (0..$grab->capability->channels-1) {
   print_channel $grab->channel($_);
}

for($_=0; my $tuner = $grab->tuner($_); $_++) {
   last if $tuner->tuner != $_;
   print_tuner $tuner;
}

for($_=0; my $audio = $grab->audio($_); $_++) {
   last if $audio->audio != $_;
   print_audio $audio;
}

print_picture $grab->picture;

my $channel = $grab->channel (0);
#my $tuner = $grab->tuner (0);
#$tuner->mode(TUNER_PAL);
$channel->norm(MODE_PAL);
#$tuner->set;
$channel->set;

$RTL2 = 154250;
$RTL2 = 196250;

print $grab->freq ($RTL2),"\n";

$|=1;

my $frame=0;
my $fr=$grab->capture ($frame, 640, 480);

for(;;) {
   my $nfr = $grab->capture (1-$frame, 640, 480);
   $grab->sync($frame) or die "unable to sync";

   # save $fr now, as it contains the raw BGR data
   print ".";

   $frame = 1-$frame;
   $fr = $nfr;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20100310/a28ad7a8/attachment.pgp>


More information about the pkg-perl-maintainers mailing list