Commit dcef0455 authored by Yann Leboulanger's avatar Yann Leboulanger

fix a few things for jingle video

parent 33381fca
......@@ -2270,6 +2270,7 @@ $T will be replaced by auto-not-available timeout</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_video_see_self_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
......
......@@ -194,6 +194,8 @@ try:
from gi.repository import Farstream
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gi.repository import GdkX11
from gi.repository import GstVideo
from gi.repository import GLib
try:
Gst.init(None)
......
......@@ -27,6 +27,8 @@ from gi.repository import Farstream
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gi.repository import GdkX11
from gi.repository import GstVideo
from gi.repository import GLib
from common import gajim
......@@ -234,7 +236,7 @@ class JingleRTPContent(JingleContent):
# Add fallback source
self.src_bin = self.get_fallback_src()
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
else:
reason = nbxmpp.Node('reason')
......@@ -386,6 +388,7 @@ class JingleVideo(JingleRTPContent):
# sometimes it'll freeze...
JingleRTPContent.setup_stream(self, self._on_src_pad_added)
bus = self.pipeline.get_bus()
bus.enable_sync_message_emission()
bus.connect('sync-message::element', self._on_sync_message)
# the local parts
......@@ -413,16 +416,14 @@ class JingleVideo(JingleRTPContent):
self.src_bin = self.make_bin_from_config('video_input_device',
'%%s %s! %svideoscale ! %svideoconvert' % (tee, framerate,
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)
#src_bin.link(caps)
self.sink = self.make_bin_from_config('video_output_device',
'videoscale ! videoconvert ! %s',
_("video output"))
self.pipeline.add(self.sink)
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)
def _on_sync_message(self, bus, message):
if message.structure is None:
if message.get_structure() is None:
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)
imagesink = message.src
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
else:
imagesink.set_xwindow_id(self.in_xid)
imagesink.set_window_handle(self.in_xid)
def get_fallback_src(self):
# TODO: Use avatar?
......
......@@ -14,6 +14,8 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gst
from gi.repository import GdkX11
from gi.repository import GstVideo
class DeviceManager(object):
......@@ -85,7 +87,7 @@ class VideoInputManager(DeviceManager):
self.devices = {}
# Test src
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
self.detect_element('autovideosrc', _('Autodetect'))
# V4L2 src
......
......@@ -5393,33 +5393,35 @@ class VoIPCallReceivedDialog(object):
fixed = ctrl.xml.get_object('outgoing_fixed')
fixed.set_no_show_all(False)
video_hbox.show_all()
ctrl.xml.get_object('incoming_drawingarea').realize()
if os.name == 'nt':
in_xid = ctrl.xml.get_object('incoming_drawingarea').\
get_window().handle
else:
in_xid = ctrl.xml.get_object('incoming_drawingarea').\
get_window().xid
get_property('window').get_xid()
content = session.get_content('video')
# move outgoing stream to chat window
if gajim.config.get('video_see_self'):
ctrl.xml.get_object('outgoing_drawingarea').realize()
if os.name == 'nt':
out_xid = ctrl.xml.get_object('outgoing_drawingarea').\
get_window().handle
else:
out_xid = ctrl.xml.get_object('outgoing_drawingarea').\
get_window().xid
get_property('window').get_xid()
b = content.src_bin
found = False
for e in b.elements():
for e in b.children:
if e.get_name().startswith('autovideosink'):
found = True
break
if found:
found = False
for f in e.elements():
for f in e.children:
if f.get_name().startswith('autovideosink'):
f.set_xwindow_id(out_xid)
f.set_window_handle(out_xid)
content.out_xid = out_xid
break
content.in_xid = in_xid
ctrl.set_video_state('connecting', self.sid)
# Now, accept the content/sessions.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment