camerabin: Use link_full version for disabling hierarchy check
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 23 Sep 2010 01:39:49 +0000 (22:39 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 23 Sep 2010 02:47:08 +0000 (23:47 -0300)
Disable hierarchy checks when linking because we are already
handling the element adding to bins and it should be done
correctly.

gst/camerabin/camerabingeneral.c
gst/camerabin/camerabinpreview.c
gst/camerabin/camerabinvideo.c
gst/camerabin/gstcamerabin.c

index 5b4df17..f1cf35d 100644 (file)
@@ -95,7 +95,8 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem)
         GST_DEBUG_PAD_NAME (bin_pad));
     bin_elem = gst_pad_get_parent_element (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_bin_remove (bin, new_elem);
       ret = FALSE;
index 688991b..d1d2a81 100644 (file)
@@ -106,30 +106,36 @@ gst_camerabin_preview_create_pipeline (GstCameraBin * camera, GstCaps * caps,
 
   /* FIXME: linking is still way too expensive, profile this properly */
   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;
 
   if (src_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;
     }
     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;
     }
   } else {
     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;
   }
 
   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;
 
   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 pipe;
index 834ffcd..cd6d920 100644 (file)
@@ -660,7 +660,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid)
     }
 
     /* 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),
           ("linking audio encoder and muxer failed"));
       goto error;
index 315ab34..5f2ef6d 100644 (file)
@@ -772,7 +772,9 @@ camerabin_create_elements (GstCameraBin * camera)
   unconnected_pad = gst_bin_find_unlinked_pad (GST_BIN (camera), GST_PAD_SRC);
   camera->pad_view_vid =
       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);
   if (GST_PAD_LINK_FAILED (link_ret)) {
     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 */
     gst_element_set_state (videosrc, GST_STATE_NULL);
     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_element_set_locked_state (videosrc, FALSE);