Hello!
I work with GStreamer 0.10.28 on board with FreeScale iMX53 processor and I can't change it because I use vendor-specific module for hardware encoding video. I need dynamic change pipeline - plug and unplug bin, follow my code: GstElement *snapshot = NULL, *f = NULL; GstPad *snap = NULL, *tee = NULL; snapshot = gst_bin_new(NULL); if (NULL == snapshot) { ERROR("Failed get snapshot bin!"); return msg_error_msg("Failed get snapshot bin!"); } if (!make_snapshot_pipeline(snapshot, w, h, q)) { ERROR("Failed build snapshot bin!"); return msg_error_msg("Failed build snapshot bin!"); } INFO("Build snapshot bin!"); snap = gst_element_get_pad(snapshot, "snap"); if (NULL == snap) { ERROR("Failed get snapshot pad!"); return msg_error_msg("Failed get snapshot pad!"); } tee = gst_element_get_request_pad( gst_bin_get_by_name(GST_BIN(pipe), "tee"), "src%d"); if (NULL == tee) { ERROR("Failed get tee pad!"); return msg_error_msg("Failed get tee pad!"); } f = gst_bin_get_by_name(GST_BIN(snapshot), "filesink"); if (NULL == f) { ERROR("Failed get filesink element!"); return msg_error_msg("Failed get filesink element!"); } INFO("Get filesink element!"); gst_element_set_state(pipe, GST_STATE_PAUSED); if (!gst_bin_add(GST_BIN(pipe), snapshot)) { ERROR("Failed add snapshot to pipeline!"); return msg_error_msg("Failed add snapshot to pipeline!"); } INFO("Add snapshot to pipeline!"); if (gst_pad_link(tee, snap)) { ERROR("Failed link video and snapshot!"); return msg_error_msg("Failed link video and snapshot!"); } INFO("Link video and snapshot!"); while (gst_element_set_state(pipe, GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) { ERROR("Wait state change!"); g_usleep(500000); } ............. /* * save snapshot in file */ ............... /* unplug snapshot bin */ while (gst_element_set_state(pipe, GST_STATE_NULL) != GST_STATE_CHANGE_SUCCESS) { ERROR("Wait change state pipeline after snapshot!"); g_usleep(500000); } /*if (!gst_pad_unlink(tee, snap)) { ERROR("Failed unlink snapshot pipe!"); return msg_error_msg("Failed unlink snapshot pipe!"); }*/ do { gst_pad_unlink(tee, snap); g_usleep(500000); ERROR("Wait unlink tee and snap!"); } while (gst_pad_is_linked(snap)); //gst_element_set_state(snapshot, GST_STATE_NULL); gst_element_release_request_pad( gst_bin_get_by_name(GST_BIN(pipe), "tee"), tee); gst_object_unref(tee); gst_object_unref(f); gst_object_unref(snap); gst_object_unref(snapshot); gst_element_set_state(pipe, GST_STATE_PLAYING); This code work, but everytime I get error messages: (camerad:2246): GStreamer-CRITICAL **: Trying to dispose object "bin1", but it still has a parent "pipeline". You need to let the parent manage the object instead of unreffing the object directly. Bin number everytime is increase. How can I solve this problem? Thank you and excuse me my bad english. -- Best regards, Brilliantov Kirill Vladimirovich ………………………………………………………………… programmer, technical department Byterg LLC ………………………………………………………………… +7(495)221-66-22 http://www.byterg.ru http://www.bestdvr.ru _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |