I am developing a muxer plugin,where I use the request_new_pad/release_pad from GstElementClass. But i never saw the release_pad callback function was called in my codes thought I did see the finalize(GObjectClass) was called in the end. I am not quite sure why release_pad was no called. Will it cause the memory leakage ?
The following are the request_new_pad and finalize functions.
Regards,
Yihe
/******************************************************************
* gst_tidmaireiszer_request_new_pad
* request a new pad
******************************************************************/
static GstPad *gst_tidmairesizer_request_new_pad(GstElement * element,
GstPadTemplate *templ,const gchar *req_name)
{
GstTIDmaiResizer *dmairesizer;
GstPad *newpad;
GstElementClass *klass = GST_ELEMENT_GET_CLASS(element);
gchar *name;
if(templ != gst_element_class_get_pad_template(klass,"decimage_%d"))
goto wrong_template;
dmairesizer = GST_TIDMAIRESIZER(element);
//create new pad
name = g_strdup_printf("decimage_%02d",dmairesizer->numpads);
newpad = gst_pad_new_from_template(templ,name);
g_free(name);
GstResizerPad *resizerpad;
if(dmairesizer->numpads >= MAX_INPUT_SUPPORT)
{
GST_ERROR("Over the max input hardware can support\n");
gst_object_unref(newpad);
return NULL;
}
resizerpad = (GstResizerPad *) gst_collect_pads_add_pad(dmairesizer->collect,newpad,sizeof(GstResizerPad));
resizerpad->x_start = dmairesizer->x_start[dmairesizer->numpads];
resizerpad->y_start = dmairesizer->y_start[dmairesizer->numpads];
resizerpad->rsFormat = dmairesizer->rsFormat[dmairesizer->numpads];
//save a pointer to our data in the pad
// gst_pad_set_element_private(newpad,resizerpad);
dmairesizer->numpads++;
GST_LOG("request new pad %d\n",dmairesizer->numpads);
//set sink pad caps
gst_pad_set_setcaps_function (newpad,GST_DEBUG_FUNCPTR (gst_tidmairesizer_set_sink_caps));
//add pad to element
gst_element_add_pad(element,newpad);
return newpad;
wrong_template:
{
GST_ERROR("this is not our template pad!\n");
return NULL;
}
}
static void gst_tidmairesizer_finalize(GObject *object)
{
GstTIDmaiResizer *dmairesizer = GST_TIDMAIRESIZER(object);
GST_LOG("finalizer being\n");
//clean up everything
gst_tidmairesizer_exit_video(dmairesizer);
GST_LOG("finalizer begin\n");
if(dmairesizer->collect)
{
gst_object_unref(dmairesizer->collect);
dmairesizer->collect=NULL;
}
G_OBJECT_CLASS(parent_class)->finalize(object);
GST_LOG("finalizer Finish\n");
}
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel