~ubuntu-branches/ubuntu/precise/xscreensaver/precise

« back to all changes in this revision

Viewing changes to driver/xscreensaver-getimage-video

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Bicha
  • Date: 2011-05-18 15:39:48 UTC
  • mfrom: (1.1.11 upstream) (2.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110518153948-8w0vyzy9lbiimpez
Tags: 5.13-1ubuntu1
* Merge with Debian unstable, remaining Ubuntu changes:
* debian/control:
  - Build-Depend on ubuntu-artwork
  - Add Vcs-Bzr link
  - Move xli | xloadimage xscreensaver recommends to suggests
  - Add/Update replaces with Ubuntu versions
  - Update package descriptions to list Ubuntu screensavers
* debian/rules:
  - Use /usr/share/backgrounds as image directory
  - Add translation domain to .desktop files
* debian/source_xscreensaver.py: 
  - Add apport hook
* debian/split-hacks.config:
  - Use different set of default hacks than Debian
* debian/xscreensaver.dirs
  - Install /usr/share/backgrounds. By default, settings search in
    /usr/share/backgrounds and without it, it displays an error
* debian/patches/53_XScreenSaver.ad.in.patch:
  - Use Ubuntu branding

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl -w
2
 
# Copyright � 2001-2010 Jamie Zawinski <jwz@jwz.org>.
 
2
# Copyright � 2001-2011 Jamie Zawinski <jwz@jwz.org>.
3
3
#
4
4
# Permission to use, copy, modify, distribute, and sell this software and its
5
5
# documentation for any purpose is hereby granted without fee, provided that
18
18
# "jigsaw", etc.) get the image to manipulate by running the
19
19
# "xscreensaver-getimage" program.
20
20
#
21
 
# "xscreensaver-getimage" will invoke this program, depending on the
22
 
# value of the "grabVideoFrames" setting in the ~/.xscreensaver file
23
 
# (or in /usr/lib/X11/app-defaults/XScreenSaver).
 
21
# The various screen savers invoke "xscreensaver-getimage", which will in
 
22
# turn invoke this program, depending on the value of the "grabVideoFrames"
 
23
# setting in the ~/.xscreensaver file (or in the app-defaults file, usually
 
24
# /usr/lib/X11/app-defaults/XScreenSaver).
24
25
#
25
26
# Created: 13-Apr-2001.
26
27
 
29
30
use strict;
30
31
 
31
32
my $progname = $0; $progname =~ s@.*/@@g;
32
 
my $version  = q{ $Revision: 1.19 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/;
 
33
my $version  = q{ $Revision: 1.21 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/;
33
34
 
34
35
my $tmpdir   = $ENV{TMPDIR} || "/tmp";
35
36
my $tmpfile  = sprintf("%s/xssv.%08x.ppm", $tmpdir, rand(0xFFFFFFFF));
70
71
  "vidtomem -f $tmpfile 2>&- " .                # Silicon Graphics
71
72
        "&& mv $tmpfile-00000.rgb $tmpfile",
72
73
 
73
 
  # "mplayer tv:// -vo pnm -frames 1 2>&- " .   # Maybe works with some cams?
 
74
  # "mplayer -really-quiet tv://0 " .           # Maybe works with some cams?
 
75
  #         "-ao null -vo pnm -frames 1 2>&- " .
74
76
  #     "&& mv 00000001.ppm $tmpfile",
 
77
 
75
78
);
76
79
 
77
80
 
120
123
    print STDOUT "$tmpfile\n";
121
124
 
122
125
  } elsif ($use_stdout_p) {
123
 
    local *IN;
124
126
    my $ppm = "";
125
127
    my $reader  = "<$tmpfile";
126
128
 
127
129
    # horrid kludge for SGIs, since they don't use PPM...
128
130
    if ($cmd =~ m/^vidtomem\s/) {
129
 
      $reader = "sgitopnm $tmpfile";
 
131
      $reader  = "sgitopnm $tmpfile";
130
132
      $reader .= " 2>/dev/null" if ($verbose <= 1);
131
133
      $reader .= " |";
132
134
    }
133
135
 
134
 
    open(IN, $reader) || error ("reading $tmpfile: $!");
 
136
    open (my $in, $reader) || error ("reading $tmpfile: $!");
135
137
    print STDERR "$progname: reading $tmpfile\n" if ($verbose > 1);
136
 
    while (<IN>) { $ppm .= $_; }
137
 
    close IN;
 
138
    local $/ = undef;  # read entire file
 
139
    $ppm = <$in>;
 
140
    close $in;
138
141
    unlink $tmpfile;
139
142
    print STDOUT $ppm;
140
143