]> git.parisson.com Git - piplayer.git/commitdiff
add uri update
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 22 Jul 2013 23:35:32 +0000 (01:35 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 22 Jul 2013 23:35:32 +0000 (01:35 +0200)
audio_player_osc.py
guitar.wav [new file with mode: 0644]

index ec6d6f3095d3bf068f14dbcaa2d1c4b8b2c8f341..6310dc55a58dc68503a980c7baea71c0765f5f47 100644 (file)
@@ -22,7 +22,6 @@
 # Boston, MA 02111-1307, USA.
 
 
-
 import gobject
 gobject.threads_init()
 import pygst
@@ -61,7 +60,7 @@ class AudioPlayer(Thread):
         
         # The controller
         self.controller = OSCController(12345)
-        self.controller.add_method('/play', 'i', self.play_stop_cb)
+        self.controller.add_method('/play', 'i', self.play_stop)
         self.controller.start()
  
         # The pipeline
@@ -99,7 +98,6 @@ class AudioPlayer(Thread):
         # The MainLoop
         self.mainloop = gobject.MainLoop()
  
     def on_pad_added(self, element, pad):
         caps = pad.get_caps()
         name = caps[0].get_name()
@@ -124,14 +122,18 @@ class AudioPlayer(Thread):
         print 'on_error:', error[1]
         self.mainloop.quit()
  
-    def play_stop_cb(self, path, value):
+    def play_stop(self, path, value):
         value = value[0]
         if value:
             self.pipeline.set_state(gst.STATE_NULL)
             self.pipeline.set_state(gst.STATE_PLAYING)
         else:
             self.pipeline.set_state(gst.STATE_NULL)
-            
+    
+    def update_uri(uri):
+        self.uri = uri
+        self.srcdec.set_property('uri', self.uri)
+        
     def run(self):
         self.mainloop.run()
 
diff --git a/guitar.wav b/guitar.wav
new file mode 100644 (file)
index 0000000..b5a9e80
Binary files /dev/null and b/guitar.wav differ