Author: dmeyer
Date: Tue Apr 18 20:04:05 2006
New Revision: 1410

Modified:
   trunk/player/src/generic.py

Log:
improve generic player

Modified: trunk/player/src/generic.py
==============================================================================
--- trunk/player/src/generic.py (original)
+++ trunk/player/src/generic.py Tue Apr 18 20:04:05 2006
@@ -6,14 +6,33 @@
     def __init__(self):
         object.__setattr__(self, 'player', None)
 
+        object.__setattr__(self, 'signals',  {
+            "pause": notifier.Signal(),
+            "play": notifier.Signal(),
+            "pause_toggle": notifier.Signal(),
+            "seek": notifier.Signal(),
+            "open": notifier.Signal(),
+            "start": notifier.Signal(),
+            # Stream ended (either stopped by user or finished)
+            "end": notifier.Signal(),
+            "stream_changed": notifier.Signal(),
+            "frame": notifier.Signal(), # CAP_CANVAS
+            "osd_configure": notifier.Signal(),  # CAP_OSD
+            # Process is about to die (shared memory will go away)
+            "quit": notifier.Signal()
+            })
+
     def open(self, mrl):
-        if self.player:
-            self.player.stop()
-            self.player = None
+        if self.player and self.player.get_state() \
+               not in (STATE_NOT_RUNNING, STATE_IDLE):
+            raise PlayerError('player is running')
         cls = get_player_class(mrl)
         if not cls:
             raise PlayerError("No supported player found to play %s", mrl)
+        # if not self.player or cls.get_player_id() != 
self.player.get_player_id():
         object.__setattr__(self, 'player', cls())
+        for signal in self.signals.keys():
+            self.player.signals[signal].connect_weak(self.signals[signal].emit)
         return self.player.open(mrl)
         
     def __getattr__(self, attr):


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to