thomasvs - in flumotion/branches/eaters-info-1: .
flumotion/component flumotion/component/base
flumotion/component/consumers/disker
flumotion/component/consumers/httpstreamer
flumotion/component/converters/overlay
flumotion/component/encoders/theora
flumotion/component/encoders/vorbis flumotion/component/muxers
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Tue Mar 13 15:54:20 CET 2007
Author: thomasvs
Date: Tue Mar 13 15:54:15 2007
New Revision: 4625
Modified:
flumotion/branches/eaters-info-1/ChangeLog
flumotion/branches/eaters-info-1/flumotion/component/base/admin_gtk.py
flumotion/branches/eaters-info-1/flumotion/component/base/eaters.glade
flumotion/branches/eaters-info-1/flumotion/component/consumers/disker/disker.py
flumotion/branches/eaters-info-1/flumotion/component/consumers/httpstreamer/http.py
flumotion/branches/eaters-info-1/flumotion/component/converters/overlay/overlay.py
flumotion/branches/eaters-info-1/flumotion/component/encoders/theora/theora.py
flumotion/branches/eaters-info-1/flumotion/component/encoders/vorbis/vorbis010.py
flumotion/branches/eaters-info-1/flumotion/component/feedcomponent010.py
flumotion/branches/eaters-info-1/flumotion/component/muxers/ogg.py
Log:
* flumotion/component/base/admin_gtk.py:
Fix state watcher so setitem/delitem hides correctly.
Implement handling of offset disconts.
* flumotion/component/base/eaters.glade:
* flumotion/component/converters/overlay/overlay.py:
Overlay handles raw video and thus can check timestamps
and offsets.
* flumotion/component/encoders/theora/theora.py:
* flumotion/component/encoders/vorbis/vorbis010.py:
Encoders deal with raw data and thus can check offsets too.
* flumotion/component/feedcomponent010.py:
Set zero values on some keys.
Add Eater.offsetDiscont() and use it from imperfect-offset messages.
* flumotion/component/muxers/ogg.py:
Ogg muxer should check incoming timestamps, but the offsets
are used to store granule pos, so ignore them.
* flumotion/component/consumers/disker/disker.py:
* flumotion/component/consumers/httpstreamer/http.py:
These consumers deal with muxed streams, so checking timestamps
does not work, but offsets should.
Modified: flumotion/branches/eaters-info-1/ChangeLog
==============================================================================
--- flumotion/branches/eaters-info-1/ChangeLog (original)
+++ flumotion/branches/eaters-info-1/ChangeLog Tue Mar 13 15:54:15 2007
@@ -1,5 +1,28 @@
2007-03-13 Thomas Vander Stichele <thomas at apestaart dot org>
+ * flumotion/component/base/admin_gtk.py:
+ Fix state watcher so setitem/delitem hides correctly.
+ Implement handling of offset disconts.
+ * flumotion/component/base/eaters.glade:
+ * flumotion/component/converters/overlay/overlay.py:
+ Overlay handles raw video and thus can check timestamps
+ and offsets.
+ * flumotion/component/encoders/theora/theora.py:
+ * flumotion/component/encoders/vorbis/vorbis010.py:
+ Encoders deal with raw data and thus can check offsets too.
+ * flumotion/component/feedcomponent010.py:
+ Set zero values on some keys.
+ Add Eater.offsetDiscont() and use it from imperfect-offset messages.
+ * flumotion/component/muxers/ogg.py:
+ Ogg muxer should check incoming timestamps, but the offsets
+ are used to store granule pos, so ignore them.
+ * flumotion/component/consumers/disker/disker.py:
+ * flumotion/component/consumers/httpstreamer/http.py:
+ These consumers deal with muxed streams, so checking timestamps
+ does not work, but offsets should.
+
+2007-03-13 Thomas Vander Stichele <thomas at apestaart dot org>
+
* flumotion/component/feedcomponent.py:
Add an identity checking for imperfect timestamps and offsets when
requested.
Modified: flumotion/branches/eaters-info-1/flumotion/component/base/admin_gtk.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/base/admin_gtk.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/base/admin_gtk.py Tue Mar 13 15:54:15 2007
@@ -437,11 +437,11 @@
self.removers[k](self.state, v)
def onSetItem(self, obj, k, sk, v):
- if k in self.setitemers:
+ if self.shown and k in self.setitemers:
self.setitemers[k](self.state, sk, v)
def onDelItem(self, obj, k, sk, v):
- if k in self.setitemers:
+ if self.shown and k in self.setitemers:
self.setitemers[k](self.state, sk, v)
def unwatch(self):
@@ -704,6 +704,7 @@
self._updateDisconnectionTime()
def _setEaterConnectionItem(self, state, key, value):
+ # timestamps
if key == 'countTimestampDiscont':
self.labels['timestamp-discont-count-current'].set_text(str(value))
if value > 0:
@@ -711,25 +712,69 @@
elif key == 'timeTimestampDiscont':
text = time.strftime("%c", time.localtime(value))
self.labels['timestamp-discont-time-current'].set_text(text)
- self._table_timestamp_discont_current.show()
+ if value is not None:
+ self._table_timestamp_discont_current.show()
elif key == 'lastTimestampDiscont':
text = _("%f seconds") % value
self.labels['timestamp-discont-last-current'].set_text(text)
- self._table_timestamp_discont_current.show()
+ if value > 0.0:
+ self._table_timestamp_discont_current.show()
elif key == 'totalTimestampDiscont':
text = _("%f seconds") % value
self.labels['timestamp-discont-total-current'].set_text(text)
- self._table_timestamp_discont_current.show()
+ if value > 0.0:
+ self._table_timestamp_discont_current.show()
+ # offsets
+ elif key == 'countOffsetDiscont':
+ self.labels['offset-discont-count-current'].set_text(str(value))
+ if value > 0:
+ self._expander_discont_current.show()
+ elif key == 'timeOffsetDiscont':
+ text = time.strftime("%c", time.localtime(value))
+ self.labels['offset-discont-time-current'].set_text(text)
+ if value is not None:
+ self._table_offset_discont_current.show()
+ elif key == 'lastOffsetDiscont':
+ text = _("%d units") % value
+ self.labels['offset-discont-last-current'].set_text(text)
+ if value > 0:
+ self._table_offset_discont_current.show()
+ elif key == 'totalOffsetDiscont':
+ text = _("%d units") % value
+ self.labels['offset-discont-total-current'].set_text(text)
+ if value > 0:
+ self._table_offset_discont_current.show()
def _setEaterCountTimestampDiscont(self, state, value):
+ if value is None:
+ return
self.labels['timestamp-discont-count-total'].set_text(str(value))
- if value > 0:
+ if value > 0.0:
self._expander_discont_total.show()
def _setEaterTotalTimestampDiscont(self, state, value):
+ if value is None:
+ return
text = _("%f seconds") % value
self.labels['timestamp-discont-total'].set_text(text)
- self._table_timestamp_discont_total.show()
+ if value > 0.0:
+ self._table_timestamp_discont_total.show()
+
+ def _setEaterCountOffsetDiscont(self, state, value):
+ if value is None:
+ return
+ self.labels['offset-discont-count-total'].set_text(str(value))
+ if value > 0:
+ self._expander_discont_total.show()
+
+ def _setEaterTotalOffsetDiscont(self, state, value):
+ if value is None:
+ return
+ text = _("%d units") % value
+ self.labels['offset-discont-total'].set_text(text)
+ if value > 0:
+ self._table_offset_discont_total.show()
+
def _setEaterLastConnect(self, state, value):
if value:
@@ -746,6 +791,9 @@
# when we initially get the uiState, connection is an already set dict
# this makes sure we handle getting that dict initially
def _setEaterConnection(self, state, value):
+ # can be called with None value due to StateWatcher
+ if value is None:
+ return
for k, v in value.items():
self._setEaterConnectionItem(state, k, v)
@@ -776,9 +824,12 @@
'lastConnect': self._setEaterLastConnect,
'countTimestampDiscont': self._setEaterCountTimestampDiscont,
'totalTimestampDiscont': self._setEaterTotalTimestampDiscont,
+ 'countOffsetDiscont': self._setEaterCountOffsetDiscont,
+ 'totalOffsetDiscont': self._setEaterTotalOffsetDiscont,
'totalConnections': self._setEaterTotalConnections,
+ # need to have a setter for connection to be able to show
+ # it initially
'connection': self._setEaterConnection,
- #'bytesReadCurrent': self._setEaterBytesReadCurrent,
},
{},
{},
Modified: flumotion/branches/eaters-info-1/flumotion/component/base/eaters.glade
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/base/eaters.glade (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/base/eaters.glade Tue Mar 13 15:54:15 2007
@@ -101,7 +101,7 @@
<widget class="GtkTable" id="table-eater">
<property name="border_width">6</property>
<property name="visible">True</property>
- <property name="n_rows">10</property>
+ <property name="n_rows">7</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@@ -955,153 +955,6 @@
</child>
<child>
- <widget class="GtkLabel" id="label38">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Number of discontinuities</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Total size of discontinuities</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Total discontinuous time</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-disconts-total">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">3</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-offset-discont-total">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">30 bytes</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-timestamp-discont-total">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">3 seconds</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.550000011921</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkExpander" id="expander-discont-total">
<property name="border_width">6</property>
<property name="expanded">False</property>
@@ -1416,8 +1269,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">fill</property>
</packing>
</child>
@@ -1428,10 +1281,6 @@
<property name="fill">False</property>
</packing>
</child>
-
- <child>
- <placeholder/>
- </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: flumotion/branches/eaters-info-1/flumotion/component/consumers/disker/disker.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/consumers/disker/disker.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/consumers/disker/disker.py Tue Mar 13 15:54:15 2007
@@ -70,6 +70,7 @@
class Disker(feedcomponent.ParseLaunchComponent, log.Loggable):
componentMediumClass = DiskerMedium
+ checkOffset = True
pipe_template = 'multifdsink sync-method=1 name=fdsink mode=1 sync=false'
file = None
directory = None
Modified: flumotion/branches/eaters-info-1/flumotion/component/consumers/httpstreamer/http.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/consumers/httpstreamer/http.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/consumers/httpstreamer/http.py Tue Mar 13 15:54:15 2007
@@ -226,6 +226,8 @@
class MultifdSinkStreamer(feedcomponent.ParseLaunchComponent, Stats):
implements(interfaces.IStreamingComponent)
+ checkOffset = True
+
# this object is given to the HTTPMedium as comp
logCategory = 'cons-http'
Modified: flumotion/branches/eaters-info-1/flumotion/component/converters/overlay/overlay.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/converters/overlay/overlay.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/converters/overlay/overlay.py Tue Mar 13 15:54:15 2007
@@ -31,6 +31,8 @@
import tempfile
class Overlay(feedcomponent.ParseLaunchComponent):
+ checkTimestamp = True
+ checkOffset = True
_filename = None
def get_pipeline_string(self, properties):
Modified: flumotion/branches/eaters-info-1/flumotion/component/encoders/theora/theora.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/encoders/theora/theora.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/encoders/theora/theora.py Tue Mar 13 15:54:15 2007
@@ -27,6 +27,7 @@
class Theora(feedcomponent.ParseLaunchComponent):
checkTimestamp = True
+ checkOffset = True
def do_check(self):
self.debug('running Theora check')
Modified: flumotion/branches/eaters-info-1/flumotion/component/encoders/vorbis/vorbis010.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/encoders/vorbis/vorbis010.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/encoders/vorbis/vorbis010.py Tue Mar 13 15:54:15 2007
@@ -27,6 +27,7 @@
class Vorbis(feedcomponent.ParseLaunchComponent):
checkTimestamp = True
+ checkOffset = True
def do_check(self):
self.debug('running Vorbis check')
Modified: flumotion/branches/eaters-info-1/flumotion/component/feedcomponent010.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/feedcomponent010.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/feedcomponent010.py Tue Mar 13 15:54:15 2007
@@ -224,8 +224,8 @@
"totalTimestampDiscont": 0.0,
"countTimestampDiscont": 0,
"timeOffsetDiscont": None,
- "lastOffsetDiscont": None,
- "totalOffsetDiscont": None,
+ "lastOffsetDiscont": 0,
+ "totalOffsetDiscont": 0,
"countOffsetDiscont": 0,
}
@@ -305,6 +305,25 @@
uiState.set('totalTimestampDiscont',
uiState.get('totalTimestampDiscont', 0) + seconds)
+ def offsetDiscont(self, units):
+ """
+ Inform the eater of an offset discontinuity.
+ This is called from a bus message handler, so in the main thread.
+ """
+ uiState = self.uiState
+
+ c = uiState.get('connection') # dict
+ uiState.setitem('connection', 'countOffsetDiscont',
+ c.get('countOffsetDiscont', 0) + 1)
+ uiState.set('countOffsetDiscont',
+ uiState.get('countOffsetDiscont', 0) + 1)
+
+ uiState.setitem('connection', 'timeOffsetDiscont', time.time())
+ uiState.setitem('connection', 'lastOffsetDiscont', units)
+ uiState.setitem('connection', 'totalOffsetDiscont',
+ c.get('totalOffsetDiscont', 0) + units)
+ uiState.set('totalOffsetDiscont',
+ uiState.get('totalOffsetDiscont', 0) + units)
class FeedComponent(basecomponent.BaseComponent):
"""
@@ -484,7 +503,17 @@
gst.TIME_ARGS(prevTs),
gst.TIME_ARGS(curTs))
self._eaters[feedId].timestampDiscont(dSeconds)
-
+
+ def eaterOffsetDiscont(self, feedId, prevOffsetEnd, curOffset):
+ """
+ Inform of a timestamp discontinuity for the given eater.
+ """
+ discont = curOffset - prevOffsetEnd
+ self.debug(
+ "we have a discont on feedId %s of %d units between %d and %d ",
+ feedId, discont, prevOffsetEnd, curOffset)
+ self._eaters[feedId].offsetDiscont(discont)
+
### FeedComponent methods
def addEffect(self, effect):
self.effects[effect.name] = effect
@@ -666,6 +695,17 @@
s = message.structure
self.eaterTimestampDiscont(feedId, s["prev-timestamp"],
s["prev-duration"], s["cur-timestamp"])
+ elif message.structure.get_name() == 'imperfect-offset':
+ identityName = src.get_name()
+ eaterName = identityName.split("-identity")[0]
+ feedId = eaterName[len('eater:'):]
+
+ self.log("we have an imperfect stream from %s" % src.get_name())
+ # figure out the discontinuity
+ s = message.structure
+ self.eaterOffsetDiscont(feedId, s["prev-offset-end"],
+ s["cur-offset"])
+
else:
self.log('message received: %r' % message)
Modified: flumotion/branches/eaters-info-1/flumotion/component/muxers/ogg.py
==============================================================================
--- flumotion/branches/eaters-info-1/flumotion/component/muxers/ogg.py (original)
+++ flumotion/branches/eaters-info-1/flumotion/component/muxers/ogg.py Tue Mar 13 15:54:15 2007
@@ -24,6 +24,8 @@
from flumotion.component import feedcomponent
class Ogg(feedcomponent.MultiInputParseLaunchComponent):
+ checkTimestamp = True
+
def do_check(self):
self.debug('running Ogg check')
import checks
More information about the flumotion-commit
mailing list