<div dir="ltr">Thank you for your response.<div><br></div><div>I did a new code based on something find on internet but it still doesn't work.</div><div><br></div><div>The video doesn't display in the clutter window and I don't understand what is missing to work.</div>
<div><br></div><div>Here is the code :</div><div><br></div><div><div>from gi.repository import GObject</div><div>from gi.repository import Clutter</div><div>from gi.repository import ClutterGst</div><div>from gi.repository import Gst</div>
<div><br></div><div>class Video(object):</div><div> def __init__ (self, filename):</div><div> self.stage = Clutter.Stage()</div><div> self.stage.set_size(500, 300)</div><div> self.stage.set_color(Clutter.Color.new(0xaa, 0x11, 0xee, 0x00))</div>
<div> self.stage.set_title('GStreamer Clutter Python - ' + filename)</div><div> self.stage.connect('key-press-event', self.on_key_press_event)</div><div> self.stage.connect('destroy', self.on_destroy)</div>
<div> self.texture = Clutter.Texture.new()</div><div> </div><div> </div><div> </div><div> self.texture.connect('size-change', self.on_size_change)</div>
<div> self.sink = ClutterGst.VideoSink.new(self.texture)</div><div> self.sink.set_property('sync', True)</div><div> </div><div> self.pipeline = Gst.Pipeline()</div>
<div><br></div><div> self.src = Gst.ElementFactory.make("rtspsrc", "source")</div><div> self.src.set_property("location",'rtsp://<a href="http://192.168.2.11/axis-media/media.amp">192.168.2.11/axis-media/media.amp</a>')</div>
<div> self.src.set_property("latency",100)</div><div> </div><div> self.rtph264depay = Gst.ElementFactory.make("rtph264depay", None)</div><div> self.vaapidecode = Gst.ElementFactory.make("vaapidecode", None)</div>
<div><br></div><div> self.pipeline.add(self.src)</div><div> self.pipeline.add(self.rtph264depay)</div><div> self.pipeline.add(self.vaapidecode)</div><div> self.pipeline.add(self.sink)</div>
<div> </div><div> </div><div> self.src.connect("pad-added", self.on_pad)</div><div> </div><div> self.rtph264depay.link(self.vaapidecode)</div>
<div> self.vaapidecode.link(self.sink)</div><div> </div><div> self.bus = self.pipeline.get_bus()</div><div> self.bus.add_signal_watch()</div><div> self.bus.connect('message::eos', self.on_eos)</div>
<div> self.bus.connect('message::error', self.on_error)</div><div> </div><div> self.stage.add_actor(self.texture)</div><div> self.pipeline.set_state(Gst.State.PLAYING)</div>
<div><br></div><div> self.stage.show_all()</div><div> </div><div> def on_pad(self, rtspsrc, pad):</div><div> print ("on_pad")</div><div> depaySinkPad = self.rtph264depay.get_static_pad('sink')</div>
<div> pad.link(depaySinkPad)</div><div> print ("on_pad") </div><div><br></div><div><br></div><div> def on_size_change(self, texture, width, height):</div><div> print('on_size_change:')</div>
<div> stage = texture.get_stage()</div><div> if stage is not None:</div><div> dx, dy = stage.get_size()</div><div> texture.set_anchor_point(width/2, height/2)</div>
<div> texture.set_position(dx/2, dy/2)</div><div><br></div><div> def on_error(self, bus, msg):</div><div> print('on_error:', msg.parse_error())</div><div><br></div><div>
def on_eos(self, bus, msg):</div><div> print('on_eos:', msg)</div><div> self.pipeline.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0)</div><div> self.pipeline.set_state(Gst.State.PAUSED)</div>
<div><br></div><div> def on_destroy(self, stage, event):</div><div> print('on_destroy:', event)</div><div> self.pipeline.set_state(Gst.State.NULL)</div><div> Clutter.main_quit()</div>
<div><br></div><div> def on_key_press_event(self, stage, event):</div><div> print('on_key_press_event', event)</div><div> if event.unicode_value:</div><div> c = event.unicode_value</div>
<div> if c in 'qx':</div><div> self.on_destroy(stage, event)</div><div> print('quit')</div><div> elif c in 'pP':</div>
<div> self.pipeline.set_state(Gst.State.PAUSED)</div><div> print('pause')</div><div> elif c in 'gG':</div><div> self.pipeline.set_state(Gst.State.PLAYING)</div>
<div> print('play')</div><div> elif c in 'sS':</div><div> self.pipeline.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0)</div>
<div> self.pipeline.set_state(Gst.State.PAUSED)</div><div> print('stop')</div><div><br></div><div><br></div><div>if __name__ == '__main__':</div>
<div> from sys import argv</div><div> GObject.threads_init()</div><div> Gst.init(argv)</div><div> ClutterGst.init(argv)</div><div> Clutter.init(argv)</div><div> video = Video(*argv[1:])</div>
<div> Clutter.main()</div><div><br></div></div><div><br></div><div><br></div><div><br></div><div>Thank you</div></div><div class="gmail_extra"><br clear="all"><div>Erwan JEZEQUEL<div>Service Informatique</div><div>
<span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">079 946 02 91</span></div></div>
<br><br><div class="gmail_quote">2014-03-29 9:56 GMT+01:00 Sebastian Dröge <span dir="ltr"><<a href="mailto:sebastian@centricular.com" target="_blank">sebastian@centricular.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Fr, 2014-03-28 at 12:13 +0100, Jezequel, Erwan wrote:<br>
> Hello,<br>
><br>
> I am trying to play a rtsp stream in a Clutter window with the following<br>
> python code but it doesn't work. I think that gstreamer-vaapi works with<br>
> clutter-gst.<br>
><br>
> Is it supposed to work with gstreamer-vaapi? What should be the correct way<br>
> to do it?<br>
><br>
</div>> [code]<br>
<br>
You are never linking the rtspsrc with the depayloader in your code.<br>
You'll have to connect to the pad-added signal on rtspsrc and link it<br>
from there once the pad is added.<br>
<br>
If that doesn't work yet, please provide more information about how it<br>
fails and for example a GStreamer debug log.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Sebastian Dröge, Centricular Ltd - <a href="http://www.centricular.com" target="_blank">http://www.centricular.com</a><br>
Expertise, Straight from the Source<br>
</font></span><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br></div>