arek - in flumotion/branches/platform-3-patterndetect: . flumotion/component/consumers/disker

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Mon Jun 25 15:34:55 CEST 2007


Author: arek
Date: Mon Jun 25 15:34:54 2007
New Revision: 5239

Modified:
   flumotion/branches/platform-3-patterndetect/ChangeLog
   flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.py
   flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.xml
Log:
	* flumotion/component/consumers/disker/disker.py
	  (Disker.configure_pipeline, Disker._markers_event_probe,
	  Disker._on_marker_stop, Disker._on_marker_start):
	* flumotion/component/consumers/disker/disker.xml:
	Merge from trunk: 5235, 5236
	Add stream markers support in disker, take 2.



Modified: flumotion/branches/platform-3-patterndetect/ChangeLog
==============================================================================
--- flumotion/branches/platform-3-patterndetect/ChangeLog	(original)
+++ flumotion/branches/platform-3-patterndetect/ChangeLog	Mon Jun 25 15:34:54 2007
@@ -1,3 +1,12 @@
+2007-06-25  Arek Korbik  <arkadini at gmail.com>
+
+	* flumotion/component/consumers/disker/disker.py
+	  (Disker.configure_pipeline, Disker._markers_event_probe,
+	  Disker._on_marker_stop, Disker._on_marker_start):
+	* flumotion/component/consumers/disker/disker.xml:
+	Merge from trunk: 5235, 5236
+	Add stream markers support in disker, take 2.
+
 2007-06-20  Michael Smith <msmith at fluendo.com>
 
 	* flumotion/manager/manager.py:

Modified: flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.py
==============================================================================
--- flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.py	(original)
+++ flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.py	Mon Jun 25 15:34:54 2007
@@ -365,6 +365,13 @@
         # connect to client-removed so we can detect errors in file writing
         sink.connect('client-removed', self._client_removed_cb)
 
+        # set event probe if we should react to video mark events
+        react_to_marks = properties.get('react-to-stream-markers', False)
+        if react_to_marks:
+            pfx = properties.get('stream-marker-filename-prefix', '%03d.')
+            self._marker_prefix = pfx
+            sink.get_pad('sink').add_event_probe(self._markers_event_probe)
+
     def eventStarted(self, event):
         self.change_filename(event.content, event.start.timetuple())
 
@@ -386,4 +393,34 @@
         else:
             self.warning("Cannot parse ICAL; neccesary modules not installed")
 
+    def _markers_event_probe(self, element, event):
+        if event.type == gst.EVENT_CUSTOM_DOWNSTREAM:
+            evt_struct = event.get_structure()
+            if evt_struct.get_name() == 'FluStreamMark':
+                if evt_struct['action'] == 'start':
+                    self._on_marker_start(evt_struct['prog_id'])
+                elif evt_struct['action'] == 'stop':
+                    self._on_marker_stop()
+        return True
+
+    def _on_marker_stop(self):
+        self.stop_recording()
+
+    def _on_marker_start(self, data):
+        tmpl = self._defaultFilenameTemplate
+        if self._marker_prefix:
+            try:
+                tmpl = '%s%s' % (self._marker_prefix % data,
+                                 self._defaultFilenameTemplate)
+            except TypeError, err:
+                m = messages.Warning(T_(N_('Failed expanding filename prefix: '
+                                           '%r <-- %r.'),
+                                        self._marker_prefix, data),
+                                     id='expand-marker-prefix')
+                self.addMessage(m)
+                self.warning('Failed expanding filename prefix: '
+                             '%r <-- %r; %r' %
+                             (self._marker_prefix, data, err))
+        self.change_filename(tmpl)
+
 pygobject.type_register(Disker)

Modified: flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.xml
==============================================================================
--- flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.xml	(original)
+++ flumotion/branches/platform-3-patterndetect/flumotion/component/consumers/disker/disker.xml	Mon Jun 25 15:34:54 2007
@@ -29,6 +29,10 @@
         <property name="symlink-to-current-recording" type="string" required="no" />
         <property name="ical-schedule" type="string" required="no" />
         <property name="filename" type="string" required="no" />
+        <property name="react-to-stream-markers" type="bool" required="no"
+                  description="Start/stop the disker when stream marker events are received" />
+        <property name="stream-marker-filename-prefix" type="string"
+                  required="no" description="Formatting template for program id (default '%03d.')" />
       </properties>
     </component>
   </components>


More information about the flumotion-commit mailing list