Modified loading .ini file 27/71527/1
authorVyacheslav Valkovoy <v.valkovoy@samsung.com>
Wed, 25 May 2016 17:54:23 +0000 (20:54 +0300)
committerVyacheslav Valkovoy <v.valkovoy@samsung.com>
Wed, 25 May 2016 17:54:47 +0000 (20:54 +0300)
Change-Id: Ie8dfff92625d01b04b6f9a29b04e5e7fa87c5ec5
Signed-off-by: Vyacheslav Valkovoy <v.valkovoy@samsung.com>
include/media_streamer_gst.h
include/media_streamer_util.h
src/media_streamer_gst.c
src/media_streamer_node.c
src/media_streamer_util.c

index 07f964b81c67c69a16cd7f422307691f6c8c6e78..f41b5324a732fd6e7f93cf34879a7d85042f9f55 100644 (file)
@@ -88,14 +88,14 @@ GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node
  *
  * @since_tizen 3.0
  */
-GstElement *__ms_video_encoder_element_create(dictionary *dict, media_format_mimetype_e mime);
+GstElement *__ms_video_encoder_element_create(media_format_mimetype_e mime);
 
 /**
  * @brief Creates decoder GstElement by mime type.
  *
  * @since_tizen 3.0
  */
-GstElement *__ms_video_decoder_element_create(dictionary *dict, media_format_mimetype_e mime);
+GstElement *__ms_video_decoder_element_create(media_format_mimetype_e mime);
 
 /**
  * @brief Creates audio encoder GstElement.
index 2cb2d730c32762cc2068503610b633b28b726285..f7ed569b69074c5974d23b2d5bf68564b17702c1 100644 (file)
@@ -96,7 +96,7 @@ extern "C" {
        #define MEDIA_STREAMER_INI_PATH "/etc/media_streamer.ini"
 #endif
 
-#define MEDIA_STREAMER_INI_MAX_STRLEN 100
+#define INI_MAX_STRLEN (100)
 #define RTP_STREAM_DISABLED (0)
 
 /**
@@ -165,6 +165,7 @@ typedef struct {
 #define DEFAULT_UDP_SOURCE                  "udpsrc"
 #define DEFAULT_FILE_SOURCE                 "filesrc"
 #define DEFAULT_HTTP_SOURCE                 "souphttpsrc"
+#define DEFAULT_FILE_SINK                   "filesink"
 #define DEFAULT_UDP_SINK                    "udpsink"
 #define DEFAULT_RTP_BIN                     "rtpbin"
 
@@ -262,32 +263,25 @@ typedef struct {
 void __ms_load_ini_settings(media_streamer_ini_t *ini);
 
 /**
- * @brief Load settings from ini file into dictionary object.
+ * @brief Get instance of ini dictionary or create one if it doesn`t exist.
  *
  * @since_tizen 3.0
  */
-gboolean __ms_load_ini_dictionary(dictionary **dict);
-
-/**
- * @brief Destroys ini dictionary object and frees all resources.
- *
- * @since_tizen 3.0
- */
-gboolean __ms_destroy_ini_dictionary(dictionary *dict);
+dictionary *__ms_get_ini_instance(void);
 
 /**
  * @brief Read and copy string reading from ini file.
  *
  * @since_tizen 3.0
  */
-gchar *__ms_ini_get_string(dictionary *dict, const char *ini_path, char *default_str);
+gchar *__ms_ini_get_string(const char *ini_path, char *default_str);
 
 /**
  * @brief Reads comma-separated string list from ini file.
  *
  * @since_tizen 3.0
  */
-void __ms_ini_read_list(dictionary *dict, const char *key, gchar ***list);
+void __ms_ini_read_list(const char *key, gchar ***list);
 
 /**
  * @brief Converts Media Format mime type into Caps media format string.
index 583a1c5fbcea2e865dd83f1eb12ee154739fcc47..c3624f66931591747c5a5afe86152d336969603e 100755 (executable)
@@ -23,7 +23,6 @@
 #define H264_PARSER_CONFIG_INTERVAL 5
 #define H264_ENCODER_ZEROLATENCY 0x00000004
 
-#define NODE_CONF_FIELD_LEN 100
 
 void __ms_generate_dots(GstElement *bin, gchar *name_tag)
 {
@@ -592,17 +591,12 @@ GstElement *__ms_combine_next_element(GstElement * previous_element, GstPad * pr
                        /* Create element by predefined format element type */
                } else if (!found_element && next_elem_bin_name && MS_ELEMENT_IS_ENCODER(next_elem_bin_name)) {
 
-                       dictionary *dict = NULL;
-
-                       __ms_load_ini_dictionary(&dict);
 
                        if (MS_ELEMENT_IS_VIDEO(next_elem_bin_name))
-                               found_element = __ms_video_encoder_element_create(dict, MEDIA_FORMAT_H263);
+                               found_element = __ms_video_encoder_element_create(MEDIA_FORMAT_H263);
                        else
                                found_element = __ms_audio_encoder_element_create();
 
-                       __ms_destroy_ini_dictionary(dict);
-
                        /* Create element by caps of the previous element */
                } else if (!found_element) {
                        GstPad *src_pad = NULL;
@@ -724,6 +718,7 @@ static void __decodebin_nomore_pads_combine(GstPad *src_pad, media_streamer_s *m
                        found_element = __ms_combine_next_element(found_element, NULL, ms_streamer->topology_bin, MEDIA_STREAMER_PAYLOADER_KLASS, NULL, NULL);
                        found_element = __ms_combine_next_element(found_element, NULL, ms_streamer->topology_bin, MEDIA_STREAMER_BIN_KLASS, "rtp_container", NULL);
                } else {
+                       found_element = __ms_combine_next_element(found_element, src_pad, ms_streamer->topology_bin, MEDIA_STREAMER_CONVERTER_KLASS, NULL, DEFAULT_VIDEO_CONVERT);
                        found_element = __ms_combine_next_element(found_element, NULL, ms_streamer->sink_bin, MEDIA_STREAMER_QUEUE_KLASS, NULL, DEFAULT_QUEUE);
                        found_element = __ms_combine_next_element(found_element, NULL, ms_streamer->sink_bin, MEDIA_STREAMER_SINK_KLASS, NULL, NULL);
                }
@@ -952,7 +947,6 @@ static gboolean __ms_feature_node_filter(GstPluginFeature *feature, gpointer dat
 
 GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node_type_e type)
 {
-       dictionary *dict = NULL;
        GstElement *gst_element = NULL;
 
        const gchar *src_type, *sink_type;
@@ -974,20 +968,18 @@ GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node
                 * Try to get plugin name that defined in ini file
                 * according with node type and specified format. */
                ms_info("Specified node formats types: in[%s] - out[%s]", sink_type, src_type);
-               gchar conf_key[NODE_CONF_FIELD_LEN] = {0,};
-               if (snprintf(conf_key, NODE_CONF_FIELD_LEN, "node type %d:%s", type, (sink_type ? sink_type : src_type)) >= NODE_CONF_FIELD_LEN) {
-                       ms_error("Failed to generate config field name, size >= %d", NODE_CONF_FIELD_LEN);
+               gchar conf_key[INI_MAX_STRLEN] = {0,};
+               if (snprintf(conf_key, INI_MAX_STRLEN, "node type %d:%s", type, (sink_type ? sink_type : src_type)) >= INI_MAX_STRLEN) {
+                       ms_error("Failed to generate config field name, size >= %d", INI_MAX_STRLEN);
                        return NULL;
                }
 
-               __ms_load_ini_dictionary(&dict);
-               gchar *plugin_name = __ms_ini_get_string(dict, conf_key, NULL);
+               gchar *plugin_name = __ms_ini_get_string(conf_key, NULL);
 
                if (plugin_name) {
                        gst_element = __ms_element_create(plugin_name, NULL);
                        MS_SAFE_GFREE(plugin_name);
                }
-               __ms_destroy_ini_dictionary(dict);
        }
 
        /* 3. Third priority:
@@ -995,10 +987,8 @@ GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node
         * try to find compatible plugin in gstreamer registry.
         * Elements that are compatible but defined as excluded will be skipped*/
        if(!gst_element) {
-               __ms_load_ini_dictionary(&dict);
-
                /* Read exclude elements list */
-               __ms_ini_read_list(dict, "general:exclude elements", &plug_info->exclude_names);
+               __ms_ini_read_list("general:exclude elements", &plug_info->exclude_names);
 
                GList *factories = gst_registry_feature_filter(gst_registry_get(),
                        __ms_feature_node_filter, TRUE, plug_info);
@@ -1013,13 +1003,12 @@ GstElement *__ms_node_element_create(node_plug_s *plug_info, media_streamer_node
 
                g_strfreev(plug_info->exclude_names);
                gst_plugin_list_free(factories);
-               __ms_destroy_ini_dictionary(dict);
        }
 
        return gst_element;
 }
 
-GstElement *__ms_video_encoder_element_create(dictionary * dict, media_format_mimetype_e mime)
+GstElement *__ms_video_encoder_element_create(media_format_mimetype_e mime)
 {
        char *plugin_name = NULL;
        char *format_prefix = NULL;
@@ -1028,14 +1017,14 @@ GstElement *__ms_video_encoder_element_create(dictionary * dict, media_format_mi
        GstElement *video_convert = __ms_element_create(DEFAULT_VIDEO_CONVERT, NULL);
 
        format_prefix = g_strdup_printf("%s:encoder", __ms_convert_mime_to_string(mime));
-       plugin_name = __ms_ini_get_string(dict, format_prefix, DEFAULT_VIDEO_ENCODER);
+       plugin_name = __ms_ini_get_string(format_prefix, DEFAULT_VIDEO_ENCODER);
        GstElement *encoder_elem = __ms_element_create(plugin_name, NULL);
 
        MS_SAFE_FREE(format_prefix);
        MS_SAFE_FREE(plugin_name);
 
        format_prefix = g_strdup_printf("%s:parser", __ms_convert_mime_to_string(mime));
-       plugin_name = __ms_ini_get_string(dict, format_prefix, DEFAULT_VIDEO_PARSER);
+       plugin_name = __ms_ini_get_string(format_prefix, DEFAULT_VIDEO_PARSER);
        GstElement *encoder_parser = __ms_element_create(plugin_name, NULL);
 
        MS_SAFE_FREE(format_prefix);
@@ -1066,7 +1055,7 @@ GstElement *__ms_video_encoder_element_create(dictionary * dict, media_format_mi
        return encoder_bin;
 }
 
-GstElement *__ms_video_decoder_element_create(dictionary * dict, media_format_mimetype_e mime)
+GstElement *__ms_video_decoder_element_create(media_format_mimetype_e mime)
 {
        char *plugin_name = NULL;
        char *format_prefix = NULL;
@@ -1074,13 +1063,13 @@ GstElement *__ms_video_decoder_element_create(dictionary * dict, media_format_mi
        GstElement *last_elem = NULL;
 
        format_prefix = g_strdup_printf("%s:decoder", __ms_convert_mime_to_string(mime));
-       plugin_name = __ms_ini_get_string(dict, format_prefix, DEFAULT_VIDEO_DECODER);
+       plugin_name = __ms_ini_get_string(format_prefix, DEFAULT_VIDEO_DECODER);
        GstElement *decoder_elem = __ms_element_create(plugin_name, NULL);
        MS_SAFE_FREE(format_prefix);
        MS_SAFE_FREE(plugin_name);
 
        format_prefix = g_strdup_printf("%s:parser", __ms_convert_mime_to_string(mime));
-       plugin_name = __ms_ini_get_string(dict, format_prefix, DEFAULT_VIDEO_PARSER);
+       plugin_name = __ms_ini_get_string(format_prefix, DEFAULT_VIDEO_PARSER);
        GstElement *decoder_parser = __ms_element_create(plugin_name, NULL);
 
        if (mime == MEDIA_FORMAT_H264_SP)
index 849a61bb8da0c8800aad6f2a4e5fd0f49ad9bf3c..7a1bdd6fc2b7df60f0f52de1dc4a1ec129b7d9a3 100755 (executable)
@@ -209,41 +209,43 @@ int __ms_src_node_create(media_streamer_node_s *node)
        ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "Handle is NULL");
 
        int ret = MEDIA_STREAMER_ERROR_NONE;
-       dictionary *dict = NULL;
        char *plugin_name = NULL;
 
-       __ms_load_ini_dictionary(&dict);
-
        switch (node->subtype) {
        case MEDIA_STREAMER_NODE_SRC_TYPE_FILE:
-               node->gst_element = __ms_element_create(DEFAULT_FILE_SOURCE, NULL);
+               plugin_name = __ms_ini_get_string("node type 1:file", DEFAULT_FILE_SOURCE);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_RTSP:
-               node->gst_element = __ms_element_create(DEFAULT_UDP_SOURCE, NULL);
+               plugin_name = __ms_ini_get_string("node type 1:rtsp", DEFAULT_UDP_SOURCE);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_HTTP:
-               node->gst_element = __ms_element_create(DEFAULT_HTTP_SOURCE, NULL);
+               plugin_name = __ms_ini_get_string("node type 1:http", DEFAULT_HTTP_SOURCE);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_CAMERA:
-               plugin_name = __ms_ini_get_string(dict, "sources:camera_source", DEFAULT_CAMERA_SOURCE);
+               plugin_name = __ms_ini_get_string("node type 1:camera", DEFAULT_CAMERA_SOURCE);
                node->gst_element = __ms_element_create(plugin_name, NULL);
-
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_AUDIO_CAPTURE:
-               plugin_name = __ms_ini_get_string(dict, "sources:audio_source", DEFAULT_AUDIO_SOURCE);
+               plugin_name = __ms_ini_get_string("node type 1:audio capture", DEFAULT_AUDIO_SOURCE);
                node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_VIDEO_CAPTURE:
-               plugin_name = __ms_ini_get_string(dict, "sources:video_source", DEFAULT_VIDEO_SOURCE);
+               plugin_name = __ms_ini_get_string("node type 1:video capture", DEFAULT_VIDEO_SOURCE);
                node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_VIDEO_TEST:
-               node->gst_element = __ms_element_create(DEFAULT_VIDEO_TEST_SOURCE, NULL);
+               plugin_name = __ms_ini_get_string("node type 1:video test", DEFAULT_VIDEO_TEST_SOURCE);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_AUDIO_TEST:
-               node->gst_element = __ms_element_create(DEFAULT_AUDIO_TEST_SOURCE, NULL);
+               plugin_name = __ms_ini_get_string("node type 1:audio test", DEFAULT_AUDIO_TEST_SOURCE);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SRC_TYPE_CUSTOM:
+               plugin_name = __ms_ini_get_string("node type 1:custom", DEFAULT_APP_SOURCE);
                node->gst_element = __ms_element_create(DEFAULT_APP_SOURCE, NULL);
                __ms_signal_create(&node->sig_list, node->gst_element, "need-data", G_CALLBACK(__ms_src_start_feed_cb), node);
                __ms_signal_create(&node->sig_list, node->gst_element, "enough-data", G_CALLBACK(__ms_src_stop_feed_cb), node);
@@ -254,7 +256,6 @@ int __ms_src_node_create(media_streamer_node_s *node)
        }
 
        MS_SAFE_FREE(plugin_name);
-       __ms_destroy_ini_dictionary(dict);
 
        if (node->gst_element == NULL)
                ret = MEDIA_STREAMER_ERROR_INVALID_OPERATION;
@@ -299,41 +300,44 @@ int __ms_sink_node_create(media_streamer_node_s *node)
        ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "Handle is NULL");
 
        int ret = MEDIA_STREAMER_ERROR_NONE;
-       dictionary *dict = NULL;
        char *plugin_name = NULL;
 
-       __ms_load_ini_dictionary(&dict);
-
        switch (node->subtype) {
        case MEDIA_STREAMER_NODE_SINK_TYPE_FILE:
-               ms_error("Error: not implemented yet");
+               plugin_name = __ms_ini_get_string("node type 2:file", DEFAULT_FILE_SINK);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_RTSP:
-               node->gst_element = __ms_element_create(DEFAULT_UDP_SINK, NULL);
+               plugin_name = __ms_ini_get_string("node type 2:rtsp", DEFAULT_UDP_SINK);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_HTTP:
                ms_error("Error: not implemented yet");
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_AUDIO:
-               plugin_name = __ms_ini_get_string(dict, "sinks:audio_sink", DEFAULT_AUDIO_SINK);
+               plugin_name = __ms_ini_get_string("node type 2:audio", DEFAULT_AUDIO_SINK);
                node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_OVERLAY:
-               plugin_name = __ms_ini_get_string(dict, "sinks:video_sink", DEFAULT_VIDEO_SINK);
+               plugin_name = __ms_ini_get_string("node type 2:overlay", DEFAULT_VIDEO_SINK);
                node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_EVAS:
-               plugin_name = __ms_ini_get_string(dict, "sinks:evas_sink", DEFAULT_EVAS_SINK);
+               plugin_name = __ms_ini_get_string("node type 2:evas", DEFAULT_EVAS_SINK);
                node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_FAKE:
-               node->gst_element = __ms_element_create(DEFAULT_FAKE_SINK, NULL);
+               plugin_name = __ms_ini_get_string("node type 2:fake", DEFAULT_FAKE_SINK);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
                break;
        case MEDIA_STREAMER_NODE_SINK_TYPE_CUSTOM:
-               node->gst_element = __ms_element_create(DEFAULT_APP_SINK, NULL);
-               g_object_set(G_OBJECT(node->gst_element), "emit-signals", TRUE, NULL);
-               __ms_signal_create(&node->sig_list, node->gst_element, "new-sample", G_CALLBACK(__ms_sink_new_buffer_cb), node);
-               __ms_signal_create(&node->sig_list, node->gst_element, "eos", G_CALLBACK(sink_eos), node);
+               plugin_name = __ms_ini_get_string("node type 2:custom", DEFAULT_APP_SINK);
+               node->gst_element = __ms_element_create(plugin_name, NULL);
+               if (node->gst_element) {
+                       g_object_set(G_OBJECT(node->gst_element), "emit-signals", TRUE, NULL);
+                       __ms_signal_create(&node->sig_list, node->gst_element, "new-sample", G_CALLBACK(__ms_sink_new_buffer_cb), node);
+                       __ms_signal_create(&node->sig_list, node->gst_element, "eos", G_CALLBACK(sink_eos), node);
+               }
                break;
        default:
                ms_error("Error: invalid Sink node Type [%d]", node->subtype);
@@ -341,7 +345,6 @@ int __ms_sink_node_create(media_streamer_node_s *node)
        }
 
        MS_SAFE_FREE(plugin_name);
-       __ms_destroy_ini_dictionary(dict);
 
        if (node->gst_element == NULL)
                ret = MEDIA_STREAMER_ERROR_INVALID_OPERATION;
index 818e2089e6cd95e1c65fabfb3e7c70f0f22d5844..b713c05168d0155ec669063c92c23f8f72db14fe 100644 (file)
@@ -75,18 +75,18 @@ format_s format_table[] = {
 
 static void __ms_check_ini_status(void);
 
-gchar *__ms_ini_get_string(dictionary *dict, const char *ini_path, char *default_str)
+gchar *__ms_ini_get_string(const char *ini_path, char *default_str)
 {
        gchar *result_str = NULL;
 
        ms_retvm_if(ini_path == NULL, NULL, "Invalid ini path");
 
-       if (dict == NULL) {
+       if (__ms_get_ini_instance() == NULL) {
                result_str = default_str;
        } else {
                gchar *str = NULL;
-               str = iniparser_getstring(dict, ini_path, default_str);
-               if (str && (strlen(str) > 0) && (strlen(str) < MEDIA_STREAMER_INI_MAX_STRLEN))
+               str = iniparser_getstring(__ms_get_ini_instance(), ini_path, default_str);
+               if (str && (strlen(str) > 0) && (strlen(str) < INI_MAX_STRLEN))
                        result_str = str;
                else
                        result_str = default_str;
@@ -94,45 +94,32 @@ gchar *__ms_ini_get_string(dictionary *dict, const char *ini_path, char *default
        return result_str ? g_strdup(result_str) : NULL;
 }
 
-gboolean __ms_load_ini_dictionary(dictionary **dict)
+dictionary *__ms_get_ini_instance(void)
 {
-       ms_retvm_if(dict == NULL, FALSE, "Handle is NULL");
+       static dictionary *instance = NULL;
+       if (NULL == instance) {
+               dictionary *ms_dict = NULL;
+               __ms_check_ini_status();
 
-       __ms_check_ini_status();
+               /* loading existing ini file */
+               ms_dict = iniparser_load(MEDIA_STREAMER_INI_PATH);
 
-       dictionary *ms_dict = NULL;
-
-       /* loading existing ini file */
-       ms_dict = iniparser_load(MEDIA_STREAMER_INI_PATH);
-
-       /* if no file exists. create one with set of default values */
-       if (!ms_dict) {
-               ms_debug("Could not open ini [%s]. Media-streamer will use default values.", MEDIA_STREAMER_INI_PATH);
-               return FALSE;
-       } else {
-               ms_debug("Open ini file [%s].", MEDIA_STREAMER_INI_PATH);
+               if (!ms_dict)
+                       ms_debug("Could not open ini [%s]. Media-streamer will use default values.", MEDIA_STREAMER_INI_PATH);
+               else
+                       ms_debug("Open ini file [%s].", MEDIA_STREAMER_INI_PATH);
+               instance = ms_dict;
        }
 
-       *dict = ms_dict;
-       return TRUE;
+       return instance;
 }
 
-gboolean __ms_destroy_ini_dictionary(dictionary *dict)
+void __ms_ini_read_list(const char *key, gchar ***list)
 {
-       ms_retvm_if(dict == NULL, FALSE, "Handle is null");
-
-       /* free dict as we got our own structure */
-       iniparser_freedict(dict);
-
-       return TRUE;
-}
-
-void __ms_ini_read_list(dictionary *dict, const char* key, gchar ***list)
-{
-       ms_retm_if(!dict || !list || !key, "Handle is NULL");
+       ms_retm_if(!__ms_get_ini_instance() || !list || !key, "Handle is NULL");
 
        /* Read exclude elements list */
-       gchar *str = iniparser_getstring(dict, key, NULL);
+       gchar *str = iniparser_getstring(__ms_get_ini_instance(), key, NULL);
        if (str && strlen(str) > 0) {
                gchar *strtmp = g_strdup(str);
                g_strstrip(strtmp);
@@ -144,26 +131,24 @@ void __ms_ini_read_list(dictionary *dict, const char* key, gchar ***list)
 
 void __ms_load_ini_settings(media_streamer_ini_t *ini)
 {
-       dictionary *dict = NULL;
-
        /* get ini values */
        memset(ini, 0, sizeof(media_streamer_ini_t));
 
-       if (__ms_load_ini_dictionary(&dict)) {
+       if (__ms_get_ini_instance()) {
                /* general */
-               ini->generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
+               ini->generate_dot = iniparser_getboolean(__ms_get_ini_instance(), "general:generate dot", DEFAULT_GENERATE_DOT);
                if (ini->generate_dot == TRUE) {
-                       gchar *dot_path = iniparser_getstring(dict, "general:dot dir", MEDIA_STREAMER_DEFAULT_DOT_DIR);
+                       gchar *dot_path = iniparser_getstring(__ms_get_ini_instance(), "general:dot dir", MEDIA_STREAMER_DEFAULT_DOT_DIR);
                        ms_debug("generate_dot is TRUE, dot file will be stored into %s", dot_path);
                        g_setenv("GST_DEBUG_DUMP_DOT_DIR", dot_path, FALSE);
                }
 
-               ini->use_decodebin = iniparser_getboolean(dict, "general:use decodebin", DEFAULT_USE_DECODEBIN);
+               ini->use_decodebin = iniparser_getboolean(__ms_get_ini_instance(), "general:use decodebin", DEFAULT_USE_DECODEBIN);
 
                /* Read exclude elements list */
-               __ms_ini_read_list(dict, "general:exclude elements", &ini->exclude_elem_names);
+               __ms_ini_read_list("general:exclude elements", &ini->exclude_elem_names);
                /* Read gstreamer arguments list */
-               __ms_ini_read_list(dict, "general:gstreamer arguments", &ini->gst_args);
+               __ms_ini_read_list("general:gstreamer arguments", &ini->gst_args);
 
        } else {
                /* if dict is not available just fill the structure with default values */
@@ -171,8 +156,6 @@ void __ms_load_ini_settings(media_streamer_ini_t *ini)
                ini->use_decodebin = DEFAULT_USE_DECODEBIN;
        }
 
-       __ms_destroy_ini_dictionary(dict);
-
        /* general */
        ms_debug("Media Streamer param [generate_dot] : %d", ini->generate_dot);
        ms_debug("Media Streamer param [use_decodebin] : %d", ini->use_decodebin);