mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
Release OpenCV images when finalizing elements
This commit is contained in:
parent
046ca445b8
commit
4b9ae0088b
3 changed files with 54 additions and 4 deletions
|
@ -114,8 +114,24 @@ static void gst_edgedetect_get_property (GObject * object, guint prop_id,
|
|||
static gboolean gst_edgedetect_set_caps (GstPad * pad, GstCaps * caps);
|
||||
static GstFlowReturn gst_edgedetect_chain (GstPad * pad, GstBuffer * buf);
|
||||
|
||||
/* GObject vmethod implementations */
|
||||
/* Clean up */
|
||||
static void
|
||||
gst_edgedetect_finalize (GObject * obj)
|
||||
{
|
||||
Gstedgedetect *filter = GST_EDGEDETECT (obj);
|
||||
|
||||
if (filter->cvImage != NULL)
|
||||
{
|
||||
cvReleaseImage (&filter->cvImage);
|
||||
cvReleaseImage (&filter->cvCEdge);
|
||||
cvReleaseImage (&filter->cvGray);
|
||||
cvReleaseImage (&filter->cvEdge);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
/* GObject vmethod implementations */
|
||||
static void
|
||||
gst_edgedetect_base_init (gpointer gclass)
|
||||
{
|
||||
|
@ -142,7 +158,9 @@ gst_edgedetect_class_init (GstedgedetectClass * klass)
|
|||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_edgedetect_finalize);
|
||||
gobject_class->set_property = gst_edgedetect_set_property;
|
||||
gobject_class->get_property = gst_edgedetect_get_property;
|
||||
|
||||
|
@ -294,7 +312,6 @@ gst_edgedetect_chain (GstPad * pad, GstBuffer * buf)
|
|||
return gst_pad_push (filter->srcpad, buf);
|
||||
}
|
||||
|
||||
|
||||
/* entry point to initialize the plug-in
|
||||
* initialize the plug-in itself
|
||||
* register the element factories and other features
|
||||
|
|
|
@ -114,8 +114,23 @@ static GstFlowReturn gst_facedetect_chain (GstPad * pad, GstBuffer * buf);
|
|||
|
||||
static void gst_facedetect_load_profile (GObject * object);
|
||||
|
||||
/* GObject vmethod implementations */
|
||||
/* Clean up */
|
||||
static void
|
||||
gst_facedetect_finalize (GObject * obj)
|
||||
{
|
||||
Gstfacedetect *filter = GST_FACEDETECT(obj);
|
||||
|
||||
if (filter->cvImage)
|
||||
{
|
||||
cvReleaseImage (&filter->cvImage);
|
||||
cvReleaseImage (&filter->cvGray);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
|
||||
/* GObject vmethod implementations */
|
||||
static void
|
||||
gst_facedetect_base_init (gpointer gclass)
|
||||
{
|
||||
|
@ -142,7 +157,9 @@ gst_facedetect_class_init (GstfacedetectClass * klass)
|
|||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_facedetect_finalize);
|
||||
gobject_class->set_property = gst_facedetect_set_property;
|
||||
gobject_class->get_property = gst_facedetect_get_property;
|
||||
|
||||
|
|
|
@ -112,8 +112,22 @@ static void gst_pyramidsegment_get_property (GObject * object, guint prop_id,
|
|||
static gboolean gst_pyramidsegment_set_caps (GstPad * pad, GstCaps * caps);
|
||||
static GstFlowReturn gst_pyramidsegment_chain (GstPad * pad, GstBuffer * buf);
|
||||
|
||||
/* GObject vmethod implementations */
|
||||
/* Clean up */
|
||||
static void
|
||||
gst_pyramidsegment_finalize (GObject * obj)
|
||||
{
|
||||
Gstpyramidsegment *filter = GST_PYRAMIDSEGMENT(obj);
|
||||
|
||||
if (filter->cvImage != NULL)
|
||||
{
|
||||
cvReleaseImage (&filter->cvImage);
|
||||
cvReleaseImage (&filter->cvSegmentedImage);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
/* GObject vmethod implementations */
|
||||
static void
|
||||
gst_pyramidsegment_base_init (gpointer gclass)
|
||||
{
|
||||
|
@ -140,7 +154,9 @@ gst_pyramidsegment_class_init (GstpyramidsegmentClass * klass)
|
|||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_pyramidsegment_finalize);
|
||||
gobject_class->set_property = gst_pyramidsegment_set_property;
|
||||
gobject_class->get_property = gst_pyramidsegment_get_property;
|
||||
|
||||
|
|
Loading…
Reference in a new issue