mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
camerabin2: imagecapturebin: release objects and memory allocations
This commit is contained in:
parent
59c48d3443
commit
7409211055
1 changed files with 29 additions and 3 deletions
|
@ -67,6 +67,10 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_BOILERPLATE (GstImageCaptureBin, gst_image_capture_bin, GstBin,
|
GST_BOILERPLATE (GstImageCaptureBin, gst_image_capture_bin, GstBin,
|
||||||
GST_TYPE_BIN);
|
GST_TYPE_BIN);
|
||||||
|
|
||||||
|
/* GObject callbacks */
|
||||||
|
static void gst_image_capture_bin_dispose (GObject * object);
|
||||||
|
static void gst_image_capture_bin_finalize (GObject * object);
|
||||||
|
|
||||||
/* Element class functions */
|
/* Element class functions */
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_image_capture_bin_change_state (GstElement * element, GstStateChange trans);
|
gst_image_capture_bin_change_state (GstElement * element, GstStateChange trans);
|
||||||
|
@ -113,6 +117,7 @@ gst_image_capture_bin_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
g_free (imagebin->location);
|
g_free (imagebin->location);
|
||||||
imagebin->location = g_value_dup_string (value);
|
imagebin->location = g_value_dup_string (value);
|
||||||
|
|
||||||
if (imagebin->sink) {
|
if (imagebin->sink) {
|
||||||
g_object_set (imagebin, "location", imagebin->location, NULL);
|
g_object_set (imagebin, "location", imagebin->location, NULL);
|
||||||
}
|
}
|
||||||
|
@ -183,9 +188,10 @@ gst_image_capture_bin_class_init (GstImageCaptureBinClass * klass)
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
element_class = GST_ELEMENT_CLASS (klass);
|
element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
|
gobject_class->dispose = gst_image_capture_bin_dispose;
|
||||||
|
gobject_class->finalize = gst_image_capture_bin_finalize;
|
||||||
gobject_class->set_property = gst_image_capture_bin_set_property;
|
gobject_class->set_property = gst_image_capture_bin_set_property;
|
||||||
gobject_class->get_property = gst_image_capture_bin_get_property;
|
gobject_class->get_property = gst_image_capture_bin_get_property;
|
||||||
gobject_class->finalize = gst_image_capture_bin_finalize;
|
|
||||||
|
|
||||||
element_class->change_state =
|
element_class->change_state =
|
||||||
GST_DEBUG_FUNCPTR (gst_image_capture_bin_change_state);
|
GST_DEBUG_FUNCPTR (gst_image_capture_bin_change_state);
|
||||||
|
@ -214,14 +220,34 @@ gst_image_capture_bin_init (GstImageCaptureBin * imagebin,
|
||||||
GstPadTemplate *tmpl;
|
GstPadTemplate *tmpl;
|
||||||
|
|
||||||
tmpl = gst_static_pad_template_get (&sink_template);
|
tmpl = gst_static_pad_template_get (&sink_template);
|
||||||
imagebin->ghostpad =
|
imagebin->ghostpad = gst_ghost_pad_new_no_target_from_template ("sink", tmpl);
|
||||||
gst_ghost_pad_new_no_target_from_template ("sink", tmpl);
|
|
||||||
gst_object_unref (tmpl);
|
gst_object_unref (tmpl);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (imagebin), imagebin->ghostpad);
|
gst_element_add_pad (GST_ELEMENT_CAST (imagebin), imagebin->ghostpad);
|
||||||
|
|
||||||
|
imagebin->sink = NULL;
|
||||||
|
|
||||||
imagebin->location = g_strdup (DEFAULT_LOCATION);
|
imagebin->location = g_strdup (DEFAULT_LOCATION);
|
||||||
imagebin->encoder = NULL;
|
imagebin->encoder = NULL;
|
||||||
imagebin->user_encoder = NULL;
|
imagebin->user_encoder = NULL;
|
||||||
|
imagebin->muxer = NULL;
|
||||||
|
imagebin->user_muxer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_image_capture_bin_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (object);
|
||||||
|
|
||||||
|
if (imagebin->user_encoder) {
|
||||||
|
gst_object_unref (imagebin->user_encoder);
|
||||||
|
imagebin->user_encoder = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imagebin->user_muxer) {
|
||||||
|
gst_object_unref (imagebin->user_muxer);
|
||||||
|
imagebin->user_muxer = NULL;
|
||||||
|
}
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose ((GObject *) imagebin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue