Hi,
what are the buffers that i can free up using finalize function. can i free the pads that i have created and added to the element in init() function. If not who will take care of freeing those pads. I have dummy finalize function implementation. i have assigned the finalize function pointer to GObjectClass in init() function. this function is never called at runtime. Am i missing anything here. Thank you, Chandrakala |
On 11/28/2011 05:39 AM, chandu wrote:
> Hi, > > what are the buffers that i can free up using finalize function. can i free > the pads that i have created and added to the element in init() function. If > not who will take care of freeing those pads. > > I have dummy finalize function implementation. i have assigned the finalize > function pointer to GObjectClass in init() function. this function is never > called at runtime. Am i missing anything here. Are you writing an own element. If you can provide a link to the code your question might become clearer. You don't need to release buffers, pads or even pad-templates in your finalize function. Stefan > Thank you, > Chandrakala > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/buffers-to-unref-in-finalize-function-tp4114177p4114177.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi Stefan,
I have my own plugin as follows. /**************** code starts ********************/ static void gst_plugin_template_class_init (GstPluginTemplateClass * klass) { g_print("INC : in the gst_plugin_template_class_init \n"); GObjectClass *gobject_class; GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gobject_class->dispose = gst_plugin_template_dispose; gobject_class->finalize = gst_plugin_template_finalize; } static void gst_plugin_template_init (GstPluginTemplate * filter, GstPluginTemplateClass * gclass) { code[..] filter->adapter = gst_adapter_new(); //create adaptor g_object_ref(filter->adapter); } static void gst_plugin_template_finalize(GObject * object) { g_print("INC : in finalize....\n"); GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE(object); filter->adapter = NULL; g_print("INC : Reset all buffers\n"); } static void gst_plugin_template_dispose(GObject * object) { g_print("INC : in the dispose.....\n"); GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE(object); gst_adapter_clear(filter->adapter); g_object_unref(filter->adapter); g_object_unref(filter); } static GstFlowReturn gst_plugin_template_chain (GstPad * pad, GstBuffer * buf) { g_print("INC : in the gst_plugin_template_chain\n"); GstPluginTemplate *filter; GstFlowReturn ret=GST_FLOW_OK; filter = GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT (pad)); if (filter->silent == FALSE) { g_print ("INC: I'm plugged, therefore I'm in (chain)\n"); } ret = gst_pad_push(filter->srcpad,buf); if(ret != GST_FLOW_OK) g_print("INC : buffer push Failed......\n"); return ret; } /*****************code ends here ***************/ I have allocated memory to adapter in gst_plugin_template_init function. freed the same using dispose and finalize functions. My problem is, these 2 functions are never called. how can i ensure that the memory given to adapter is freed. regards, Chandrakala |
On 11/29/2011 09:02 AM, chandu wrote:
> Hi Stefan, > > I have my own plugin as follows. > > /**************** code starts ********************/ > static void gst_plugin_template_class_init (GstPluginTemplateClass * klass) > { > > g_print("INC : in the gst_plugin_template_class_init \n"); > > GObjectClass *gobject_class; > GstElementClass *gstelement_class; > > gobject_class = (GObjectClass *) klass; > gstelement_class = (GstElementClass *) klass; > gobject_class->dispose = gst_plugin_template_dispose; > gobject_class->finalize = gst_plugin_template_finalize; > } > > static void gst_plugin_template_init (GstPluginTemplate * filter, > GstPluginTemplateClass * gclass) > { > > code[..] > > filter->adapter = gst_adapter_new(); //create adaptor > g_object_ref(filter->adapter); > } > > static void gst_plugin_template_finalize(GObject * object) > { > g_print("INC : in finalize....\n"); > GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE(object); > > filter->adapter = NULL; > g_print("INC : Reset all buffers\n"); here you need to chain up to the super class. > } > > static void gst_plugin_template_dispose(GObject * object) > { > g_print("INC : in the dispose.....\n"); > GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE(object); > gst_adapter_clear(filter->adapter); > g_object_unref(filter->adapter); > g_object_unref(filter); don't unref the filter. and also chainup here. Stefan > } > static GstFlowReturn gst_plugin_template_chain (GstPad * pad, GstBuffer * > buf) > { > g_print("INC : in the gst_plugin_template_chain\n"); > GstPluginTemplate *filter; > GstFlowReturn ret=GST_FLOW_OK; > filter = GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT (pad)); > if (filter->silent == FALSE) > { > g_print ("INC: I'm plugged, therefore I'm in (chain)\n"); > } > ret = gst_pad_push(filter->srcpad,buf); > if(ret != GST_FLOW_OK) g_print("INC : buffer push Failed......\n"); > > return ret; > } > /*****************code ends here ***************/ > > I have allocated memory to adapter in gst_plugin_template_init function. > freed the same using dispose and finalize functions. My problem is, these 2 > functions are never called. how can i ensure that the memory given to > adapter is freed. > > regards, > Chandrakala > > > > > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/buffers-to-unref-in-finalize-function-tp4114177p4118339.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |