From 42b510fd1b63ba8bb52eaf5817c39e2e2c8a2f1c Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 5 Jan 2015 15:16:15 -0300 Subject: [PATCH] wrappercamerabinsrc: simplify weird if/else clause It is not an if/else situation but an if error abort otherwise just continue. Remove else to make it more readable --- gst/camerabin2/gstwrappercamerabinsrc.c | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 6023e442b0..892bac328a 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -441,6 +441,7 @@ check_and_replace_src (GstWrapperCameraBinSrc * self) { GstBin *cbin = GST_BIN_CAST (self); GstBaseCameraSrc *bcamsrc = GST_BASE_CAMERA_SRC_CAST (self); + GstElement *videoconvert; if (self->src_vid_src && self->src_vid_src == self->app_vid_src) { GST_DEBUG_OBJECT (self, "No need to change current videosrc"); @@ -473,22 +474,20 @@ check_and_replace_src (GstWrapperCameraBinSrc * self) "camerasrc-real-src"))) { self->src_vid_src = NULL; return FALSE; - } else { - GstElement *videoconvert; - if (!gst_bin_add (cbin, self->src_vid_src)) { + } + + if (!gst_bin_add (cbin, self->src_vid_src)) { + return FALSE; + } + + /* check if we already have the next element to link to */ + videoconvert = gst_bin_get_by_name (cbin, "src-videoconvert"); + if (videoconvert) { + if (!gst_element_link_pads (self->src_vid_src, "src", videoconvert, "sink")) { + gst_object_unref (videoconvert); return FALSE; } - - /* check if we already have the next element to link to */ - videoconvert = gst_bin_get_by_name (cbin, "src-videoconvert"); - if (videoconvert) { - if (!gst_element_link_pads (self->src_vid_src, "src", videoconvert, - "sink")) { - gst_object_unref (videoconvert); - return FALSE; - } - gst_object_unref (videoconvert); - } + gst_object_unref (videoconvert); } /* we listen for changes to max-zoom in the video src so that