summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2002-02-04 19:57:35 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2002-02-04 19:57:35 +0000
commit2a5029145eff69c465cab941b14de2ceca2fdf80 (patch)
tree7dfcf873a6ba2276bc1cbc61b6763eb1f5f3e1b2 /tools
parenta5772bb5965e65e48dd75ba7336064affb5d35be (diff)
start of a gst-launch helper based on extension
Original commit message from CVS: start of a gst-launch helper based on extension
Diffstat (limited to 'tools')
-rwxr-xr-xtools/gst-launch-ext48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/gst-launch-ext b/tools/gst-launch-ext
new file mode 100755
index 00000000..909438f6
--- /dev/null
+++ b/tools/gst-launch-ext
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+
+# launch a gst-launch pipeline for the supplied media file
+# use the extension to determine the gst-launch pipeline
+# make use of default output sinks
+
+### packages
+
+use File::Basename;
+
+### defaults
+my $VIDEOSINK = "xvideosink";
+my $AUDIOSINK = "osssink";
+my $GST_CVS_PATH = "~/gst/cvs";
+
+my %pipes = (
+ "mp3", "mad ! $AUDIOSINK",
+ "ogg", "vorbisdec ! $AUDIOSINK",
+ "mpg", "mpegdemux video_00! { queue ! mpeg2dec ! $VIDEOSINK } audio_00! { queue ! mad ! $AUDIOSINK }",
+ "avi", "avidemux video_00! { queue ! windec ! $VIDEOSINK }",
+ "vob", "mpegdemux video_00! { queue ! mpeg2dec ! $VIDEOSINK }",
+
+);
+
+sub extension
+{
+ my $path = shift;
+ my $ext = (fileparse ($path, '\..*'))[2];
+ $ext =~ s/^\.//;
+ return $ext;
+}
+
+### main
+
+my $file = shift @ARGV or die "Please give a file name !";
+
+my $ext = extension ($file);
+
+if ($pipe = $pipes{$ext})
+{
+ $command = "$GST_CVS_PATH/gstreamer/tools/gst-launch filesrc location=\"$file\" ! $pipe";
+ print "Running $command\n";
+ system ($command);
+}
+else
+{
+ print "No suitable pipe found for extension $ext.\n";
+}