How to decrease reference count of python??

Stephenwei lofy.stephen at gmail.com
Fri Mar 9 09:35:59 UTC 2018


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/


More information about the gstreamer-devel mailing list