+ /* check reuse flag for display element */
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_DISPLAY_REUSE_HINT, &display_reuse_hint,
+ NULL);
+
+ _mmcam_dbg_log("display reuse hint %d", display_reuse_hint);
+
+ if (!display_reuse_hint)
+ goto _REUSE_CHECK_DONE;
+
+ sink_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
+ if (!sink_element) {
+ _mmcam_dbg_warn("sink element is NULL");
+ goto _REUSE_CHECK_DONE;
+ }
+
+ attrs = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
+ if (!attrs) {
+ _mmcam_dbg_warn("attribute is NULL");
+ goto _REUSE_CHECK_DONE;
+ }
+
+ _mmcam_dbg_log("REF sink element %p and set it to attribute", sink_element);
+
+ /* ref element before remove it from pipeline */
+ gst_object_ref(sink_element);
+
+ if (!gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), sink_element))
+ _mmcam_dbg_warn("failed to remove sink element from pipeline");
+
+ /* reset floating reference flag to avoid leak after next use */
+ g_object_force_floating(G_OBJECT(sink_element));
+
+ /* set sink element pointer to attribute */
+ mm_attrs_get_index((MMHandleType)attrs, MMCAM_DISPLAY_REUSE_ELEMENT, &attr_index);
+ attr_item = &attrs->items[attr_index];
+ mmf_attribute_set_data(attr_item, (void *)sink_element, sizeof(sink_element));
+ mmf_attribute_commit(attr_item);
+
+ /* remove notify callback */
+ g_object_weak_unref(G_OBJECT(sink_element), (GWeakNotify)_mmcamcorder_element_release_noti, sc);
+
+ sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst = NULL;
+ sc->element[_MMCAMCORDER_VIDEOSINK_SINK].id = _MMCAMCORDER_NONE;
+
+_REUSE_CHECK_DONE:
+ traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:UNREALIZE:SET_NULL_TO_PIPELINE");
+