ability to see out own video in the same time we send it and show both outging and incoming videos inside chat control

This commit is contained in:
Yann Leboulanger 2012-12-30 18:59:48 +01:00
parent 0c4f20145f
commit 3967658f30
5 changed files with 30 additions and 5 deletions

View File

@ -2192,10 +2192,27 @@ class ChatControl(ChatControlBase):
if widget.get_active(): if widget.get_active():
if getattr(self, jingle_type + '_state') == \ if getattr(self, jingle_type + '_state') == \
self.JINGLE_STATE_NULL: self.JINGLE_STATE_NULL:
sid = getattr(gajim.connections[self.account], if jingle_type == 'video':
video_hbox = self.xml.get_object('video_hbox')
video_hbox.set_no_show_all(False)
if gajim.config.get('video_see_self'):
fixed = self.xml.get_object('outgoing_fixed')
fixed.set_no_show_all(False)
video_hbox.show_all()
in_xid = self.xml.get_object('incoming_drawingarea').window.xid
out_xid = self.xml.get_object('outgoing_drawingarea').window.xid
sid = gajim.connections[self.account].start_video(
self.contact.get_full_jid(), in_xid, out_xid)
else:
sid = getattr(gajim.connections[self.account],
'start_' + jingle_type)(self.contact.get_full_jid()) 'start_' + jingle_type)(self.contact.get_full_jid())
getattr(self, 'set_' + jingle_type + '_state')('connecting', sid) getattr(self, 'set_' + jingle_type + '_state')('connecting', sid)
else: else:
video_hbox = self.xml.get_object('video_hbox')
video_hbox.set_no_show_all(True)
video_hbox.hide()
fixed = self.xml.get_object('outgoing_fixed')
fixed.set_no_show_all(True)
self.close_jingle_content(jingle_type) self.close_jingle_content(jingle_type)
img = getattr(self, '_' + jingle_type + '_button').get_property('image') img = getattr(self, '_' + jingle_type + '_button').get_property('image')

View File

@ -305,6 +305,7 @@ class Config:
'video_output_device': [opt_str, 'autovideosink'], 'video_output_device': [opt_str, 'autovideosink'],
'video_framerate': [opt_str, '', _('Optionally fix jingle output video framerate. Example: 10/1 or 25/2')], 'video_framerate': [opt_str, '', _('Optionally fix jingle output video framerate. Example: 10/1 or 25/2')],
'video_size': [opt_str, '', _('Optionally resize jingle output video. Example: 320x240')], 'video_size': [opt_str, '', _('Optionally resize jingle output video. Example: 320x240')],
'video_see_self': [opt_bool, True, _('If True, You will also see your webcam')],
'audio_input_volume': [opt_int, 50], 'audio_input_volume': [opt_int, 50],
'audio_output_volume': [opt_int, 50], 'audio_output_volume': [opt_int, 50],
'use_stun_server': [opt_bool, False, _('If True, Gajim will try to use a STUN server when using jingle. The one in "stun_server" option, or the one given by the jabber server.')], 'use_stun_server': [opt_bool, False, _('If True, Gajim will try to use a STUN server when using jingle. The one in "stun_server" option, or the one given by the jabber server.')],

View File

@ -120,16 +120,18 @@ class ConnectionJingle(object):
jingle.start_session() jingle.start_session()
return jingle.sid return jingle.sid
def start_video(self, jid): def start_video(self, jid, in_xid, out_xid):
if self.get_jingle_session(jid, media='video'): if self.get_jingle_session(jid, media='video'):
return self.get_jingle_session(jid, media='video').sid return self.get_jingle_session(jid, media='video').sid
jingle = self.get_jingle_session(jid, media='audio') jingle = self.get_jingle_session(jid, media='audio')
if jingle: if jingle:
jingle.add_content('video', JingleVideo(jingle)) jingle.add_content('video', JingleVideo(jingle, in_xid=in_xid,
out_xid=out_xid))
else: else:
jingle = JingleSession(self, weinitiate=True, jid=jid) jingle = JingleSession(self, weinitiate=True, jid=jid)
self._sessions[jingle.sid] = jingle self._sessions[jingle.sid] = jingle
jingle.add_content('video', JingleVideo(jingle)) jingle.add_content('video', JingleVideo(jingle, in_xid=in_xid,
out_xid=out_xid))
jingle.start_session() jingle.start_session()
return jingle.sid return jingle.sid

View File

@ -102,7 +102,7 @@ class VideoOutputManager(DeviceManager):
def detect(self): def detect(self):
self.devices = {} self.devices = {}
# Fake video output # Fake video output
self.detect_element('fakesink', _('Fake audio output')) self.detect_element('fakesink', _('Fake video output'))
# Auto sink # Auto sink
self.detect_element('xvimagesink', self.detect_element('xvimagesink',
_('X Window System (X11/XShm/Xv): %s')) _('X Window System (X11/XShm/Xv): %s'))

View File

@ -480,6 +480,8 @@ class PreferencesWindow:
'800x600': '800x600', '640x480': '640x480', '800x600': '800x600', '640x480': '640x480',
'320x240': '320x240'}, 'video_size', key=lambda x: -1 if \ '320x240': '320x240'}, 'video_size', key=lambda x: -1 if \
not x[1] else int(x[0][:3])) not x[1] else int(x[0][:3]))
st = gajim.config.get('video_see_self')
self.xml.get_object('video_see_self_checkbutton').set_active(st)
else: else:
for opt_name in ('audio_input', 'audio_output', 'video_input', for opt_name in ('audio_input', 'audio_output', 'video_input',
@ -1133,6 +1135,9 @@ class PreferencesWindow:
def on_video_size_combobox_changed(self, widget): def on_video_size_combobox_changed(self, widget):
self.on_av_combobox_changed(widget, 'video_size') self.on_av_combobox_changed(widget, 'video_size')
def on_video_see_self_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'video_see_self')
def on_stun_checkbutton_toggled(self, widget): def on_stun_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'use_stun_server', self.on_checkbutton_toggled(widget, 'use_stun_server',
[self.xml.get_object('stun_server_entry')]) [self.xml.get_object('stun_server_entry')])