From: Thomas Vander Stichele Date: Mon, 4 Feb 2002 19:57:35 +0000 (+0000) Subject: start of a gst-launch helper based on extension X-Git-Tag: 1.19.3~511^2~16169 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ccffc1f9e60b01c01ff7f77a738d431e3ec89c35;p=platform%2Fupstream%2Fgstreamer.git start of a gst-launch helper based on extension Original commit message from CVS: start of a gst-launch helper based on extension --- diff --git a/tools/gst-launch-ext b/tools/gst-launch-ext new file mode 100755 index 0000000..909438f --- /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"; +}