3 # launch a gst-launch pipeline for the supplied media file
4 # use the extension to determine the gst-launch pipeline
5 # make use of default output sinks
14 # get only the bit after the last period. We don't deal with
15 # .tar.gz extensions do we ?
28 my $config_file = `echo -n ~`."/.gst";
31 open CONFIG, $config_file;
38 my ($var, $value) = split (/\s*=\s*/, $_, 2);
41 if (!($cfg{AUDIOSINK}))
43 print "Please add an AUDIOSINK to $config_file !\n";
45 if (!($cfg{VIDEOSINK}))
47 print "Please add a VIDEOSINK to $config_file !\n";
52 print "No configuration file $config_file found. You might want to create one.\n";
54 if (!defined $cfg{AUDIOSINK}) { $cfg{AUDIOSINK} = "osssink"; }
55 if (!defined $cfg{VIDEOSINK}) { $cfg{VIDEOSINK} = "colorspace ! xvideosink"; }
56 if (!defined $cfg{CVS_PATH}) { $cfg{CVS_PATH} = `echo -n ~`."/gst/cvs"; }
61 my ($file, $ext) = @_;
65 if ($cfg{VISUALIZER} && ($pipe = $pipes{"vis." . $ext}))
67 $command = "gst-launch filesrc location=\"$file\" ! $pipe";
68 print "Running $command\n";
69 system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools $command");
71 elsif ($pipe = $pipes{$ext})
73 $command = "gst-launch filesrc location=\"$file\" ! $pipe";
74 print "Running $command\n";
75 system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools $command");
79 print "No suitable pipe found for extension $ext.\n";
88 "ac3", "a52dec ! $cfg{AUDIOSINK}",
89 "au", "auparse ! $cfg{AUDIOSINK}",
90 "avi", "avidemux video_%02d! { queue ! windec ! $cfg{VIDEOSINK} } avidemux0.audio_%02d! { queue ! mad ! $cfg{AUDIOSINK} }",
91 "fli", "flxdec ! colorspace ! $cfg{VIDEOSINK}",
92 "m1v", "mpegdemux video_%02d! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }",
93 "m2v", "mpegdemux video_%02d! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }",
94 "mod", "modplug ! $cfg{AUDIOSINK}",
95 "mp2", "mad ! $cfg{AUDIOSINK}",
96 "mp3", "mad ! $cfg{AUDIOSINK}",
97 "mpg", "mpegdemux video_%02d! { queue ! mpeg2dec ! $cfg{VIDEOSINK} } mpegdemux0.audio_%02d! { queue ! mad ! $cfg{AUDIOSINK} }",
98 "ogg", "vorbisfile ! $cfg{AUDIOSINK}",
99 "sid", "siddec ! $cfg{AUDIOSINK}",
100 "swf", "swfdec video_%02d! { queue ! colorspace ! $cfg{VIDEOSINK} } swfdec0.audio_%02d! { queue ! $cfg{AUDIOSINK} }",
101 "vob", "mpegdemux video_%02d! { queue ! mpeg2dec ! $cfg{VIDEOSINK} } mpegdemux0.private_stream_1_%02d! { queue ! a52dec ! $cfg{AUDIOSINK} }",
102 "wav", "wavparse ! $cfg{AUDIOSINK}",
105 if ($cfg{VISUALIZER}) {
108 "vis.mp3", "mad ! tee silent=true 'tee1.src0!' queue leaky=1 ! { $cfg{VISUALIZER} ! colorspace ! $cfg{VIDEOSINK} } 'tee1.src1!' $cfg{AUDIOSINK}",
109 "vis.ogg", "vorbisdec ! tee silent=true 'tee1.src0!' queue leaky=1 ! { $cfg{VISUALIZER} ! colorspace ! $cfg{VIDEOSINK} } 'tee1.src1!' $cfg{AUDIOSINK}",
110 "vis.wav", "wavparse ! tee silent=true 'tee1.src0!' queue leaky=1 ! { $cfg{VISUALIZER} ! colorspace ! $cfg{VIDEOSINK} } 'tee1.src1!' $cfg{AUDIOSINK}",
115 print STDERR "Usage: gst-launch-ext filename[s]\n";
120 while ($file = shift @ARGV) {
121 my $ext = extension ($file);
124 open (PLAYLIST, '<', $file);
126 while ($file2 = <PLAYLIST>) {
128 my $ext2 = extension ($file2);
129 playfile($file2, $ext2);
133 playfile($file, $ext);