4 # launch a gst-launch pipeline for the supplied media file
5 # use the extension to determine the gst-launch pipeline
6 # make use of default output sinks
15 # get only the bit after the last period. We don't deal with
16 # .tar.gz extensions do we ?
31 my $config_file = $ENV{HOME}."/.gst";
34 open CONFIG, $config_file;
41 my ($var, $value) = split (/\s*=\s*/, $_, 2);
44 if (!($cfg{AUDIOSINK}))
46 print "Please add an AUDIOSINK to $config_file !\n";
48 if (!($cfg{VIDEOSINK}))
50 print "Please add a VIDEOSINK to $config_file !\n";
55 print "No configuration file $config_file found. You might want to create one.\n";
56 print "This is not an error, just a friendly reminder... Check the man page.\n\n";
58 if (!defined $cfg{AUDIOSINK}) { $cfg{AUDIOSINK} = "osssink"; }
59 if (!defined $cfg{VIDEOSINK}) { $cfg{VIDEOSINK} = "ffmpegcolorspace ! xvimagesink"; }
60 if (!defined $cfg{CVS_PATH}) { $cfg{CVS_PATH} = $ENV{HOME}."/gst/cvs"; }
62 if ($command =~ /(.+)\/gst-launch-ext-@GST_MAJORMINOR@$/)
63 { $cfg{COMMAND_PATH} = "$1"; }
65 { $cfg{COMMAND_PATH} = ""; }
70 my ($file, $ext) = @_;
73 my $path = "\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools";
75 if ($cfg{COMMAND_PATH} ne "") {
76 $path = $cfg{COMMAND_PATH}.":$path";
81 if ($cfg{VISUALIZER} && ($pipe = $pipes{"vis." . $ext}))
83 $command = "gst-launch-@GST_MAJORMINOR@ filesrc location=\"$file\" ! $pipe";
84 print "Running command-line\n$command\n\n";
85 system ("PATH=$path $command");
87 elsif ($pipe = $pipes{$ext})
89 $command = "gst-launch-@GST_MAJORMINOR@ filesrc location=\"$file\" ! $pipe";
90 print "Running command-line\n$command\n\n";
91 system ("PATH=$path $command");
95 print "No suitable pipe found for extension $ext.\n";
104 "ac3", "a52dec ! $cfg{AUDIOSINK}",
105 "au", "auparse ! $cfg{AUDIOSINK}",
106 "avi", "decodebin name=demux ! { demux.video_00 ! queue ! ! ffmpegcolorspace ! $cfg{VIDEOSINK} } { demux.audio_00 ! queue ! ! $cfg{AUDIOSINK} }",
107 "asf", "decodebin name=demux ! { demux.video_00 ! queue ! ffmpegcolorspace ! $cfg{VIDEOSINK} } { demux.audio_00 ! queue ! audioconvert ! audioscale ! $cfg{AUDIOSINK} }",
108 "flac", "flacdec ! $cfg{AUDIOSINK}",
109 "fli", "flxdec ! colorspace ! $cfg{VIDEOSINK}",
110 "m1v", "mpegdemux ! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }",
111 "m2v", "mpegdemux ! { queue ! mpeg2dec ! $cfg{VIDEOSINK} }",
112 "m4a", "qtdemux .audio_00 ! { queue ! faad ! $cfg{AUDIOSINK} }",
113 "mod", "modplug ! $cfg{AUDIOSINK}",
114 "mp2", "mad ! $cfg{AUDIOSINK}",
115 "mp3", "mad ! $cfg{AUDIOSINK}",
116 "mp4", "decodebin name=d { d. ! queue ! ffmpegcolorspace ! videoscale ! $cfg{VIDEOSINK} } { d. ! queue ! audioconvert ! audioscale ! $cfg{AUDIOSINK} }",
117 "mpeg", "mpegdemux name=d { d.audio_00 ! queue ! mad ! audioconvert ! audioscale ! $cfg{AUDIOSINK} } { d.video_00 ! queue ! mpeg2dec ! $cfg{VIDEOSINK} }",
118 "mpg", "mpegdemux name=demux { demux.video_00 ! queue ! mpeg2dec ! ffmpegcolorspace ! $cfg{VIDEOSINK} } { demux.audio_00 ! queue ! mad ! $cfg{AUDIOSINK} }",
119 "ogg", "oggdemux ! vorbisdec ! audioconvert ! $cfg{AUDIOSINK}",
120 "sid", "siddec ! $cfg{AUDIOSINK}",
121 "swf", "swfdec name=swfdec ! { queue ! colorspace ! $cfg{VIDEOSINK} } { swfdec. ! queue ! $cfg{AUDIOSINK} }",
122 "vob", "mpegdemux name=d { d.video_00 ! queue ! mpeg2dec ! $cfg{VIDEOSINK} } { d.audio_00 ! queue ! a52dec ! audioconvert ! audioscale ! $cfg{AUDIOSINK} }",
123 "wav", "wavparse ! $cfg{AUDIOSINK}",
124 "wm", "asfdemux name=demux ! { queue ! spider ! $cfg{VIDEOSINK} } { demux. ! queue ! spider ! $cfg{AUDIOSINK} }",
125 ### a wma file can use wmav1 or wmav2 codec so we must use spider to decode it
126 "wma", "asfdemux name=demux ! spider ! $cfg{AUDIOSINK}",
127 "wmv", "asfdemux name=demux ! { queue ! spider ! $cfg{VIDEOSINK} } { demux. ! queue ! spider ! $cfg{AUDIOSINK} }",
128 "mkv", "matroskademux name=demux ! { queue ! spider ! $cfg{VIDEOSINK} } { demux. ! queue ! spider ! $cfg{AUDIOSINK} }",
129 "mka", "matroskademux ! spider ! $cfg{AUDIOSINK}",
130 "mov", "decodebin name=d { d. ! queue ! ffmpegcolorspace ! videoscale ! $cfg{VIDEOSINK} } { d. ! queue ! audioconvert ! audioscale ! $cfg{AUDIOSINK} }",
133 if ($cfg{VISUALIZER}) {
136 "vis.mp3", "mad ! tee name=tee silent=true ! queue leaky=1 ! { $cfg{VISUALIZER} ! ffmpegcolorspace ! $cfg{VIDEOSINK} } tee. ! $cfg{AUDIOSINK}",
137 "vis.ogg", "vorbisdec ! tee name=tee silent=true ! queue leaky=1 ! { $cfg{VISUALIZER} ! ffmpegcolorspace ! $cfg{VIDEOSINK} } tee. ! $cfg{AUDIOSINK}",
138 "vis.wav", "wavparse ! tee name=tee silent=true ! queue leaky=1 ! { $cfg{VISUALIZER} ! ffmpegcolorspace ! $cfg{VIDEOSINK} } tee. ! $cfg{AUDIOSINK}",
143 print STDERR "Usage: gst-launch-ext-@GST_MAJORMINOR@ filename[s]\n";
148 while ($file = shift @ARGV) {
149 my $ext = extension ($file);
151 print "file $file doesn't have an extension !\n";
156 open (PLAYLIST, '<', $file);
158 while ($file2 = <PLAYLIST>) {
160 my $ext2 = extension ($file2);
161 playfile($file2, $ext2);
165 playfile($file, $ext);