[Jingle] a bit of documentation/clarification ; added make_bin_from_config
This commit is contained in:
parent
5401b457d5
commit
d295f9261d
4 changed files with 25 additions and 28 deletions
|
@ -25,7 +25,6 @@ Handles the jingle signalling protocol
|
||||||
# - video integration
|
# - video integration
|
||||||
# * config:
|
# * config:
|
||||||
# - codecs
|
# - codecs
|
||||||
# - STUN
|
|
||||||
|
|
||||||
# * figure out why it doesn't work with pidgin:
|
# * figure out why it doesn't work with pidgin:
|
||||||
# That's maybe a bug in pidgin:
|
# That's maybe a bug in pidgin:
|
||||||
|
|
|
@ -106,6 +106,9 @@ class JingleContent(object):
|
||||||
payload=payload)
|
payload=payload)
|
||||||
|
|
||||||
def send_candidate(self, candidate):
|
def send_candidate(self, candidate):
|
||||||
|
"""
|
||||||
|
Send a transport candidate for a previously defined transport.
|
||||||
|
"""
|
||||||
content = self.__content()
|
content = self.__content()
|
||||||
content.addChild(self.transport.make_transport([candidate]))
|
content.addChild(self.transport.make_transport([candidate]))
|
||||||
self.session.send_transport_info(content)
|
self.session.send_transport_info(content)
|
||||||
|
|
|
@ -60,7 +60,7 @@ class JingleRTPContent(JingleContent):
|
||||||
|
|
||||||
# conference
|
# conference
|
||||||
self.conference = gst.element_factory_make('fsrtpconference')
|
self.conference = gst.element_factory_make('fsrtpconference')
|
||||||
self.conference.set_property("sdes-cname", self.session.ourjid)
|
self.conference.set_property('sdes-cname', self.session.ourjid)
|
||||||
self.pipeline.add(self.conference)
|
self.pipeline.add(self.conference)
|
||||||
self.funnel = None
|
self.funnel = None
|
||||||
|
|
||||||
|
@ -88,6 +88,16 @@ class JingleRTPContent(JingleContent):
|
||||||
return (JingleContent.is_ready(self) and self.candidates_ready
|
return (JingleContent.is_ready(self) and self.candidates_ready
|
||||||
and self.p2psession.get_property('codecs-ready'))
|
and self.p2psession.get_property('codecs-ready'))
|
||||||
|
|
||||||
|
def make_bin_from_config(self, config_key, pipeline, text):
|
||||||
|
try:
|
||||||
|
bin = gst.parse_bin_from_description(pipeline
|
||||||
|
% gajim.config.get(config_key), True)
|
||||||
|
except GError, error_str:
|
||||||
|
self.session.connection.dispatch('ERROR',
|
||||||
|
(_("%s configuration error") % text.capitalize(),
|
||||||
|
_("Couldn't setup %s. Check your configuration.\n\nError was:\n%s")
|
||||||
|
% (text, error_str)))
|
||||||
|
|
||||||
def add_remote_candidates(self, candidates):
|
def add_remote_candidates(self, candidates):
|
||||||
JingleContent.add_remote_candidates(self, candidates)
|
JingleContent.add_remote_candidates(self, candidates)
|
||||||
# FIXME: connectivity should not be etablished yet
|
# FIXME: connectivity should not be etablished yet
|
||||||
|
@ -96,6 +106,7 @@ class JingleRTPContent(JingleContent):
|
||||||
self.p2pstream.set_remote_candidates(candidates)
|
self.p2pstream.set_remote_candidates(candidates)
|
||||||
|
|
||||||
def batch_dtmf(self, events):
|
def batch_dtmf(self, events):
|
||||||
|
""" Send several DTMF tones. """
|
||||||
if self._dtmf_running:
|
if self._dtmf_running:
|
||||||
raise Exception # TODO: Proper exception
|
raise Exception # TODO: Proper exception
|
||||||
self._dtmf_running = True
|
self._dtmf_running = True
|
||||||
|
@ -259,19 +270,11 @@ class JingleAudio(JingleRTPContent):
|
||||||
|
|
||||||
# the local parts
|
# the local parts
|
||||||
# TODO: Add queues?
|
# TODO: Add queues?
|
||||||
try:
|
src_bin = self.make_bin_from_config('audio_input_device',
|
||||||
src_bin = gst.parse_bin_from_description('%s ! audioconvert'
|
'%s ! audioconvert', _("audio input"))
|
||||||
% gajim.config.get('audio_input_device'), True)
|
|
||||||
except GError:
|
|
||||||
self.session.connection.dispatch('ERROR', (_("Audio configuration error"),
|
|
||||||
_("Couldn't setup audio input. Check your audio configuration.")))
|
|
||||||
|
|
||||||
try:
|
self.sink = self.make_bin_from_config('audio_output_device',
|
||||||
self.sink = gst.parse_bin_from_description('audioconvert ! %s'
|
'audioconvert ! %s', _("audio output"))
|
||||||
% gajim.config.get('audio_output_device'), True)
|
|
||||||
except GError:
|
|
||||||
self.session.connection.dispatch('ERROR', (_("Audio configuration error"),
|
|
||||||
_("Couldn't setup audio output. Check your audio configuration.")))
|
|
||||||
|
|
||||||
self.mic_volume = src_bin.get_by_name('gajim_vol')
|
self.mic_volume = src_bin.get_by_name('gajim_vol')
|
||||||
self.mic_volume.set_property('volume', 1)
|
self.mic_volume.set_property('volume', 1)
|
||||||
|
@ -299,24 +302,16 @@ class JingleVideo(JingleRTPContent):
|
||||||
JingleRTPContent.setup_stream(self)
|
JingleRTPContent.setup_stream(self)
|
||||||
|
|
||||||
# the local parts
|
# the local parts
|
||||||
try:
|
src_bin = self.make_bin_from_config('video_input_device',
|
||||||
src_bin = gst.parse_bin_from_description('%s ! videoscale ! ffmpegcolorspace'
|
'%s ! videoscale ! ffmpegcolorspace', _("video input"))
|
||||||
% gajim.config.get('video_input_device'), True)
|
|
||||||
except GError:
|
|
||||||
self.session.connection.dispatch('ERROR', (_("Video configuration error"),
|
|
||||||
_("Couldn't setup video input. Check your video configuration.")))
|
|
||||||
#caps = gst.element_factory_make('capsfilter')
|
#caps = gst.element_factory_make('capsfilter')
|
||||||
#caps.set_property('caps', gst.caps_from_string('video/x-raw-yuv, width=320, height=240'))
|
#caps.set_property('caps', gst.caps_from_string('video/x-raw-yuv, width=320, height=240'))
|
||||||
|
|
||||||
self.pipeline.add(src_bin)#, caps)
|
self.pipeline.add(src_bin)#, caps)
|
||||||
#src_bin.link(caps)
|
#src_bin.link(caps)
|
||||||
|
|
||||||
try:
|
self.sink = self.make_bin_from_config('video_output_device',
|
||||||
self.sink = gst.parse_bin_from_description('videoscale ! ffmpegcolorspace ! %s'
|
'%s ! videoscale ! ffmpegcolorspace', _("video output"))
|
||||||
% gajim.config.get('video_output_device'), True)
|
|
||||||
except GError:
|
|
||||||
self.session.connection.dispatch('ERROR', (_("Video configuration error"),
|
|
||||||
_("Couldn't setup video output. Check your video configuration.")))
|
|
||||||
self.pipeline.add(self.sink)
|
self.pipeline.add(self.sink)
|
||||||
|
|
||||||
src_bin.get_pad('src').link(self.p2psession.get_property('sink-pad'))
|
src_bin.get_pad('src').link(self.p2psession.get_property('sink-pad'))
|
||||||
|
|
|
@ -16,7 +16,6 @@ Handles Jingle sessions (XEP 0166)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#TODO:
|
#TODO:
|
||||||
# * Have JingleContent here
|
|
||||||
# * 'senders' attribute of 'content' element
|
# * 'senders' attribute of 'content' element
|
||||||
# * security preconditions
|
# * security preconditions
|
||||||
# * actions:
|
# * actions:
|
||||||
|
@ -55,7 +54,8 @@ class TieBreak(Exception):
|
||||||
|
|
||||||
class JingleSession(object):
|
class JingleSession(object):
|
||||||
"""
|
"""
|
||||||
This represents one jingle session
|
This represents one jingle session, that is, one or more content types
|
||||||
|
negotiated between an initiator and a responder.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, con, weinitiate, jid, sid=None):
|
def __init__(self, con, weinitiate, jid, sid=None):
|
||||||
|
|
Loading…
Add table
Reference in a new issue