[telepathy-butterfly/master] Implement the Initial{Audio, Video} props in StreamedMedia channel

Olivier Le Thanh Duong olivier at lethanh.be
Tue Jan 19 08:12:57 PST 2010


---
 butterfly/channel/media.py |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/butterfly/channel/media.py b/butterfly/channel/media.py
index db9e8c0..e35910e 100644
--- a/butterfly/channel/media.py
+++ b/butterfly/channel/media.py
@@ -28,7 +28,9 @@ from butterfly.util.decorator import async
 from butterfly.handle import ButterflyHandleFactory
 from butterfly.media import ButterflySessionHandler
 
-from telepathy.interfaces import CHANNEL_INTERFACE, CHANNEL_INTERFACE_GROUP
+from telepathy.interfaces import CHANNEL_INTERFACE, CHANNEL_INTERFACE_GROUP,\
+    CHANNEL_TYPE_STREAMED_MEDIA
+from telepathy.constants import MEDIA_STREAM_TYPE_AUDIO, MEDIA_STREAM_TYPE_VIDEO
 
 __all__ = ['ButterflyMediaChannel']
 
@@ -87,6 +89,21 @@ class ButterflyMediaChannel(
         self.GroupFlagsChanged(flags, 0)
         self.__add_initial_participants()
 
+        types = []
+        initial_audio_prop = CHANNEL_TYPE_STREAMED_MEDIA + '.InitialAudio'
+        initial_video_prop = CHANNEL_TYPE_STREAMED_MEDIA + '.InitialVideo'
+        self._add_immutables({
+                'InitialAudio': CHANNEL_TYPE_STREAMED_MEDIA,
+                'InitialVideo': CHANNEL_TYPE_STREAMED_MEDIA,
+                })
+        if props.get(initial_audio_prop, False):
+            types.append(MEDIA_STREAM_TYPE_AUDIO)
+        if props.get(initial_video_prop, False):
+            types.append(MEDIA_STREAM_TYPE_VIDEO)
+        self.RequestStreams(handle, types)
+        
+
+
     def Close(self):
         logger.info("Channel closed by client")
         self._call.end()
-- 
1.5.6.5




More information about the telepathy-commits mailing list