Device-QuickCam

 view release on metacpan or  search on metacpan

cgicam.pl  view on Meta::CPAN

#!/usr/bin/perl

#Basic HTTP Example
#To get this running, you'll most likely will have to 
#  chown root.root cgicam.pl
#  chmod 0755 cgicam.pl
#  chmod +s cgicam.pl

use Device::QuickCam;

my $cam = Device::QuickCam->new();
$cam->set_quality(100);
$cam->set_bpp(32);
$cam->set_width(640);
$cam->set_height(480);

libcqcam/port.C  view on Meta::CPAN

  lock_info.l_type = F_WRLCK;
#ifdef LOCK_FAIL
  if (fcntl(lock_fd, F_SETLK, &lock_info) != 0) {
#else
  if (fcntl(lock_fd, F_SETLKW, &lock_info) != 0) {
#endif /* LOCK_FAIL */
    if (errno != EAGAIN)
      perror("fcntl");
    return -1;
  }
  chown(lockfile, getuid(), getgid());
#ifdef DEBUG
  fprintf(stderr, "Locked port 0x%x\n", portnum);
#endif /* DEBUG */
  return 0;
}
    
void port_t::unlock(int portnum) {
  if (portnum == -1)
    return;
  close(lock_fd);    // this clears the lock



( run in 1.016 second using v1.01-cache-2.11-cpan-71847e10f99 )