examples/gst/wavenc.py: New example
authorJohan Dahlin <johan@gnome.org>
Mon, 29 Mar 2004 10:20:02 +0000 (10:20 +0000)
committerJohan Dahlin <johan@gnome.org>
Mon, 29 Mar 2004 10:20:02 +0000 (10:20 +0000)
Original commit message from CVS:
* examples/gst/wavenc.py: New example

* Makefile.am (EXTRA_DIST): Add wavenc.py

ChangeLog
Makefile.am
examples/gst/wavenc.py [new file with mode: 0644]

index 43f6c0f..a52612d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-29  Johan Dahlin  <johan@gnome.org>
+
+       * examples/gst/wavenc.py: New example
+
+       * Makefile.am (EXTRA_DIST): Add wavenc.py
+
 2004-03-24  Johan Dahlin  <johan@gnome.org>
 
        * gst/gstmodule.c (init_gst): Add constants for GST_*SECOND.
index 35c4fff..22e5add 100644 (file)
@@ -23,6 +23,7 @@ EXTRA_DIST = \
        examples/gst/lat.py \
        examples/gst/rot13.py \
        examples/gst/vorbisplay.py \
+       examples/gst/wavenc.py \
        examples/gstplay/player.py
 
 snap:
diff --git a/examples/gst/wavenc.py b/examples/gst/wavenc.py
new file mode 100644 (file)
index 0000000..40124f8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import sys
+import gst
+
+def decode(filename):
+    output = filename + '.wav'
+    pipeline = ('filesrc location="%s"' + \
+                ' ! spider ! wavenc ! ' + \
+                'filesink location="%s"') % (filename, output)
+    
+    bin = gst.parse_launch(pipeline)
+    bin.set_state(gst.STATE_PLAYING)
+    while bin.iterate():
+        pass
+    bin.set_state(gst.STATE_NULL)
+    
+def main(args):
+    for arg in args[1:]:
+        decode(arg)
+        
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))