camerabin2: viewfinderbin: Link elements directly to use faster version
authorThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 28 Nov 2011 21:43:40 +0000 (18:43 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 28 Nov 2011 21:48:52 +0000 (18:48 -0300)
ffmpegcolorspace and videoscale should always link successfully, use
the fast pad linking version instead of calling the generic helper
function.

gst/camerabin2/gstviewfinderbin.c

index 1e256ccd7fdb76e57a5c26148d0ac7a6f83a006d..87cfe2752755aa8bbc9fe82764f6c2fa5a304709 100644 (file)
@@ -206,21 +206,22 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin)
     gst_ghost_pad_set_target (GST_GHOST_PAD (vfbin->ghostpad), NULL);
 
     /* add the elements, user wants them */
-    csp =
-        gst_camerabin_create_and_add_element (GST_BIN (vfbin),
-        "ffmpegcolorspace", "vfbin-csp");
+    csp = gst_element_factory_make ("ffmpegcolorspace", "vfbin-csp");
     if (!csp) {
       missing_element_name = "ffmpegcolorspace";
       goto missing_element;
     }
+    gst_bin_add (GST_BIN (vfbin), csp);
 
-    videoscale =
-        gst_camerabin_create_and_add_element (GST_BIN (vfbin), "videoscale",
-        "vfbin-videoscale");
+    videoscale = gst_element_factory_make ("videoscale", "vfbin->videoscale");
     if (!videoscale) {
       missing_element_name = "videoscale";
       goto missing_element;
     }
+    gst_bin_add (GST_BIN (vfbin), videoscale);
+
+    gst_element_link_pads_full (csp, "src", videoscale, "sink",
+        GST_PAD_LINK_CHECK_NOTHING);
 
     vfbin->elements_created = TRUE;
     GST_DEBUG_OBJECT (vfbin, "Elements succesfully created and linked");
@@ -238,7 +239,8 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin)
       unref = TRUE;
     }
 
-    if (!gst_element_link_pads (videoscale, "src", vfbin->video_sink, "sink")) {
+    if (!gst_element_link_pads_full (videoscale, "src", vfbin->video_sink,
+            "sink", GST_PAD_LINK_CHECK_CAPS)) {
       GST_ELEMENT_ERROR (vfbin, CORE, NEGOTIATION, (NULL),
           ("linking videoscale and viewfindersink failed"));
     }