$OpenBSD: patch-papyon_media_conference_py,v 1.1 2012/04/06 08:51:43 jasper Exp $ Migrate to farstream, from fedora's papyon-0.5.6-farstream.patch. --- papyon/media/conference.py.orig Fri Dec 3 19:59:26 2010 +++ papyon/media/conference.py Fri Apr 6 10:50:02 2012 @@ -24,7 +24,7 @@ from papyon.event.media import * import pygst pygst.require('0.10') -import farsight +import farstream import gobject import gst import logging @@ -34,44 +34,44 @@ logger = logging.getLogger("papyon.media.conference") codecs_definitions = { "audio" : [ - (114, "x-msrta", farsight.MEDIA_TYPE_AUDIO, 16000), - (111, "SIREN", farsight.MEDIA_TYPE_AUDIO, 16000), - (112, "G7221", farsight.MEDIA_TYPE_AUDIO, 16000), - (115, "x-msrta", farsight.MEDIA_TYPE_AUDIO, 8000), - (116, "SIREN", farsight.MEDIA_TYPE_AUDIO, 8000), - (4, "G723", farsight.MEDIA_TYPE_AUDIO, 8000), - (8, "PCMA", farsight.MEDIA_TYPE_AUDIO, 8000), - (0, "PCMU", farsight.MEDIA_TYPE_AUDIO, 8000), - (97, "RED", farsight.MEDIA_TYPE_AUDIO, 8000), - (101, "telephone-event", farsight.MEDIA_TYPE_AUDIO, 8000) + (114, "x-msrta", farstream.MEDIA_TYPE_AUDIO, 16000), + (111, "SIREN", farstream.MEDIA_TYPE_AUDIO, 16000), + (112, "G7221", farstream.MEDIA_TYPE_AUDIO, 16000), + (115, "x-msrta", farstream.MEDIA_TYPE_AUDIO, 8000), + (116, "SIREN", farstream.MEDIA_TYPE_AUDIO, 8000), + (4, "G723", farstream.MEDIA_TYPE_AUDIO, 8000), + (8, "PCMA", farstream.MEDIA_TYPE_AUDIO, 8000), + (0, "PCMU", farstream.MEDIA_TYPE_AUDIO, 8000), + (97, "RED", farstream.MEDIA_TYPE_AUDIO, 8000), + (101, "telephone-event", farstream.MEDIA_TYPE_AUDIO, 8000) ], "video" : [ - (121, "x-rtvc1", farsight.MEDIA_TYPE_VIDEO, 90000), - (34, "H263", farsight.MEDIA_TYPE_VIDEO, 90000) + (121, "x-rtvc1", farstream.MEDIA_TYPE_VIDEO, 90000), + (34, "H263", farstream.MEDIA_TYPE_VIDEO, 90000) ] } types = { 0 : None, - farsight.CANDIDATE_TYPE_HOST : "host", - farsight.CANDIDATE_TYPE_SRFLX : "srflx", - farsight.CANDIDATE_TYPE_PRFLX : "prflx", - farsight.CANDIDATE_TYPE_RELAY : "relay" + farstream.CANDIDATE_TYPE_HOST : "host", + farstream.CANDIDATE_TYPE_SRFLX : "srflx", + farstream.CANDIDATE_TYPE_PRFLX : "prflx", + farstream.CANDIDATE_TYPE_RELAY : "relay" } protos = { - farsight.NETWORK_PROTOCOL_TCP : "TCP", - farsight.NETWORK_PROTOCOL_UDP : "UDP" + farstream.NETWORK_PROTOCOL_TCP : "TCP", + farstream.NETWORK_PROTOCOL_UDP : "UDP" } media_names = { - farsight.MEDIA_TYPE_AUDIO : "audio", - farsight.MEDIA_TYPE_VIDEO : "video" + farstream.MEDIA_TYPE_AUDIO : "audio", + farstream.MEDIA_TYPE_VIDEO : "video" } media_types = { - "audio" : farsight.MEDIA_TYPE_AUDIO, - "video" : farsight.MEDIA_TYPE_VIDEO + "audio" : farstream.MEDIA_TYPE_AUDIO, + "video" : farstream.MEDIA_TYPE_VIDEO } @@ -125,10 +125,10 @@ class MediaSessionHandler(MediaSessionEventInterface): ret = gst.BUS_PASS if msg.type == gst.MESSAGE_ELEMENT: s = msg.structure - if s.has_name("farsight-error"): - logger.error("Farsight error : %s" % s['error-msg']) - if s.has_name("farsight-codecs-changed"): - logger.debug("Farsight codecs changed") + if s.has_name("farstream.error"): + logger.error("Farstream error : %s" % s['error-msg']) + if s.has_name("farstream.codecs-changed"): + logger.debug("Farstream codecs changed") ret = gst.BUS_DROP ready = s["session"].get_property("codecs-ready") if ready: @@ -136,21 +136,21 @@ class MediaSessionHandler(MediaSessionEventInterface): name = media_names[s["session"].get_property("media-type")] stream = self._session.get_stream(name) stream.set_local_codecs(convert_fs_codecs(codecs)) - if s.has_name("farsight-new-local-candidate"): + if s.has_name("farstream.new-local-candidate"): logger.debug("New local candidate") ret = gst.BUS_DROP name = media_names[s["stream"].get_property("session").get_property("media-type")] candidate = convert_fs_candidate(s["candidate"]) stream = self._session.get_stream(name) stream.new_local_candidate(candidate) - if s.has_name("farsight-local-candidates-prepared"): + if s.has_name("farstream.local-candidates-prepared"): logger.debug("Local candidates are prepared") ret = gst.BUS_DROP type = s["stream"].get_property("session").get_property("media-type") name = media_names[type] stream = self._session.get_stream(name) stream.local_candidates_prepared() - if s.has_name("farsight-new-active-candidate-pair"): + if s.has_name("farstream.new-active-candidate-pair"): logger.debug("New active candidate pair") ret = gst.BUS_DROP type = s["stream"].get_property("session").get_property("media-type") @@ -220,10 +220,10 @@ class MediaStreamHandler(MediaStreamEventInterface): pad.link(sink.get_pad("sink")) -# Farsight utility functions +# Farstream utility functions def create_notifier(pipeline, filename): - notifier = farsight.ElementAddedNotifier() + notifier = farstream.ElementAddedNotifier() notifier.add(pipeline) notifier.set_properties_from_file(filename) return notifier @@ -246,14 +246,14 @@ def convert_fs_candidate(fscandidate): def convert_media_candidates(candidates): fscandidates = [] for candidate in candidates: - proto = farsight.NETWORK_PROTOCOL_TCP + proto = farstream.NETWORK_PROTOCOL_TCP if candidate.transport == "UDP": - proto = farsight.NETWORK_PROTOCOL_UDP + proto = farstream.NETWORK_PROTOCOL_UDP type = 0 for k,v in types.iteritems(): if v == candidate.type: type = k - fscandidate = farsight.Candidate() + fscandidate = farstream.Candidate() fscandidate.foundation = candidate.foundation fscandidate.ip = candidate.ip fscandidate.port = candidate.port @@ -269,7 +269,7 @@ def convert_media_candidates(candidates): def build_codecs(type): codecs = [] for args in codecs_definitions[type]: - codec = farsight.Codec(*args) + codec = farstream.Codec(*args) codecs.append(codec) return codecs @@ -288,7 +288,7 @@ def convert_media_codecs(codecs, name): fscodecs = [] media_type = media_types[name] for codec in codecs: - fscodec = farsight.Codec( + fscodec = farstream.Codec( codec.payload, codec.encoding, media_type,