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
17 my $ext = (fileparse ($path, '\..*?'))[2];
24 my $config_file = `echo -n ~`."/.gst";
27 open CONFIG, $config_file;
34 my ($var, $value) = split (/\s*=\s*/, $_, 2);
37 if (!($cfg{AUDIOSINK}))
39 print "Please add an AUDIOSINK to $config_file !\n";
41 if (!($cfg{VIDEOSINK}))
43 print "Please add a VIDEOSINK to $config_file !\n";
48 print "No configuration file $config_file found. You might want to create one.\n";
50 if (!defined $cfg{AUDIOSINK}) { $cfg{AUDIOSINK} = "osssink"; }
51 if (!defined $cfg{VIDEOSINK}) { $cfg{VIDEOSINK} = "sdlvideosink"; }
52 if (!defined $cfg{CVS_PATH}) { $cfg{CVS_PATH} = `echo -n ~`."/gst/cvs"; }
57 my ($file, $ext) = @_;
60 if ($cfg{VISUALIZER} && ($pipe = $pipes{"vis." . $ext}))
62 $command = "gst-launch filesrc location=\"$file\" ! $pipe";
63 print "Running $command\n";
64 system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools $command");
66 elsif ($pipe = $pipes{$ext})
68 $command = "gst-launch filesrc location=\"$file\" ! $pipe";
69 print "Running $command\n";
70 system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools $command");
74 print "No suitable pipe found for extension $ext.\n";
83 "mp3", "mad ! $cfg{AUDIOSINK}",
84 "ogg", "vorbisdec ! $cfg{AUDIOSINK}",
85 "mpg", "mpegdemux video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} } mpegdemux0.audio_00! { queue ! mad ! $cfg{AUDIOSINK} }",
86 "avi", "avidemux video_00! { queue ! windec ! $cfg{VIDEOSINK} } avidemux0.audio_00! { queue ! mad ! $cfg{AUDIOSINK} }",
87 "vob", "mpegdemux video_00! { queue max_level=500 ! mpeg2dec ! $cfg{VIDEOSINK} } mpegdemux0.private_stream_1.0! { queue max_level=500 ! a52dec ! $cfg{AUDIOSINK} }",
88 "wav", "wavparse ! $cfg{AUDIOSINK}",
89 "fli", "flxdec ! colorspace ! $cfg{VIDEOSINK}"
92 if ($cfg{VISUALIZER}) {
95 "vis.mp3", "mad ! tee silent=true 'tee1.src0!' queue leaky=1 ! { $cfg{VISUALIZER} ! colorspace ! $cfg{VIDEOSINK} } 'tee1.src1!' $cfg{AUDIOSINK}",
96 "vis.ogg", "vorbisdec ! tee silent=true 'tee1.src0!' queue leaky=1 ! { $cfg{VISUALIZER} ! colorspace ! $cfg{VIDEOSINK} } 'tee1.src1!' $cfg{AUDIOSINK}",
97 "vis.wav", "wavparse ! tee silent=true 'tee1.src0!' queue leaky=1 ! { $cfg{VISUALIZER} ! colorspace ! $cfg{VIDEOSINK} } 'tee1.src1!' $cfg{AUDIOSINK}",
102 print STDERR "Usage: gst-launch-ext filename[s]\n";
107 while ($file = shift @ARGV) {
108 my $ext = extension ($file);
111 open (PLAYLIST, '<', $file);
113 while ($file2 = <PLAYLIST>) {
115 my $ext2 = extension ($file2);
116 playfile($file2, $ext2);
120 playfile($file, $ext);