From: Sangchul Lee Date: Wed, 26 Aug 2020 01:21:21 +0000 (+0900) Subject: Remove useless if-else statement X-Git-Tag: submit/tizen/20200916.003525~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d80e478e749d14fd94c19c724acf4ef3bb974f1d;p=platform%2Fcore%2Fapi%2Fmediastreamer.git Remove useless if-else statement [Version] 0.1.115 [Issue Type] Refactoring Change-Id: Ie7cfe36452f0fec46e6ed4a378ea92156d55b9db Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-streamer.spec b/packaging/capi-media-streamer.spec index 115b0f0..dc6c36b 100644 --- a/packaging/capi-media-streamer.spec +++ b/packaging/capi-media-streamer.spec @@ -1,6 +1,6 @@ Name: capi-media-streamer Summary: A Media Streamer API -Version: 0.1.114 +Version: 0.1.115 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_streamer_gst.c b/src/media_streamer_gst.c index 64638c2..8165890 100644 --- a/src/media_streamer_gst.c +++ b/src/media_streamer_gst.c @@ -1228,11 +1228,11 @@ GstElement *ms_adaptive_element_create(void) static gboolean __ms_feature_node_filter(GstPluginFeature *feature, gpointer data) { node_plug_s *plug_info = (node_plug_s*)data; - gboolean can_accept = FALSE; gboolean src_can_accept = FALSE; gboolean sink_can_accept = FALSE; GstElementFactory *factory = NULL; const gchar *factory_klass = NULL; + int index = 0; if (!GST_IS_ELEMENT_FACTORY(feature)) return FALSE; @@ -1240,41 +1240,37 @@ static gboolean __ms_feature_node_filter(GstPluginFeature *feature, gpointer dat factory = GST_ELEMENT_FACTORY(feature); factory_klass = gst_element_factory_get_klass(factory); - if (plug_info && g_strrstr(factory_klass, plug_info->info->klass_name)) { - if (GST_IS_CAPS(plug_info->src_caps)) - src_can_accept = gst_element_factory_can_src_any_caps(factory, plug_info->src_caps); - - if (GST_IS_CAPS(plug_info->sink_caps)) - sink_can_accept = gst_element_factory_can_sink_any_caps(factory, plug_info->sink_caps); - - if (GST_IS_CAPS(plug_info->src_caps) && GST_IS_CAPS(plug_info->sink_caps)) { - if (src_can_accept && sink_can_accept) - can_accept = TRUE; - } else if (src_can_accept || sink_can_accept) - can_accept = TRUE; - - if (can_accept) { - int index = 0; - for ( ; plug_info->exclude_names && plug_info->exclude_names[index]; ++index) { - if (g_strrstr(GST_OBJECT_NAME(factory), plug_info->exclude_names[index])) { - ms_debug("Skipping compatible factory [%s] as excluded.", GST_OBJECT_NAME(factory)); - return FALSE; - } - } + if (!plug_info || !g_strrstr(factory_klass, plug_info->info->klass_name)) + return FALSE; - if (__need_to_skip_hw_video_decoder_klass(factory_klass)) { - ms_debug("Skipping [%s]", GST_OBJECT_NAME(factory)); - return FALSE; - } + if (GST_IS_CAPS(plug_info->src_caps)) + src_can_accept = gst_element_factory_can_src_any_caps(factory, plug_info->src_caps); - ms_info("[INFO] Found compatible factory [%s] for klass [%s]", - GST_OBJECT_NAME(factory), factory_klass); - return TRUE; + if (GST_IS_CAPS(plug_info->sink_caps)) + sink_can_accept = gst_element_factory_can_sink_any_caps(factory, plug_info->sink_caps); + + if (GST_IS_CAPS(plug_info->src_caps) && GST_IS_CAPS(plug_info->sink_caps)) { + if (!src_can_accept || !sink_can_accept) + return FALSE; + } + + if (!src_can_accept && !sink_can_accept) + return FALSE; + + for ( ; plug_info->exclude_names && plug_info->exclude_names[index]; ++index) { + if (g_strrstr(GST_OBJECT_NAME(factory), plug_info->exclude_names[index])) { + ms_debug("Skipping compatible factory [%s] as excluded.", GST_OBJECT_NAME(factory)); + return FALSE; } + } + if (__need_to_skip_hw_video_decoder_klass(factory_klass)) { + ms_debug("Skipping [%s]", GST_OBJECT_NAME(factory)); + return FALSE; } - return FALSE; + ms_info("Found compatible factory [%s] for klass [%s]", GST_OBJECT_NAME(factory), factory_klass); + return TRUE; } static GstElement *ms_element_create_from_ini(node_plug_s *plug_info, media_streamer_node_type_e type)