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.
This commit is contained in:
Thomas Vander Stichele 2002-02-04 21:39:45 +00:00
parent 2114eaf1f4
commit 9c10719b38

View file

@ -20,7 +20,7 @@ sub extension
sub read_config sub read_config
{ {
my $config_file = "~/.gst"; my $config_file = `echo -n ~`."/.gst";
if (-e $config_file) if (-e $config_file)
{ {
open CONFIG, $config_file; open CONFIG, $config_file;
@ -45,18 +45,10 @@ sub read_config
else else
{ {
print "No configuration file $config_file found. You might want to create one.\n"; 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 ### main
@ -66,7 +58,7 @@ read_config ();
my %pipes = ( my %pipes = (
"mp3", "mad ! $cfg{AUDIOSINK}", "mp3", "mad ! $cfg{AUDIOSINK}",
"ogg", "vorbisdec ! $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} }", "avi", "avidemux video_00! { queue ! windec ! $cfg{VIDEOSINK} }",
"vob", "mpegdemux video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }", "vob", "mpegdemux video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }",
@ -77,9 +69,9 @@ my $ext = extension ($file);
if ($pipe = $pipes{$ext}) if ($pipe = $pipes{$ext})
{ {
$command = "$GST_LAUNCH filesrc location=\"$file\" ! $pipe"; $command = "gst-launch filesrc location=\"$file\" ! $pipe";
print "Running $command\n"; print "Running $command\n";
system ($command); system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools/gst-launch $command");
} }
else else
{ {