msmith - in flumotion/branches/playlist-1: . flumotion/component/producers/playlist

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Thu May 3 11:54:07 CEST 2007


Author: msmith
Date: Thu May  3 11:54:04 2007
New Revision: 4871

Modified:
   flumotion/branches/playlist-1/ChangeLog
   flumotion/branches/playlist-1/flumotion/component/producers/playlist/playlist.py
Log:
        * flumotion/component/producers/playlist/playlist.py:
          Another checkpoint, now with modified clocking and basetime
          distribution working.



Modified: flumotion/branches/playlist-1/ChangeLog
==============================================================================
--- flumotion/branches/playlist-1/ChangeLog	(original)
+++ flumotion/branches/playlist-1/ChangeLog	Thu May  3 11:54:04 2007
@@ -1,3 +1,9 @@
+2007-05-03  Michael Smith <msmith at fluendo.com>
+
+	* flumotion/component/producers/playlist/playlist.py:
+	  Another checkpoint, now with modified clocking and basetime
+	  distribution working.
+
 2007-05-02  Michael Smith <msmith at fluendo.com>
 
 	* flumotion/component/producers/playlist/Makefile.am:

Modified: flumotion/branches/playlist-1/flumotion/component/producers/playlist/playlist.py
==============================================================================
--- flumotion/branches/playlist-1/flumotion/component/producers/playlist/playlist.py	(original)
+++ flumotion/branches/playlist-1/flumotion/component/producers/playlist/playlist.py	Thu May  3 11:54:04 2007
@@ -21,6 +21,7 @@
 
 import gst
 import gobject
+import time
 
 from twisted.internet import defer
 
@@ -167,6 +168,41 @@
             2**31 - 1)
         self.audiocomp.add(asrc)
 
+    def _testScheduling(self, pipeline):
+        # Now, we want to schedule something for a particular date...
+        uri = "file:///home/msmith/media/testfiles/matrix.avi"
+        caps = gst.Caps("video/x-raw-yuv")
+
+        # For testing, try 10 seconds into the future.
+        clock = gst.SystemClock()
+        basetime = clock.get_time()
+
+        # We force usage of a system clock.
+        pipeline.use_clock(clock)
+        # Now we disable default basetime distribution
+        pipeline.set_new_stream_time(gst.CLOCK_TIME_NONE)
+        # And we choose our own basetime...
+        self.debug("Setting basetime of %d", basetime)
+        pipeline.set_base_time(basetime)
+
+#        when = basetime + (10 * gst.SECOND)
+
+        for minute in xrange(35, 50):
+            when = (2007, 5, 3, 10, minute, 0, 0, 123, 0) 
+            whengst = int(time.mktime(when)) * gst.SECOND
+
+            starttime = whengst - basetime
+
+            # This works around a bug somewhere. TODO! 
+            starttime = (starttime / gst.SECOND) * gst.SECOND
+            self.debug("when -> whengst -> starttime = %r, %d, %d", when, whengst, starttime)
+            # For this to work, we must distribute this basetime!
+
+            self.debug("Scheduling start for 10 seconds after startup: %d", starttime)
+            vsrc = file_gnl_src('testgnlfile%d'%minute, uri, caps, starttime,
+                45 * gst.SECOND, 0)
+            self.videocomp.add(vsrc)
+
     def create_pipeline(self):
         pipeline = self._buildPipeline() 
 
@@ -174,17 +210,18 @@
 
         uri = "file:///home/msmith/media/testfiles/matrix.avi"
         caps = gst.Caps("video/x-raw-yuv")
-        vsrc = file_gnl_src('testgnlfile', uri, caps, 10 * gst.SECOND, 
-            15 * gst.SECOND, 0)
-        self.videocomp.add(vsrc)
+#        vsrc = file_gnl_src('testgnlfile', uri, caps, 10 * gst.SECOND, 
+#            15 * gst.SECOND, 0)
+#        self.videocomp.add(vsrc)
+        self._testScheduling(pipeline)
 
         self.connect_feeders(pipeline)
         return pipeline
 
     def do_start(self, clocking):
-        if clocking:
-            self.debug("Slaving to clock")
-            self.set_master_clock(*clocking)
+        #if clocking:
+        #    self.debug("Slaving to clock")
+        #    self.set_master_clock(*clocking)
 
         self.link()
 


More information about the flumotion-commit mailing list