annotate TOOLS/mp.pl @ 10361:9f97e3bd0e04

XVideo Motion Compensation common structures
author iive
date Tue, 01 Jul 2003 22:02:17 +0000
parents 493cbec56a14
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1385
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
1 #!/usr/bin/perl -w
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
2 use strict;
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
3 # Filename: mp.pl
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
4 # Date : created 2001-07-24
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
5 # Author : Felix Buenemann <atmosfear at users.sourceforge.net>
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
6 # Idea by : David Chan <prometheus at theendofthetunnel.org>
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
7 # License : GNU General Public License (GPL)
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
8 # (refer to: http://www.fsf.org/licenses/gpl.txt)
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
9 #
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
10 # Description:
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
11 # Small Perl helper script that allows to play multiple files with MPlayer.
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
12 # Wildcards are supported (eg. "mp.pl -vo x11 /data/*.avi").
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
13 #
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
14 # Configuration:
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
15 # If MPlayer is not in your path, give the full
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
16 # path to mplayer binary in the line below.
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
17 # (example: "/usr/local/bin/mplayer")
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
18 use constant MPLAYER => "mplayer";
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
19
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
20 my (@parms, @files);
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
21
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
22 die
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
23 "mp.pl: No parameters given!
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
24
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
25 MPlayer multifile playback helper script 0.9
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
26 Copyleft 2001 by Felix Buenemann
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
27
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
28 Syntax: mp.pl <parameters> <files>
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
29
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
30 Where <parameters> are all possible commandline switches for mplayer and
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
31 <files> can be either a list of files, like file1 file2 file3 and/or a
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
32 wildcard definition, like *.avi.
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
33
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
34 Example: mp.pl -vo x11 /dvd/VIDEO_TS/VTS_05_*.VOB movie.asf
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
35 \n"
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
36 if ($#ARGV < 0) || ($ARGV[0] =~ m/^--*(h|help)/);
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
37
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
38 foreach (@ARGV) {
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
39 if(m/^-\w+/) { push @parms, $_ }
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
40 elsif(-f $_ && -r _ && -B _) { push @files, $_ }
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
41 else { push @parms, $_ }
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
42 }
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
43 die "No valid files to process!\n" unless @files;
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
44 foreach (@files) {
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
45 print "Invoking MPlayer for '$_'...\n";
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
46 system(MPLAYER, @parms, $_)
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
47 or die "Couldn't execute MPlayer: $!\n";
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
48 ($? >> 8) != 1
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
49 and die "Couldn't properly execute MPlayer, aborting!\n";
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
50 }
493cbec56a14 Perl multifile playback helper tool.
atmos4
parents:
diff changeset
51 # EOF