From 9c10719b387bc68efa138977f7ef594824c83549 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Mon, 4 Feb 2002 21:39:45 +0000 Subject: [PATCH] gst-launch-ext can be used to play common media files with fixed pipes based on the file extension. Original commit message from CVS: gst-launch-ext can be used to play common media files with fixed pipes based on the file extension. It optionally uses a .gst file in the home directory to select preferred audio and video sinks. --- tools/gst-launch-ext | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/gst-launch-ext b/tools/gst-launch-ext index 6c5cd893a2..74e9caa136 100755 --- a/tools/gst-launch-ext +++ b/tools/gst-launch-ext @@ -20,7 +20,7 @@ sub extension sub read_config { - my $config_file = "~/.gst"; + my $config_file = `echo -n ~`."/.gst"; if (-e $config_file) { open CONFIG, $config_file; @@ -45,18 +45,10 @@ sub read_config else { print "No configuration file $config_file found. You might want to create one.\n"; - $cfg{AUDIOSINK} = "osssink"; - $cfg{VIDEOSINK} = "xvideosink"; - $cfg{CVS_PATH} = "~/gst/cvs"; - } - - # check for gst-launch in cvs dir - $GST_LAUNCH=$cfg{CVS_PATH}."/gstreamer/tools/gst-launch"; - if (! -x $GST_LAUNCH) - { - # let's hope it's installed ... - $GST_LAUNCH="gst-launch"; } + if (!defined $cfg{AUDIOSINK}) { $cfg{AUDIOSINK} = "osssink"; } + if (!defined $cfg{VIDEOSINK}) { $cfg{VIDEOSINK} = "sdlvideosink"; } + if (!defined $cfg{CVS_PATH}) { $cfg{CVS_PATH} = `echo -n ~`."/gst/cvs"; } } ### main @@ -66,7 +58,7 @@ read_config (); my %pipes = ( "mp3", "mad ! $cfg{AUDIOSINK}", "ogg", "vorbisdec ! $cfg{AUDIOSINK}", - "mpg", "mpegdemux video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} } audio_00! { queue ! mad ! $cfg{AUDIOSINK} }", + "mpg", "mpegdemux audio_00! { queue ! mad ! $cfg{AUDIOSINK} } mpegdemux0.video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }", "avi", "avidemux video_00! { queue ! windec ! $cfg{VIDEOSINK} }", "vob", "mpegdemux video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }", @@ -77,9 +69,9 @@ my $ext = extension ($file); if ($pipe = $pipes{$ext}) { - $command = "$GST_LAUNCH filesrc location=\"$file\" ! $pipe"; + $command = "gst-launch filesrc location=\"$file\" ! $pipe"; print "Running $command\n"; - system ($command); + system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools/gst-launch $command"); } else {