<html><head></head><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:13px"><div id="yiv8921442720"><div id="yui_3_16_0_ym19_1_1520606360335_64144"><div style="color:#000;background-color:#fff;font-family:lucida console, sans-serif;font-size:13px;" id="yui_3_16_0_ym19_1_1520606360335_64143"><div><span></span></div> <div class="yiv8921442720qtdSeparateBR" id="yui_3_16_0_ym19_1_1520606360335_64142"><br clear="none"><div>The second call to sys.getrefcount() will give you the ref count of None.</div><div id="yui_3_16_0_ym19_1_1520606360335_64216">Should be pretty high. I get 2648 in a test program.<br></div></div><div class="yiv8921442720yqt3163169168" id="yiv8921442720yqt88046"></div></div></div></div><div class=".yiv8921442720yahoo_quoted"> <div style="font-family:lucida console, sans-serif;font-size:13px;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr"><font face="Arial" size="2"> Le Vendredi 9 mars 2018 10h48, Stephenwei <lofy.stephen@gmail.com> a écrit :<br clear="none"></font></div> <br clear="none"><br clear="none"> <div class="yiv8921442720y_msg_container"><div dir="ltr">Hi guys,<br clear="none"></div><div dir="ltr">I try to use python develop gstreamer. I wrote the simple code as below, but<br clear="none"></div><div dir="ltr">it's a question about reference count couldn't decrease, have someone give<br clear="none"></div><div dir="ltr">me some suggestions?<br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">Thank you very much,<br clear="none"></div><div dir="ltr">Stephen<br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">gi.require_version('Gst', '1.0')<br clear="none"></div><div dir="ltr">import sys<br clear="none"></div><div dir="ltr">from gi.repository import Gst, GObject, GLib<br clear="none"></div><div dir="ltr">GObject.threads_init()<br clear="none"></div><div dir="ltr">Gst.init(None)<br clear="none"></div><div dir="ltr">pipe = Gst.Pipeline.new("test")<br clear="none"></div><div dir="ltr">src = Gst.ElementFactory.make("filesrc", "src")<br clear="none"></div><div dir="ltr">demux = Gst.ElementFactory.make("matroskademux", "demux")<br clear="none"></div><div dir="ltr">decodebin = Gst.ElementFactory.make("vaapih264dec", "decode")<br clear="none"></div><div dir="ltr">parse = Gst.ElementFactory.make("h264parse", "parse")<br clear="none"></div><div dir="ltr">videoscale = Gst.ElementFactory.make("videoscale", "scale")<br clear="none"></div><div dir="ltr">videorate = Gst.ElementFactory.make("videorate", "videorate")<br clear="none"></div><div dir="ltr">capsfilter = Gst.ElementFactory.make("capsfilter", "capsfilter")<br clear="none"></div><div dir="ltr">queue = Gst.ElementFactory.make("queue", "queue")<br clear="none"></div><div dir="ltr">videoconvert = Gst.ElementFactory.make("vaapipostproc", "videoconvert")<br clear="none"></div><div dir="ltr">videosink = Gst.ElementFactory.make("ximagesink", "videosink")<br clear="none"></div><div dir="ltr">elements = [src, demux, queue, parse, decodebin, videoscale, videorate,<br clear="none"></div><div dir="ltr">capsfilter, videoconvert, videosink]<br clear="none"></div><div dir="ltr">caps = Gst.Caps.from_string("video/x-raw, width=640, height=480,<br clear="none"></div><div dir="ltr">framerate=10/1")<br clear="none"></div><div dir="ltr">capsfilter.set_property("caps", caps)<br clear="none"></div><div dir="ltr">src.set_property("location", "1080p.mkv")<br clear="none"></div><div dir="ltr">demux.connect("pad-added", gst.gst_dvr.cb_demuxer_newpad, queue)<br clear="none"></div><div dir="ltr">for element in elements:<br clear="none"></div><div dir="ltr"> print(element)<br clear="none"></div><div dir="ltr"> pipe.add(element)<br clear="none"></div><div dir="ltr">src.link(demux)<br clear="none"></div><div dir="ltr">queue.link(parse)<br clear="none"></div><div dir="ltr">parse.link(decodebin)<br clear="none"></div><div dir="ltr">decodebin.link(videoscale)<br clear="none"></div><div dir="ltr">videoscale.link(videorate)<br clear="none"></div><div dir="ltr">videorate.link(capsfilter)<br clear="none"></div><div dir="ltr">capsfilter.link(videoconvert)<br clear="none"></div><div dir="ltr">videoconvert.link(videosink)<br clear="none"></div><div dir="ltr">pipe.set_state(Gst.State.PLAYING)<br clear="none"></div><div dir="ltr">print(sys.getrefcount(pipe))<br clear="none"></div><div dir="ltr">pipe= None<br clear="none"></div><div dir="ltr">print(sys.getrefcount(pipe))<br clear="none"></div><div dir="ltr">mainloop = GObject.MainLoop()<br clear="none"></div><div dir="ltr">mainloop.run()<br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">--<br clear="none"></div><div dir="ltr">Sent from: <a rel="nofollow" shape="rect" target="_blank" href="http://gstreamer-devel.966125.n4.nabble.com/">http://gstreamer-devel.966125.n4.nabble.com/</a><br clear="none"></div><div dir="ltr">_______________________________________________<br clear="none"></div><div dir="ltr">gstreamer-devel mailing list<br clear="none"></div><div dir="ltr"><a rel="nofollow" shape="rect" ymailto="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br clear="none"></div><div dir="ltr"><a rel="nofollow" shape="rect" target="_blank" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br clear="none"></div><br clear="none"><br clear="none"></div> </div> </div> </div></div></body></html>