From: Sangchul Lee Date: Mon, 27 Apr 2020 04:33:18 +0000 (+0900) Subject: Add static directive to internal functions in media_streamer_gst.c X-Git-Tag: submit/tizen/20200511.015752~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F64%2F231964%2F1;p=platform%2Fcore%2Fapi%2Fmediastreamer.git Add static directive to internal functions in media_streamer_gst.c Unused function prototype in media_streamer_gst.h is also removed. : __ms_bin_find_element_by_klass() [Version] 0.1.35 [Issue Type] Improvement Change-Id: Ia32b4c59d2a82f56f72336ee4adaabd34feb0be9 Signed-off-by: Sangchul Lee --- diff --git a/include/media_streamer_gst.h b/include/media_streamer_gst.h index 3653cd4..cc93efb 100644 --- a/include/media_streamer_gst.h +++ b/include/media_streamer_gst.h @@ -52,21 +52,6 @@ extern "C" { void __ms_generate_dots(GstElement *bin, gchar *name_tag); /** - * @brief Link two elements. - * - * @since_tizen 3.0 - */ -gboolean __ms_link_two_elements(GstElement *previous_element, GstPad *prev_elem_src_pad, GstElement *found_element); - -/** - * @brief Finds GstElement by klass name. - * - * @since_tizen 3.0 - */ -GstElement *__ms_bin_find_element_by_klass(GstElement *sink_bin, GstElement *previous_elem, - GstPad *source_pad, const gchar *klass_name, const gchar *bin_name); - -/** * @brief Creates GstElement by plugin name. * * @since_tizen 3.0 @@ -95,34 +80,6 @@ int __ms_adaptive_element_prepare(media_streamer_node_s *ms_node, bool auto_plug GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node_type_e type); /** - * @brief Creates encoder GstElement by mime type. - * - * @since_tizen 3.0 - */ -GstElement *__ms_video_encoder_element_create(node_plug_s *plug_info); - -/** - * @brief Creates decoder GstElement by mime type. - * - * @since_tizen 3.0 - */ -GstElement *__ms_video_decoder_element_create(node_plug_s *plug_info); - -/** - * @brief Creates audio encoder GstElement. - * - * @since_tizen 3.0 - */ -GstElement *__ms_audio_encoder_element_create(node_plug_s *plug_info); - -/** - * @brief Creates audio decoder GstElement. - * - * @since_tizen 3.0 - */ -GstElement *__ms_audio_decoder_element_create(node_plug_s *plug_info); - -/** * @brief Creates rtp container GstElement. * * @since_tizen 3.0 @@ -262,13 +219,6 @@ int __ms_element_set_fmt(media_streamer_node_s *node, const char *pad_name, medi GstCaps *__ms_create_caps_from_fmt(media_format_h fmt); /** - * @brief Creates mediaformat from GstCaps. - * - * @since_tizen 3.0 - */ -media_format_h __ms_create_fmt_from_caps(GstCaps *caps); - -/** * @brief Seeks GstElement to according time value. * * @since_tizen 3.0 diff --git a/packaging/capi-media-streamer.spec b/packaging/capi-media-streamer.spec index 3faecfe..949754d 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.34 +Version: 0.1.35 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_streamer_gst.c b/src/media_streamer_gst.c index 1bcef02..1890a23 100644 --- a/src/media_streamer_gst.c +++ b/src/media_streamer_gst.c @@ -366,7 +366,7 @@ static GstElement *__ms_find_peer_element_by_type(GstElement *previous_element, return peer_element; } -gboolean __ms_link_two_elements(GstElement *previous_element, GstPad *prev_elem_src_pad, GstElement *found_element) +static gboolean __ms_link_two_elements(GstElement *previous_element, GstPad *prev_elem_src_pad, GstElement *found_element) { GValue src_pad_value = G_VALUE_INIT; gboolean elements_linked = FALSE; @@ -1308,65 +1308,7 @@ static GstElement *__ms_element_create_by_registry(node_plug_s *plug_info, media return gst_element; } -GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node_type_e type) -{ - GstElement *gst_element = NULL; - const gchar *src_type = NULL; - const gchar *sink_type = NULL; - - ms_debug_fenter(); - - ms_retvm_if(plug_info == NULL, NULL, "plug_info is NULL"); - - MS_GET_CAPS_TYPE(plug_info->src_caps, src_type); - MS_GET_CAPS_TYPE(plug_info->sink_caps, sink_type); - - /* 1. Main priority: - * If Node klass defined as MEDIA_STREAMER_STRICT or ENCODER/DECODER or CONVERTER types, - * element will be created immediately by format ot name */ - if (type == MEDIA_STREAMER_NODE_TYPE_AUDIO_ENCODER) - gst_element = __ms_audio_encoder_element_create(plug_info); - else if (type == MEDIA_STREAMER_NODE_TYPE_AUDIO_DECODER) - gst_element = __ms_audio_decoder_element_create(plug_info); - else if (type == MEDIA_STREAMER_NODE_TYPE_VIDEO_ENCODER) - gst_element = __ms_video_encoder_element_create(plug_info); - else if (type == MEDIA_STREAMER_NODE_TYPE_VIDEO_DECODER) - gst_element = __ms_video_decoder_element_create(plug_info); - else if (type == MEDIA_STREAMER_NODE_TYPE_AUDIO_CONVERTER || type == MEDIA_STREAMER_NODE_TYPE_VIDEO_CONVERTER) - gst_element = __ms_element_create(plug_info->info->default_name, NULL); - else if (g_strrstr(MEDIA_STREAMER_STRICT, plug_info->info->klass_name) || (!src_type && !sink_type)) { - if (type == MEDIA_STREAMER_NODE_TYPE_RTP) - gst_element = __ms_rtp_element_create(); - else - gst_element = __ms_element_create(plug_info->info->default_name, NULL); - } else { - - /* 2. Second priority: - * Try to get plugin name that defined in ini file - * according with node type and specified format. */ - gst_element = __ms_element_create_from_ini(plug_info, type); - } - - /* 3. Third priority: - * If previous cases did not create a valid gst_element, - * try to find compatible plugin in gstreamer registry. - * Elements that are compatible but defined as excluded will be skipped*/ - if (!gst_element) { - /* Read exclude elements list */ - gst_element = __ms_element_create_by_registry(plug_info, type); - } - - if (type == MEDIA_STREAMER_NODE_TYPE_FILTER) { - if (plug_info->src_caps) - g_object_set(G_OBJECT(gst_element), "caps", plug_info->src_caps, NULL); - } - - ms_debug_fleave(); - - return gst_element; -} - -GstElement *__ms_video_encoder_element_create(node_plug_s *plug_info) +static GstElement *__ms_video_encoder_element_create(node_plug_s *plug_info) { GstElement *video_scale = NULL; GstElement *video_convert = NULL; @@ -1463,7 +1405,7 @@ ERROR: return NULL; } -GstElement *__ms_video_decoder_element_create(node_plug_s *plug_info) +static GstElement *__ms_video_decoder_element_create(node_plug_s *plug_info) { gboolean is_hw_codec = FALSE; GstElement *last_elem = NULL; @@ -1581,7 +1523,7 @@ ERROR: return NULL; } -GstElement *__ms_audio_encoder_element_create(node_plug_s *plug_info) +static GstElement *__ms_audio_encoder_element_create(node_plug_s *plug_info) { gboolean gst_ret = FALSE; GstElement *audio_convert = NULL; @@ -1667,7 +1609,7 @@ ERROR: } -GstElement *__ms_audio_decoder_element_create(node_plug_s *plug_info) +static GstElement *__ms_audio_decoder_element_create(node_plug_s *plug_info) { gboolean gst_ret = FALSE; GstElement *decoder_bin = NULL; @@ -1762,6 +1704,64 @@ ERROR: return NULL; } +GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node_type_e type) +{ + GstElement *gst_element = NULL; + const gchar *src_type = NULL; + const gchar *sink_type = NULL; + + ms_debug_fenter(); + + ms_retvm_if(plug_info == NULL, NULL, "plug_info is NULL"); + + MS_GET_CAPS_TYPE(plug_info->src_caps, src_type); + MS_GET_CAPS_TYPE(plug_info->sink_caps, sink_type); + + /* 1. Main priority: + * If Node klass defined as MEDIA_STREAMER_STRICT or ENCODER/DECODER or CONVERTER types, + * element will be created immediately by format ot name */ + if (type == MEDIA_STREAMER_NODE_TYPE_AUDIO_ENCODER) + gst_element = __ms_audio_encoder_element_create(plug_info); + else if (type == MEDIA_STREAMER_NODE_TYPE_AUDIO_DECODER) + gst_element = __ms_audio_decoder_element_create(plug_info); + else if (type == MEDIA_STREAMER_NODE_TYPE_VIDEO_ENCODER) + gst_element = __ms_video_encoder_element_create(plug_info); + else if (type == MEDIA_STREAMER_NODE_TYPE_VIDEO_DECODER) + gst_element = __ms_video_decoder_element_create(plug_info); + else if (type == MEDIA_STREAMER_NODE_TYPE_AUDIO_CONVERTER || type == MEDIA_STREAMER_NODE_TYPE_VIDEO_CONVERTER) + gst_element = __ms_element_create(plug_info->info->default_name, NULL); + else if (g_strrstr(MEDIA_STREAMER_STRICT, plug_info->info->klass_name) || (!src_type && !sink_type)) { + if (type == MEDIA_STREAMER_NODE_TYPE_RTP) + gst_element = __ms_rtp_element_create(); + else + gst_element = __ms_element_create(plug_info->info->default_name, NULL); + } else { + + /* 2. Second priority: + * Try to get plugin name that defined in ini file + * according with node type and specified format. */ + gst_element = __ms_element_create_from_ini(plug_info, type); + } + + /* 3. Third priority: + * If previous cases did not create a valid gst_element, + * try to find compatible plugin in gstreamer registry. + * Elements that are compatible but defined as excluded will be skipped*/ + if (!gst_element) { + /* Read exclude elements list */ + gst_element = __ms_element_create_by_registry(plug_info, type); + } + + if (type == MEDIA_STREAMER_NODE_TYPE_FILTER) { + if (plug_info->src_caps) + g_object_set(G_OBJECT(gst_element), "caps", plug_info->src_caps, NULL); + } + + ms_debug_fleave(); + + return gst_element; +} + GstElement *__ms_rtp_element_create(void) { GstElement *rtp_container = NULL; @@ -2356,7 +2356,7 @@ GstCaps *__ms_create_caps_from_fmt(media_format_h fmt) return caps; } -media_format_h __ms_create_fmt_from_caps(GstCaps *caps) +static media_format_h __ms_create_fmt_from_caps(GstCaps *caps) { media_format_h fmt; GstStructure *pad_struct;