pitivi r1294 - in trunk/pitivi: . ui



Author: edwardrv
Date: Sun Sep 28 09:44:04 2008
New Revision: 1294
URL: http://svn.gnome.org/viewvc/pitivi?rev=1294&view=rev

Log:
SmartBin : Add a 'seekable' property to know if we can do seek/getduration on the given bin.

Modified:
   trunk/pitivi/bin.py
   trunk/pitivi/ui/viewer.py

Modified: trunk/pitivi/bin.py
==============================================================================
--- trunk/pitivi/bin.py	(original)
+++ trunk/pitivi/bin.py	Sun Sep 28 09:44:04 2008
@@ -36,7 +36,7 @@
     """
 
     def __init__(self, name, displayname="", has_video=False, has_audio=False,
-                 length=0, width=0, height=0):
+                 length=0, width=0, height=0, is_seekable=False):
         """
         @type name: string
         @param name: The name of the SmartBin (for internal use)
@@ -74,6 +74,14 @@
         self.tmpvsink = None
         self.recording = False
 
+        # set this to True in subclasses if needed
+        self._seekable = is_seekable
+
+    @property
+    def seekable(self):
+        """True if the bin is seekable and has a duration"""
+        return self._seekable
+
     def _addSource(self):
         """ add the source to self """
         raise NotImplementedError
@@ -392,7 +400,8 @@
                           has_video = factory.is_video,
                           has_audio = factory.is_audio,
                           width = width, height = height,
-                          length = factory.getDuration())
+                          length = factory.getDuration(),
+                          is_seekable = True)
 
     def _addSource(self):
         self.add(self.source)
@@ -450,7 +459,8 @@
                           has_video=True, has_audio=True,
                           width=settings.videowidth,
                           height=settings.videoheight,
-                          length=project.timeline.videocomp.duration)
+                          length=project.timeline.videocomp.duration,
+                          is_seekable=True)
 
     def _addSource(self):
         self.add(self.source)

Modified: trunk/pitivi/ui/viewer.py
==============================================================================
--- trunk/pitivi/ui/viewer.py	(original)
+++ trunk/pitivi/ui/viewer.py	Sun Sep 28 09:44:04 2008
@@ -385,7 +385,9 @@
 
     def _currentPlaygroundChangedCb(self, playground, smartbin):
         gst.log("smartbin:%s" % smartbin)
-        if smartbin == playground.default or not hasattr(smartbin, "factory"):
+
+        if not smartbin.seekable:
+            # live sources or defaults, no duration/seeking available
             self.slider.set_sensitive(False)
             self.playpause_button.set_sensitive(False)
             self.next_button.set_sensitive(False)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]