fix a few things for jingle video

This commit is contained in:
Yann Leboulanger 2015-12-23 22:40:53 +01:00
parent 33381fcae5
commit dcef0455c8
5 changed files with 24 additions and 16 deletions

View file

@ -2270,6 +2270,7 @@ $T will be replaced by auto-not-available timeout</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="on_video_see_self_checkbutton_toggled" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>

View file

@ -194,6 +194,8 @@ try:
from gi.repository import Farstream from gi.repository import Farstream
gi.require_version('Gst', '1.0') gi.require_version('Gst', '1.0')
from gi.repository import Gst from gi.repository import Gst
from gi.repository import GdkX11
from gi.repository import GstVideo
from gi.repository import GLib from gi.repository import GLib
try: try:
Gst.init(None) Gst.init(None)

View file

@ -27,6 +27,8 @@ from gi.repository import Farstream
import gi import gi
gi.require_version('Gst', '1.0') gi.require_version('Gst', '1.0')
from gi.repository import Gst from gi.repository import Gst
from gi.repository import GdkX11
from gi.repository import GstVideo
from gi.repository import GLib from gi.repository import GLib
from common import gajim from common import gajim
@ -234,7 +236,7 @@ class JingleRTPContent(JingleContent):
# Add fallback source # Add fallback source
self.src_bin = self.get_fallback_src() self.src_bin = self.get_fallback_src()
self.pipeline.add(self.src_bin) self.pipeline.add(self.src_bin)
self.src_bin.get_static_pad('src').link(sink_pad) self.src_bin.link(sink_pad)
self.stream_failed_once = True self.stream_failed_once = True
else: else:
reason = nbxmpp.Node('reason') reason = nbxmpp.Node('reason')
@ -386,6 +388,7 @@ class JingleVideo(JingleRTPContent):
# sometimes it'll freeze... # sometimes it'll freeze...
JingleRTPContent.setup_stream(self, self._on_src_pad_added) JingleRTPContent.setup_stream(self, self._on_src_pad_added)
bus = self.pipeline.get_bus() bus = self.pipeline.get_bus()
bus.enable_sync_message_emission()
bus.connect('sync-message::element', self._on_sync_message) bus.connect('sync-message::element', self._on_sync_message)
# the local parts # the local parts
@ -413,16 +416,14 @@ class JingleVideo(JingleRTPContent):
self.src_bin = self.make_bin_from_config('video_input_device', self.src_bin = self.make_bin_from_config('video_input_device',
'%%s %s! %svideoscale ! %svideoconvert' % (tee, framerate, '%%s %s! %svideoscale ! %svideoconvert' % (tee, framerate,
video_size), _("video input")) video_size), _("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(self.src_bin)#, caps) self.pipeline.add(self.src_bin)
self.pipeline.set_state(Gst.State.PLAYING) self.pipeline.set_state(Gst.State.PLAYING)
#src_bin.link(caps)
self.sink = self.make_bin_from_config('video_output_device', self.sink = self.make_bin_from_config('video_output_device',
'videoscale ! videoconvert ! %s', 'videoscale ! videoconvert ! %s',
_("video output")) _("video output"))
self.pipeline.add(self.sink) self.pipeline.add(self.sink)
self.src_bin.get_static_pad('src').link(self.p2psession.get_property( self.src_bin.get_static_pad('src').link(self.p2psession.get_property(
@ -432,16 +433,16 @@ class JingleVideo(JingleRTPContent):
self.pipeline.set_state(Gst.State.PLAYING) self.pipeline.set_state(Gst.State.PLAYING)
def _on_sync_message(self, bus, message): def _on_sync_message(self, bus, message):
if message.structure is None: if message.get_structure() is None:
return False return False
if message.structure.get_name() == 'prepare-xwindow-id': if message.get_structure().get_name() == 'prepare-window-handle':
message.src.set_property('force-aspect-ratio', True) message.src.set_property('force-aspect-ratio', True)
imagesink = message.src imagesink = message.src
if gajim.config.get('video_see_self') and not self.out_xid_set: if gajim.config.get('video_see_self') and not self.out_xid_set:
imagesink.set_xwindow_id(self.out_xid) imagesink.set_window_handle(self.out_xid)
self.out_xid_set = True self.out_xid_set = True
else: else:
imagesink.set_xwindow_id(self.in_xid) imagesink.set_window_handle(self.in_xid)
def get_fallback_src(self): def get_fallback_src(self):
# TODO: Use avatar? # TODO: Use avatar?

View file

@ -14,6 +14,8 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>. ## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gst from gi.repository import Gst
from gi.repository import GdkX11
from gi.repository import GstVideo
class DeviceManager(object): class DeviceManager(object):
@ -85,7 +87,7 @@ class VideoInputManager(DeviceManager):
self.devices = {} self.devices = {}
# Test src # Test src
self.detect_element('videotestsrc', _('Video test'), self.detect_element('videotestsrc', _('Video test'),
'%s is-live=true ! video/x-raw-yuv,framerate=10/1') '%s is-live=true ! video/x-raw,framerate=10/1')
# Auto src # Auto src
self.detect_element('autovideosrc', _('Autodetect')) self.detect_element('autovideosrc', _('Autodetect'))
# V4L2 src # V4L2 src

View file

@ -5393,33 +5393,35 @@ class VoIPCallReceivedDialog(object):
fixed = ctrl.xml.get_object('outgoing_fixed') fixed = ctrl.xml.get_object('outgoing_fixed')
fixed.set_no_show_all(False) fixed.set_no_show_all(False)
video_hbox.show_all() video_hbox.show_all()
ctrl.xml.get_object('incoming_drawingarea').realize()
if os.name == 'nt': if os.name == 'nt':
in_xid = ctrl.xml.get_object('incoming_drawingarea').\ in_xid = ctrl.xml.get_object('incoming_drawingarea').\
get_window().handle get_window().handle
else: else:
in_xid = ctrl.xml.get_object('incoming_drawingarea').\ in_xid = ctrl.xml.get_object('incoming_drawingarea').\
get_window().xid get_property('window').get_xid()
content = session.get_content('video') content = session.get_content('video')
# move outgoing stream to chat window # move outgoing stream to chat window
if gajim.config.get('video_see_self'): if gajim.config.get('video_see_self'):
ctrl.xml.get_object('outgoing_drawingarea').realize()
if os.name == 'nt': if os.name == 'nt':
out_xid = ctrl.xml.get_object('outgoing_drawingarea').\ out_xid = ctrl.xml.get_object('outgoing_drawingarea').\
get_window().handle get_window().handle
else: else:
out_xid = ctrl.xml.get_object('outgoing_drawingarea').\ out_xid = ctrl.xml.get_object('outgoing_drawingarea').\
get_window().xid get_property('window').get_xid()
b = content.src_bin b = content.src_bin
found = False found = False
for e in b.elements(): for e in b.children:
if e.get_name().startswith('autovideosink'): if e.get_name().startswith('autovideosink'):
found = True found = True
break break
if found: if found:
found = False for f in e.children:
for f in e.elements():
if f.get_name().startswith('autovideosink'): if f.get_name().startswith('autovideosink'):
f.set_xwindow_id(out_xid) f.set_window_handle(out_xid)
content.out_xid = out_xid content.out_xid = out_xid
break
content.in_xid = in_xid content.in_xid = in_xid
ctrl.set_video_state('connecting', self.sid) ctrl.set_video_state('connecting', self.sid)
# Now, accept the content/sessions. # Now, accept the content/sessions.