projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver]
/
driver
/
xscreensaver-getimage-video
diff --git
a/driver/xscreensaver-getimage-video
b/driver/xscreensaver-getimage-video
index d79bc47c8bd6b7d477f73c74756452d8d758ef74..15c5a9ef6e3aefe28de4dffebd317cf75ecd61fc 100755
(executable)
--- a/
driver/xscreensaver-getimage-video
+++ b/
driver/xscreensaver-getimage-video
@@
-1,5
+1,5
@@
#!/usr/bin/perl -w
#!/usr/bin/perl -w
-# Copyright © 2001
Jamie Zawinski <jwz@jwz.org>, all rights reserved
.
+# Copyright © 2001
, 2002, 2003, 2005 Jamie Zawinski <jwz@jwz.org>
.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
@@
-22,42
+22,49
@@
# value of the "grabVideoFrames" setting in the ~/.xscreensaver file
# (or in /usr/lib/X11/app-defaults/XScreenSaver).
#
# value of the "grabVideoFrames" setting in the ~/.xscreensaver file
# (or in /usr/lib/X11/app-defaults/XScreenSaver).
#
-# Created: 13-Apr-01.
+# Created: 13-Apr-
20
01.
require 5;
use diagnostics;
use strict;
my $progname = $0; $progname =~ s@.*/@@g;
require 5;
use diagnostics;
use strict;
my $progname = $0; $progname =~ s@.*/@@g;
-my $version = q{ $Revision: 1.
4
$ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/;
+my $version = q{ $Revision: 1.
13
$ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/;
my $verbose = 0;
my $verbose = 0;
+my $tmpdir = $ENV{TMPDIR} || "/tmp";
+my $tmpfile = sprintf ("%s/xssgv.%08x.ppm", $tmpdir, rand(0xFFFFFFFF));
+
+
# These are programs that can be used to grab a video frame. The first one
# of these programs that exists on $PATH will be used, and the image file
# These are programs that can be used to grab a video frame. The first one
# of these programs that exists on $PATH will be used, and the image file
-# is assumed to be written to
stdout
(in some image format acceptable to
+# is assumed to be written to
$tmpfile
(in some image format acceptable to
# "xscreensaver-getimage-file", e.g., PPM or JPEG.)
#
# If you add other programs to this list, please let me know!
#
# "xscreensaver-getimage-file", e.g., PPM or JPEG.)
#
# If you add other programs to this list, please let me know!
#
+my @programs = (
+
+ "bttvgrab -d q -Q -l 1 -o ppm -f $tmpfile", # BTTV
+ "qcam > $tmpfile", # Connectix Qcam
+ "gqcam -t PPM -d $tmpfile", # GTK+ Qcam clone
-my $tmpdir = $ENV{TMPDIR};
-$tmpdir = "/tmp" unless $tmpdir;
+ "streamer -a -s 768x576 -o $tmpfile", # XawTV
+ # the "-a" option ("mute audio") arrived with XawTV 3.76.
-my $tmpfile = "$tmpdir/xssgv.$$";
+ "atitv snap $tmpfile", # ATI video capture card
-# this crap is because "vidtomem" can only write to a file, and uses
-# a stupid, non-overridable file name format.
-my $sgi_bogosity = "$tmpfile-00000.rgb";
+ "grab -type ppm -format ntsc -source 1 " . # *BSD BT848 module
+ "-settle 0.75 -output $tmpfile",
-my @programs = (
+ "motioneye -j $tmpfile", # Sony Vaio MotionEye
+ # (hardware jpeg encoder)
- "bttvgrab -d q -Q -l 1 -o jpg -f $tmpfile", # BTTV
- "qcam > $tmpfile", # Connectix Qcam
- "streamer -o $tmpfile", # XawTV
- "atitv snap $tmpfile", # ATI video capture card
+ "vidcat -b -f ppm -s 640x480 > $tmpfile 2>-", # w3cam/ovcam
- "vidtomem -f $tmpfile 2>- && mv $sgi_bogosity $tmpfile", # Silicon Graphics
+ "vidtomem -f $tmpfile 2>&- " . # Silicon Graphics
+ "&& mv $tmpfile-00000.rgb $tmpfile",
);
);
@@
-91,7
+98,8
@@
sub pick_grabber {
}
}
-my $use_stdout = 0;
+my $use_stdout_p = 0;
+my $return_filename_p = 0;
sub grab_image {
my $cmd = pick_grabber();
sub grab_image {
my $cmd = pick_grabber();
@@
-106,7
+114,11
@@
sub grab_image {
error "\"$cmd\" produced no data.";
}
error "\"$cmd\" produced no data.";
}
- if ($use_stdout) {
+ if ($return_filename_p) {
+ print STDERR "$progname: wrote \"$tmpfile\"\n" if ($verbose);
+ print STDOUT "$tmpfile\n";
+
+ } elsif ($use_stdout_p) {
local *IN;
my $ppm = "";
my $reader = "<$tmpfile";
local *IN;
my $ppm = "";
my $reader = "<$tmpfile";
@@
-140,7
+152,7
@@
sub grab_image {
sub usage {
sub usage {
- print STDERR "usage: $progname [--verbose] [--stdout]\n";
+ print STDERR "usage: $progname [--verbose] [--
name | --
stdout]\n";
exit 1;
}
exit 1;
}
@@
-149,7
+161,8
@@
sub main {
shift @ARGV;
if ($_ eq "--verbose") { $verbose++; }
elsif (m/^-v+$/) { $verbose += length($_)-1; }
shift @ARGV;
if ($_ eq "--verbose") { $verbose++; }
elsif (m/^-v+$/) { $verbose += length($_)-1; }
- elsif (m/^--?stdout$/) { $use_stdout = 1; }
+ elsif (m/^--?stdout$/) { $use_stdout_p = 1; }
+ elsif (m/^--?name$/) { $return_filename_p = 1; }
elsif (m/^-./) { usage; }
else { usage; }
}
elsif (m/^-./) { usage; }
else { usage; }
}