I'm building an element that uses an external lib, and when my element is freed (it ref count reaches zero), i want to free some stuff of the external lib i use. I didn't find anything about a generic destructor function that i can override, so when my element is being freed i can free the resources that i was using on my plugin. Can anyone help me?
best regards, Katcipis ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Looking at the GstAppSink code i found that i actually have to override the finalize function on the GObject class. Sorry to bother, I'm not very used with Gobject :-).
The GstAppSink code (on the class init function): GObjectClass *gobject_class = (GObjectClass *) klass; GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass; gobject_class->dispose = gst_app_sink_dispose; gobject_class->finalize = gst_app_sink_finalize; On Thu, Oct 29, 2009 at 11:59 AM, Tiago Katcipis <[hidden email]> wrote: I'm building an element that uses an external lib, and when my element is freed (it ref count reaches zero), i want to free some stuff of the external lib i use. I didn't find anything about a generic destructor function that i can override, so when my element is being freed i can free the resources that i was using on my plugin. Can anyone help me? ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Tiago Katcipis
Tiago Katcipis wrote:
> I'm building an element that uses an external lib, and when my element is > freed (it ref count reaches zero), i want to free some stuff of the external > lib i use. I didn't find anything about a generic destructor function that i > can override, so when my element is being freed i can free the resources > that i was using on my plugin. Can anyone help me? > > best regards, > Katcipis > > void gst_my_element_class_init (GstMyElementClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ... gobject_class->finalize = gst_my_element_finalize; ... } void gst_my_element_finalize (GObject * object) { /* Free your stuff here */ } ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Tiago Katcipis
Tiago Katcipis schrieb:
> Looking at the GstAppSink code i found that i actually have to override > the finalize function on the GObject class. Sorry to bother, I'm not > very used with Gobject :-). > > The GstAppSink code (on the class init function): > > GObjectClass *gobject_class = (GObjectClass *) klass; > GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass; > > gobject_class->dispose = gst_app_sink_dispose; > gobject_class->finalize = gst_app_sink_finalize; > just for your info, dispose can theortically be called multiple times and finalize is called just once. The idea is to call unref in dispose, set object s to NULL and check that incase its called again. Do free()s in finalize Stefan > > > On Thu, Oct 29, 2009 at 11:59 AM, Tiago Katcipis <[hidden email] > <mailto:[hidden email]>> wrote: > > I'm building an element that uses an external lib, and when my > element is freed (it ref count reaches zero), i want to free some > stuff of the external lib i use. I didn't find anything about a > generic destructor function that i can override, so when my element > is being freed i can free the resources that i was using on my > plugin. Can anyone help me? > > best regards, > Katcipis > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > > > ------------------------------------------------------------------------ > > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Thu, Oct 29, 2009 at 4:39 PM, Stefan Kost <[hidden email]> wrote: Tiago Katcipis schrieb: Thanks for the help Stefan, sorry to bother you guys with such an simple question. Best regards, Katcipis
-- "Se você se perder na selva africana, não precisa se desesperar. Basta sentar em uma pedra e começar a instalar GNU/Linux em seu laptop. Em menos de 5 minutos aparecerá alguém pra discordar de sua escolha de distribuição, do particionamento, do gerenciador de janelas, do ambiente de desktop, do editor de textos..." ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |