[Jingle] a bit of documentation/clarification ; added make_bin_from_config
This commit is contained in:
parent
5401b457d5
commit
d295f9261d
|
@ -25,7 +25,6 @@ Handles the jingle signalling protocol
|
|||
# - video integration
|
||||
# * config:
|
||||
# - codecs
|
||||
# - STUN
|
||||
|
||||
# * figure out why it doesn't work with pidgin:
|
||||
# That's maybe a bug in pidgin:
|
||||
|
|
|
@ -106,6 +106,9 @@ class JingleContent(object):
|
|||
payload=payload)
|
||||
|
||||
def send_candidate(self, candidate):
|
||||
"""
|
||||
Send a transport candidate for a previously defined transport.
|
||||
"""
|
||||
content = self.__content()
|
||||
content.addChild(self.transport.make_transport([candidate]))
|
||||
self.session.send_transport_info(content)
|
||||
|
|
|
@ -60,7 +60,7 @@ class JingleRTPContent(JingleContent):
|
|||
|
||||
# conference
|
||||
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.funnel = None
|
||||
|
||||
|
@ -88,6 +88,16 @@ class JingleRTPContent(JingleContent):
|
|||
return (JingleContent.is_ready(self) and self.candidates_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):
|
||||
JingleContent.add_remote_candidates(self, candidates)
|
||||
# FIXME: connectivity should not be etablished yet
|
||||
|
@ -96,6 +106,7 @@ class JingleRTPContent(JingleContent):
|
|||
self.p2pstream.set_remote_candidates(candidates)
|
||||
|
||||
def batch_dtmf(self, events):
|
||||
""" Send several DTMF tones. """
|
||||
if self._dtmf_running:
|
||||
raise Exception # TODO: Proper exception
|
||||
self._dtmf_running = True
|
||||
|
@ -259,19 +270,11 @@ class JingleAudio(JingleRTPContent):
|
|||
|
||||
# the local parts
|
||||
# TODO: Add queues?
|
||||
try:
|
||||
src_bin = gst.parse_bin_from_description('%s ! audioconvert'
|
||||
% 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.")))
|
||||
src_bin = self.make_bin_from_config('audio_input_device',
|
||||
'%s ! audioconvert', _("audio input"))
|
||||
|
||||
try:
|
||||
self.sink = gst.parse_bin_from_description('audioconvert ! %s'
|
||||
% 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.sink = self.make_bin_from_config('audio_output_device',
|
||||
'audioconvert ! %s', _("audio output"))
|
||||
|
||||
self.mic_volume = src_bin.get_by_name('gajim_vol')
|
||||
self.mic_volume.set_property('volume', 1)
|
||||
|
@ -299,24 +302,16 @@ class JingleVideo(JingleRTPContent):
|
|||
JingleRTPContent.setup_stream(self)
|
||||
|
||||
# the local parts
|
||||
try:
|
||||
src_bin = gst.parse_bin_from_description('%s ! videoscale ! ffmpegcolorspace'
|
||||
% 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.")))
|
||||
src_bin = self.make_bin_from_config('video_input_device',
|
||||
'%s ! videoscale ! ffmpegcolorspace', _("video input"))
|
||||
#caps = gst.element_factory_make('capsfilter')
|
||||
#caps.set_property('caps', gst.caps_from_string('video/x-raw-yuv, width=320, height=240'))
|
||||
|
||||
self.pipeline.add(src_bin)#, caps)
|
||||
#src_bin.link(caps)
|
||||
|
||||
try:
|
||||
self.sink = gst.parse_bin_from_description('videoscale ! ffmpegcolorspace ! %s'
|
||||
% 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.sink = self.make_bin_from_config('video_output_device',
|
||||
'%s ! videoscale ! ffmpegcolorspace', _("video output"))
|
||||
self.pipeline.add(self.sink)
|
||||
|
||||
src_bin.get_pad('src').link(self.p2psession.get_property('sink-pad'))
|
||||
|
|
|
@ -16,7 +16,6 @@ Handles Jingle sessions (XEP 0166)
|
|||
"""
|
||||
|
||||
#TODO:
|
||||
# * Have JingleContent here
|
||||
# * 'senders' attribute of 'content' element
|
||||
# * security preconditions
|
||||
# * actions:
|
||||
|
@ -55,7 +54,8 @@ class TieBreak(Exception):
|
|||
|
||||
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):
|
||||
|
|
Loading…
Reference in New Issue