Hi guys,
I try to use python develop gstreamer. I wrote the simple code as below, but it's a question about reference count couldn't decrease, have someone give me some suggestions? Thank you very much, Stephen gi.require_version('Gst', '1.0') import sys from gi.repository import Gst, GObject, GLib GObject.threads_init() Gst.init(None) pipe = Gst.Pipeline.new("test") src = Gst.ElementFactory.make("filesrc", "src") demux = Gst.ElementFactory.make("matroskademux", "demux") decodebin = Gst.ElementFactory.make("vaapih264dec", "decode") parse = Gst.ElementFactory.make("h264parse", "parse") videoscale = Gst.ElementFactory.make("videoscale", "scale") videorate = Gst.ElementFactory.make("videorate", "videorate") capsfilter = Gst.ElementFactory.make("capsfilter", "capsfilter") queue = Gst.ElementFactory.make("queue", "queue") videoconvert = Gst.ElementFactory.make("vaapipostproc", "videoconvert") videosink = Gst.ElementFactory.make("ximagesink", "videosink") elements = [src, demux, queue, parse, decodebin, videoscale, videorate, capsfilter, videoconvert, videosink] caps = Gst.Caps.from_string("video/x-raw, width=640, height=480, framerate=10/1") capsfilter.set_property("caps", caps) src.set_property("location", "1080p.mkv") demux.connect("pad-added", gst.gst_dvr.cb_demuxer_newpad, queue) for element in elements: print(element) pipe.add(element) src.link(demux) queue.link(parse) parse.link(decodebin) decodebin.link(videoscale) videoscale.link(videorate) videorate.link(capsfilter) capsfilter.link(videoconvert) videoconvert.link(videosink) pipe.set_state(Gst.State.PLAYING) print(sys.getrefcount(pipe)) pipe= None print(sys.getrefcount(pipe)) mainloop = GObject.MainLoop() mainloop.run() -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
The second call to sys.getrefcount() will give you the ref count of None. Should be pretty high. I get 2648 in a test program. Le Vendredi 9 mars 2018 10h48, Stephenwei <[hidden email]> a écrit : Hi guys, I try to use python develop gstreamer. I wrote the simple code as below, but it's a question about reference count couldn't decrease, have someone give me some suggestions? Thank you very much, Stephen gi.require_version('Gst', '1.0') import sys from gi.repository import Gst, GObject, GLib GObject.threads_init() Gst.init(None) pipe = Gst.Pipeline.new("test") src = Gst.ElementFactory.make("filesrc", "src") demux = Gst.ElementFactory.make("matroskademux", "demux") decodebin = Gst.ElementFactory.make("vaapih264dec", "decode") parse = Gst.ElementFactory.make("h264parse", "parse") videoscale = Gst.ElementFactory.make("videoscale", "scale") videorate = Gst.ElementFactory.make("videorate", "videorate") capsfilter = Gst.ElementFactory.make("capsfilter", "capsfilter") queue = Gst.ElementFactory.make("queue", "queue") videoconvert = Gst.ElementFactory.make("vaapipostproc", "videoconvert") videosink = Gst.ElementFactory.make("ximagesink", "videosink") elements = [src, demux, queue, parse, decodebin, videoscale, videorate, capsfilter, videoconvert, videosink] caps = Gst.Caps.from_string("video/x-raw, width=640, height=480, framerate=10/1") capsfilter.set_property("caps", caps) src.set_property("location", "1080p.mkv") demux.connect("pad-added", gst.gst_dvr.cb_demuxer_newpad, queue) for element in elements: print(element) pipe.add(element) src.link(demux) queue.link(parse) parse.link(decodebin) decodebin.link(videoscale) videoscale.link(videorate) videorate.link(capsfilter) capsfilter.link(videoconvert) videoconvert.link(videosink) pipe.set_state(Gst.State.PLAYING) print(sys.getrefcount(pipe)) pipe= None print(sys.getrefcount(pipe)) mainloop = GObject.MainLoop() mainloop.run() -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi Filnet,
Thanks for your replay. According this simple. I wrote a function to use this pipe as well as start and close pipe. the second reference count still response None. But the thread will be increase after start pipe. Regards, Stephen -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Update information !!!
I execute the program and monitor by htop as well as found out the gldisplay-event thread was increasing each time. would someonw tell me how to close this thread? Thanks, Stephen -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |