camerabin: Use link_full version for disabling hierarchy check

Disable hierarchy checks when linking because we are already
handling the element adding to bins and it should be done
correctly.
This commit is contained in:
Thiago Santos 2010-09-22 22:39:49 -03:00
parent e893a8b82e
commit 0a7ae539ea
4 changed files with 20 additions and 10 deletions

View File

@ -95,7 +95,8 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem)
GST_DEBUG_PAD_NAME (bin_pad)); GST_DEBUG_PAD_NAME (bin_pad));
bin_elem = gst_pad_get_parent_element (bin_pad); bin_elem = gst_pad_get_parent_element (bin_pad);
gst_object_unref (bin_pad); gst_object_unref (bin_pad);
if (!gst_element_link (bin_elem, new_elem)) { if (!gst_element_link_pads_full (bin_elem, NULL, new_elem, NULL,
GST_PAD_LINK_CHECK_CAPS)) {
gst_object_ref (new_elem); gst_object_ref (new_elem);
gst_bin_remove (bin, new_elem); gst_bin_remove (bin, new_elem);
ret = FALSE; ret = FALSE;

View File

@ -106,30 +106,36 @@ gst_camerabin_preview_create_pipeline (GstCameraBin * camera, GstCaps * caps,
/* FIXME: linking is still way too expensive, profile this properly */ /* FIXME: linking is still way too expensive, profile this properly */
GST_DEBUG ("linking src->vscale"); GST_DEBUG ("linking src->vscale");
if (!gst_element_link_pads (src, "src", vscale, "sink")) if (!gst_element_link_pads_full (src, "src", vscale, "sink",
GST_PAD_LINK_CHECK_CAPS))
return FALSE; return FALSE;
if (src_filter) { if (src_filter) {
GST_DEBUG ("linking vscale->filter"); GST_DEBUG ("linking vscale->filter");
if (!gst_element_link_pads (vscale, "src", src_filter, "sink")) { if (!gst_element_link_pads_full (vscale, "src", src_filter, "sink",
GST_PAD_LINK_CHECK_CAPS)) {
return FALSE; return FALSE;
} }
GST_DEBUG ("linking filter->csp"); GST_DEBUG ("linking filter->csp");
if (!gst_element_link_pads (src_filter, "src", csp, "sink")) { if (!gst_element_link_pads_full (src_filter, "src", csp, "sink",
GST_PAD_LINK_CHECK_CAPS)) {
return FALSE; return FALSE;
} }
} else { } else {
GST_DEBUG ("linking vscale->csp"); GST_DEBUG ("linking vscale->csp");
if (!gst_element_link_pads (vscale, "src", csp, "sink")) if (!gst_element_link_pads_full (vscale, "src", csp, "sink",
GST_PAD_LINK_CHECK_CAPS))
return FALSE; return FALSE;
} }
GST_DEBUG ("linking csp->capsfilter"); GST_DEBUG ("linking csp->capsfilter");
if (!gst_element_link_pads (csp, "src", filter, "sink")) if (!gst_element_link_pads_full (csp, "src", filter, "sink",
GST_PAD_LINK_CHECK_CAPS))
return FALSE; return FALSE;
GST_DEBUG ("linking capsfilter->sink"); GST_DEBUG ("linking capsfilter->sink");
if (!gst_element_link_pads (filter, "src", sink, "sink")) if (!gst_element_link_pads_full (filter, "src", sink, "sink",
GST_PAD_LINK_CHECK_CAPS))
return FALSE; return FALSE;
return pipe; return pipe;

View File

@ -660,7 +660,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid)
} }
/* Link audio part to the muxer */ /* Link audio part to the muxer */
if (!gst_element_link (vid->aud_enc, vid->muxer)) { if (!gst_element_link_pads_full (vid->aud_enc, NULL, vid->muxer, NULL,
GST_PAD_LINK_CHECK_CAPS)) {
GST_ELEMENT_ERROR (vid, CORE, NEGOTIATION, (NULL), GST_ELEMENT_ERROR (vid, CORE, NEGOTIATION, (NULL),
("linking audio encoder and muxer failed")); ("linking audio encoder and muxer failed"));
goto error; goto error;

View File

@ -772,7 +772,9 @@ camerabin_create_elements (GstCameraBin * camera)
unconnected_pad = gst_bin_find_unlinked_pad (GST_BIN (camera), GST_PAD_SRC); unconnected_pad = gst_bin_find_unlinked_pad (GST_BIN (camera), GST_PAD_SRC);
camera->pad_view_vid = camera->pad_view_vid =
gst_element_get_request_pad (camera->view_in_sel, "sink%d"); gst_element_get_request_pad (camera->view_in_sel, "sink%d");
link_ret = gst_pad_link (unconnected_pad, camera->pad_view_vid); link_ret =
gst_pad_link_full (unconnected_pad, camera->pad_view_vid,
GST_PAD_LINK_CHECK_CAPS);
gst_object_unref (unconnected_pad); gst_object_unref (unconnected_pad);
if (GST_PAD_LINK_FAILED (link_ret)) { if (GST_PAD_LINK_FAILED (link_ret)) {
GST_ELEMENT_ERROR (camera, CORE, NEGOTIATION, (NULL), GST_ELEMENT_ERROR (camera, CORE, NEGOTIATION, (NULL),
@ -1186,7 +1188,7 @@ gst_camerabin_get_allowed_input_caps (GstCameraBin * camera)
/* Reset videosrc to NULL state, some drivers seem to need this */ /* Reset videosrc to NULL state, some drivers seem to need this */
gst_element_set_state (videosrc, GST_STATE_NULL); gst_element_set_state (videosrc, GST_STATE_NULL);
if (peer_pad) { if (peer_pad) {
gst_pad_link (pad, peer_pad); gst_pad_link_full (pad, peer_pad, GST_PAD_LINK_CHECK_CAPS);
gst_object_unref (peer_pad); gst_object_unref (peer_pad);
} }
gst_element_set_locked_state (videosrc, FALSE); gst_element_set_locked_state (videosrc, FALSE);