fixup! Fix hanging on pthread_cond_destroy during cancellation of thread by broadcast...
[platform/core/api/sound-pool.git] / test / proxy / src / proxy.c
index deaa36b..8e12559 100644 (file)
@@ -22,7 +22,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#define DEFAULT_MAX_STREAMS_PER_POOL_CNT 25
+#define DEFAULT_MAX_STREAMS_PER_POOL_CNT 25U
+#define DEFAULT_STREAM_PRIORITY_RANK 255U
 #define MICROSECS_PER_MILLISEC 1000
 
 #define MAX_POOL_CNT 100
@@ -34,28 +35,16 @@ static char *messages[MAX_POOL_CNT] = { NULL };
 static char *scripts[MAX_POOL_CNT] = { NULL };
 
 #define MAX_STREAM_CNT 1000
-/* Messages to be used for callbacks output (for pool state changing) */
-static char *stream_messages[MAX_POOL_CNT][MAX_STREAM_CNT] = { NULL };
-/* Messages to be used for callbacks output (for stream state changing) */
-static char *stream_scripts[MAX_POOL_CNT][MAX_STREAM_CNT] = { NULL };
 
+static const char *__stringify_sound_pool_error(sound_pool_error_e error);
 static int __proxy_sound_pool_execute_script(const char *pars);
 
-const char *__stringify_sound_pool_error(sound_pool_error_e error)
+static const char *__stringify_sound_pool_error(sound_pool_error_e error)
 {
        switch (error) {
        case SOUND_POOL_ERROR_NONE:
                return "SOUND_POOL_ERROR_NONE";
                break;
-       case SOUND_POOL_ERROR_NOT_SUPPORTED:
-               return "SOUND_POOL_ERROR_NOT_SUPPORTED";
-               break;
-       case SOUND_POOL_ERROR_MSG_TOO_LONG:
-               return "SOUND_POOL_ERROR_MSG_TOO_LONG";
-               break;
-       case SOUND_POOL_ERROR_NO_DATA:
-               return "SOUND_POOL_ERROR_NO_DATA";
-               break;
        case SOUND_POOL_ERROR_KEY_NOT_AVAILABLE:
                return "SOUND_POOL_ERROR_KEY_NOT_AVAILABLE";
                break;
@@ -68,8 +57,11 @@ const char *__stringify_sound_pool_error(sound_pool_error_e error)
        case SOUND_POOL_ERROR_INVALID_OPERATION:
                return "SOUND_POOL_ERROR_INVALID_OPERATION";
                break;
-       case SOUND_POOL_ERROR_PERMISSION_DENIED:
-               return "SOUND_POOL_ERROR_PERMISSION_DENIED";
+       case SOUND_POOL_ERROR_NOT_PERMITTED:
+               return "SOUND_POOL_ERROR_NOT_PERMITTED";
+               break;
+       case SOUND_POOL_ERROR_NO_SUCH_FILE:
+               return "SOUND_POOL_ERROR_NO_SUCH_FILE";
                break;
        default:
                return "";
@@ -134,7 +126,7 @@ static void __sp_cb_scr(sound_pool_h pool, sound_pool_state_e prev_state,
        __proxy_sound_pool_execute_script(scr);
 }
 
-static void __s_cb_msg(sound_pool_h pool, const char *tag, unsigned id,
+static void __s_cb_msg(sound_pool_h pool, unsigned id,
                sound_pool_stream_state_e prev_state,
                sound_pool_stream_state_e cur_state, void *data)
 {
@@ -145,18 +137,6 @@ static void __s_cb_msg(sound_pool_h pool, const char *tag, unsigned id,
                        msg ? msg : "No message");
 }
 
-static void __s_cb_scr(sound_pool_h pool, const char *tag, unsigned id,
-               sound_pool_stream_state_e prev_state,
-               sound_pool_stream_state_e cur_state, void *data)
-{
-       const char *scr = (const char *)data;
-       _logger_log_info("Sound pool state was changing from %s to %s; "
-                       "Executing: %s...", __stringify_stream_state(prev_state),
-                       __stringify_stream_state(cur_state),
-                       scr ? scr : "No script");
-       __proxy_sound_pool_execute_script(scr);
-}
-
 /* CMD_EXIT */
 static int __exit()
 {
@@ -196,10 +176,6 @@ static int __print_cmd_help_msg()
        printf("\t- sets callback which will show the message when sound pool "
                        "state is changed.\n");
 
-       printf(CMD_SET_POOL_CB_SCRIPT "\n");
-       printf("\t- sets callback which will execute the script when sound pool "
-                       "state is changed.\n");
-
        printf(CMD_UNSET_POOL_CB "\n");
        printf("\t- unsets the callback for the sound pool.\n");
 
@@ -235,35 +211,18 @@ static int __print_cmd_help_msg()
        printf("\t- shows volume of the stream in the pool with specified "
                        "identifiers.\n");
 
-       printf(CMD_SET_STREAM_LOOP "\n");
-       printf("\t- use this command to set loop parameter of the stream.\n");
-
-       printf(CMD_GET_STREAM_LOOP "\n");
-       printf("\t- shows loop count of the stream in the pool with specified "
-                       "identifiers.\n");
-
        printf(CMD_SET_STREAM_PRIORITY "\n");
-       printf("\t- use this command to set priority parameter of the stream.\n");
+       printf("\t- use this command to set priority parameter of the stream. "
+                       "0 is the lowest priority.\n");
 
        printf(CMD_GET_STREAM_PRIORITY "\n");
        printf("\t- shows priority rank of the stream in the pool with specified "
-                       "identifiers.\n");
+                       "identifiers. 0 is the lowest priority.\n");
 
        printf(CMD_GET_STREAM_STATE "\n");
        printf("\t- shows state of the stream in the pool with specified "
                        "identifiers.\n");
 
-       printf(CMD_SET_STREAM_CB_MSG "\n");
-       printf("\t- sets callback which will show the message when sound stream "
-                       "state is changed.\n");
-
-       printf(CMD_SET_STREAM_CB_SCRIPT "\n");
-       printf("\t- sets callback which will execute the script (from file) when "
-                       "sound stream state is changed.\n");
-
-       printf(CMD_UNSET_STREAM_CB "\n");
-       printf("\t- unsets the callback for the sound stream.\n");
-
        printf(CMD_EXECUTE_SCRIPT "\n");
        printf("\t- executes the script from the file in filesystem. Script has to\n"
                        "\t  be compiled with commands supported by testsuite, one command\n"
@@ -282,22 +241,17 @@ static int __print_cmd_help_msg()
 }
 
 /* CMD_CREATE_POOL */
-static int __proxy_sound_pool_create(const char *pars)
+static int __proxy_sound_pool_create()
 {
        _logger_log_info(CMD_CREATE_POOL " command was called");
-
-       unsigned int max_streams = DEFAULT_MAX_STREAMS_PER_POOL_CNT;
-       if (pars != NULL)
-               sscanf(pars, " %u", &max_streams);
-
        _logger_log_info("Creating the pool...");
 
        sound_pool_h pool = NULL;
-       int ret = sound_pool_create(max_streams, &pool);
+       int ret = sound_pool_create(&pool);
 
        if (ret == SOUND_POOL_ERROR_NONE) {
-               _logger_log_info("sound_pool_create(%u, pool) returned %s value",
-                               max_streams, __stringify_sound_pool_error(ret));
+               _logger_log_info("sound_pool_create(pool) returned %s value",
+                               __stringify_sound_pool_error(ret));
 
                size_t idx = 0;
                while (idx < MAX_POOL_CNT) {
@@ -315,12 +269,10 @@ static int __proxy_sound_pool_create(const char *pars)
                                        "restrictions. Destroying the pool...");
 
                        ret = sound_pool_destroy(pool);
-                       if (ret == SOUND_POOL_ERROR_NONE)
-                               _logger_log_info("sound_pool_destroy(pool) returned %s value",
-                                               __stringify_sound_pool_error(ret));
-                       else
-                               _logger_log_err("sound_pool_destroy(pool) returned %s value",
-                                               __stringify_sound_pool_error(ret));
+
+                       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                                       "sound_pool_destroy(pool) returned %s value",
+                                       __stringify_sound_pool_error(ret));
 
                        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
                }
@@ -330,8 +282,8 @@ static int __proxy_sound_pool_create(const char *pars)
                else
                        _logger_log_info("Identifier of the pool has been created is %zu", idx);
        } else {
-               _logger_log_err("sound_pool_create(%u, pool) returned %s value",
-                               max_streams, __stringify_sound_pool_error(ret));
+               _logger_log_err("sound_pool_create(pool) returned %s value",
+                               __stringify_sound_pool_error(ret));
        }
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
@@ -362,12 +314,9 @@ static int __proxy_sound_pool_destroy(const char *pars)
 
        ret = sound_pool_destroy(pools[idx]);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_destroy(pool) returned %s value",
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_destroy(pool) returned %s value",
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_destroy(pool) returned %s value",
+                       __stringify_sound_pool_error(ret));
 
        pools[idx] = NULL;
 
@@ -400,14 +349,9 @@ static int __proxy_sound_pool_activate(const char *pars)
 
        ret = sound_pool_activate(pools[idx]);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_state(pool, "
-                               "SOUND_POOL_STATE_ACTIVE) returned %s value",
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_state(pool, "
-                               "SOUND_POOL_STATE_ACTIVE) returned %s value",
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_set_state(pool, SOUND_POOL_STATE_ACTIVE) returned "
+                       "%s value", __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -437,14 +381,9 @@ static int __proxy_sound_pool_deactivate(const char *pars)
 
        int ret = sound_pool_deactivate(pools[idx]);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_state(pool, "
-                               "SOUND_POOL_STATE_INACTIVE) returned %s value",
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_state(pool, "
-                               "SOUND_POOL_STATE_INACTIVE) returned %s value",
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_set_state(pool, SOUND_POOL_STATE_INACTIVE) returned "
+                       "%s value", __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -478,12 +417,9 @@ static int __proxy_sound_pool_get_state(const char *pars)
        const char *str_state = (state == SOUND_POOL_STATE_ACTIVE ?
                        "SOUND_POOL_STATE_ACTIVE" : "SOUND_POOL_STATE_INACTIVE");
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_get_state(pool, state) returned %s value,"
-                               " state is %s", __stringify_sound_pool_error(ret), str_state);
-       else
-               _logger_log_err("sound_pool_get_state(pool, state) returned %s value,"
-                               " state is %s", __stringify_sound_pool_error(ret), str_state);
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_get_state(pool, state) returned %s value,"
+                       " state is %s", __stringify_sound_pool_error(ret), str_state);
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -518,12 +454,9 @@ static int __proxy_sound_pool_set_volume(const char *pars)
 
        int ret = sound_pool_set_volume(pools[idx], volume);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_global_volume(pool, %f) "
-                               "returned %s value", volume, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_global_volume(pool, %f) "
-                               "returned %s value", volume, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_set_global_volume(pool, %f) returned %s value",
+                       volume, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -555,20 +488,15 @@ static int __proxy_sound_pool_get_volume(const char *pars)
        float volume = .0f;
        int ret = sound_pool_get_volume(pools[idx], &volume);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_get_global_volume(pool, volume) returned "
-                               "%s value, volume is %f", __stringify_sound_pool_error(ret),
-                               volume);
-       else
-               _logger_log_err("sound_pool_get_global_volume(pool, volume) returned "
-                               "%s value, volume is %f", __stringify_sound_pool_error(ret),
-                               volume);
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_get_global_volume(pool, volume) returned %s value, "
+                       "volume is %f", __stringify_sound_pool_error(ret), volume);
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
 
 /* CMD_SET_POOL_CB_MSG */
-static int __proxy_sound_pool_set_state_change_callback_message(const char *pars)
+static int __proxy_sound_pool_set_state_changed_cb_message(const char *pars)
 {
        size_t idx = 0;
 
@@ -599,21 +527,18 @@ static int __proxy_sound_pool_set_state_change_callback_message(const char *pars
                free(messages[idx]);
        messages[idx] = strndup(msg, MAX_MSG_LEN);
 
-       int ret = sound_pool_set_state_change_callback(pools[idx], __sp_cb_msg,
+       int ret = sound_pool_set_state_changed_cb(pools[idx], __sp_cb_msg,
                        messages[idx]);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_state_change_callback(pool, cb, "
-                               "\"%s\") returned %s value", msg, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_state_change_callback(pool, cb, "
-                               "\"%s\") returned %s value", msg, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_set_state_change_callback(pool, cb, \"%s\") "
+                       "returned %s value", msg, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
 
 /* CMD_SET_POOL_CB_SCRIPT */
-static int __proxy_sound_pool_set_state_change_callback_script(const char *pars)
+static int __proxy_sound_pool_set_state_changed_cb_script(const char *pars)
 {
        size_t idx = 0;
 
@@ -644,21 +569,18 @@ static int __proxy_sound_pool_set_state_change_callback_script(const char *pars)
                free(scripts[idx]);
        scripts[idx] = strndup(scr, MAX_MSG_LEN);
 
-       int ret = sound_pool_set_state_change_callback(pools[idx], __sp_cb_scr,
+       int ret = sound_pool_set_state_changed_cb(pools[idx], __sp_cb_scr,
                        scripts[idx]);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_state_change_callback(pool, cb, "
-                               "\"%s\") returned %s value", scr, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_state_change_callback(pool, cb, "
-                               "\"%s\") returned %s value", scr, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_set_state_change_callback(pool, cb, \"%s\") "
+                       "returned %s value", scr, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
 
 /* CMD_UNSET_POOL_CB */
-static int __proxy_sound_pool_unset_state_change_callback(const char *pars)
+static int __proxy_sound_pool_unset_state_changed_cb(const char *pars)
 {
        size_t idx = 0;
        if ((pars == NULL) || (sscanf(pars, " %zu", &idx) < 1)) {
@@ -680,7 +602,7 @@ static int __proxy_sound_pool_unset_state_change_callback(const char *pars)
        if (pools[idx] == NULL)
                _logger_log_warn("Pool to unset callback for is NULL");
 
-       int ret = sound_pool_unset_state_change_callback(pools[idx]);
+       int ret = sound_pool_unset_state_changed_cb(pools[idx]);
 
        if (messages[idx] != NULL)
                free(messages[idx]);
@@ -690,12 +612,9 @@ static int __proxy_sound_pool_unset_state_change_callback(const char *pars)
                free(scripts[idx]);
        scripts[idx] = NULL;
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_unset_state_change_callback(pool) "
-                               "returned %s value", __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_unset_state_change_callback(pool) "
-                               "returned %s value", __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_unset_state_change_callback(pool) "
+                       "returned %s value", __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -760,8 +679,11 @@ static int __proxy_sound_pool_load_source_from_file(const char *pars)
                _logger_log_warn("Pool with specified identifier is NULL");
 
        /* If tag wasn't specified by the user, we will use file path as a tag */
-       if (tag[0] == '\0')
-               strncpy(tag, fname, MAX_PATH_LEN);
+       if (tag[0] == '\0') {
+               strncpy(tag, fname, MAX_PATH_LEN - 1);
+               tag[MAX_PATH_LEN - 1] = '\0';
+       }
+
 
        _logger_log_info(CMD_LOAD_SOURCE " command was called");
        _logger_log_info("Loading source to the pool with %zu identifier from %s file. "
@@ -769,14 +691,9 @@ static int __proxy_sound_pool_load_source_from_file(const char *pars)
 
        int ret = sound_pool_load_source_from_file(pools[idx], fname, tag);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_load_source_from_file(pool, \"%s\", "
-                               "\"%s\") returned %s value", fname, tag,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_load_source_from_file(pool, \"%s\", "
-                               "\"%s\") returned %s value", fname, tag,
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_load_source_from_file(pool, \"%s\", \"%s\") returned "
+                       "%s value", fname, tag, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -810,12 +727,9 @@ static int __proxy_sound_pool_unload_source(const char *pars)
 
        int ret = sound_pool_unload_source(pools[idx], tag);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_unload_source(pool, \"%s\") returned "
-                               "%s value", tag, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_unload_source(pool, \"%s\") returned "
-                               "%s value", tag, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_unload_source(pool, \"%s\") returned "
+                       "%s value", tag, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -826,15 +740,17 @@ static int __proxy_sound_pool_play_stream(const char *pars)
        size_t idx = 0;
        int loop = 0;
        float volume = 1.0f;
-       int rank = 0;
+       unsigned rank = DEFAULT_STREAM_PRIORITY_RANK;
+       sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE;
 
        char tag[MAX_PATH_LEN] = {'\0'};
 
-       if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %i",
-                                            &idx, tag, &loop, &volume, &rank) < 2) {
+       if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %u %u",
+                                                               &idx, tag, &loop, &volume, &rank, &priority_policy) < 2) {
                _printf(CMD_COLOR_RED, "You have to specify at least pool identifier and "
                                "source tag to be played in stream! Format: " CMD_PLAY_STREAM
-                               " <pool id> <source tag> <loop> <volume> <priority rank>... \n");
+                               " <pool id> <source tag> <loop> <volume> <priority rank> <priority_policy>... "
+                               "0 'priority rank' value corresponds to the lowest priority.\n");
                return FAIL;
        }
 
@@ -851,20 +767,20 @@ static int __proxy_sound_pool_play_stream(const char *pars)
        _logger_log_info("Playing stream based on source with '%s' tag from the pool "
                        "with %zu identifier...", tag, idx);
 
-       int stream_idx = 0;
-       int ret = sound_pool_stream_play(pools[idx], tag, loop, volume, rank, NULL,
+       unsigned stream_idx = 0;
+       int ret = sound_pool_stream_play(pools[idx], tag, loop, volume, rank, priority_policy, __s_cb_msg,
                        NULL, &stream_idx);
 
        if (ret == SOUND_POOL_ERROR_NONE) {
-               _logger_log_info("sound_pool_play_stream(pool, \"%s\", %i, %f, %i,"
-                               " NULL, NULL, &stream_idx) returned %s value. "
-                               "Generated identifier is %i", tag, loop, volume, rank,
+               _logger_log_info("sound_pool_play_stream(pool, \"%s\", %i, %f, %u,"
+                               " %u, %p, NULL, &stream_idx) returned %s value. "
+                               "Generated identifier is %i", tag, loop, volume, rank, priority_policy, __s_cb_msg,
                                __stringify_sound_pool_error(ret), stream_idx);
                _printf(CMD_COLOR_GREEN, "Generated stream identifier is %i\n", stream_idx);
        } else {
-               _logger_log_err("sound_pool_play_stream(pool, \"%s\", %i, %f, %i,"
-                               " NULL, NULL, &stream_idx) returned %s value",
-                               tag, loop, volume, rank, __stringify_sound_pool_error(ret));
+               _logger_log_err("sound_pool_play_stream(pool, \"%s\", %i, %f, %u,"
+                               " %u, %p, NULL, &stream_idx) returned %s value",
+                               tag, loop, volume, rank, priority_policy, __s_cb_msg, __stringify_sound_pool_error(ret));
        }
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
@@ -896,12 +812,9 @@ static int __proxy_sound_pool_pause_stream(const char *pars)
 
        int ret = sound_pool_stream_pause(pools[idx], stream_idx);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_pause_stream(pool, %i) returned %s "
-                               "value", stream_idx, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_pause_stream(pool, %i) returned %s "
-                               "value", stream_idx, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_pause_stream(pool, %i) returned %s value",
+                       stream_idx, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -932,12 +845,9 @@ static int __proxy_sound_pool_resume_stream(const char *pars)
 
        int ret = sound_pool_stream_resume(pools[idx], stream_idx);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_resume_stream(pool, %i) returned %s "
-                               "value", stream_idx, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_resume_stream(pool, %i) returned %s "
-                               "value", stream_idx, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_resume_stream(pool, %i) returned %s value",
+                       stream_idx, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -968,12 +878,9 @@ static int __proxy_sound_pool_stop_stream(const char *pars)
 
        int ret = sound_pool_stream_stop(pools[idx], stream_idx);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stop_stream(pool, %i) returned %s "
-                               "value", stream_idx, __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_stop_stream(pool, %i) returned %s "
-                               "value", stream_idx, __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_stop_stream(pool, %i) returned %s value",
+                       stream_idx, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -1009,14 +916,9 @@ static int __proxy_sound_pool_stream_set_volume(const char *pars)
 
        int ret = sound_pool_stream_set_volume(pools[idx], stream_idx, volume_val);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_set_volume(pool, %i, %f) "
-                               "returned %s value", stream_idx, volume_val,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_stream_set_volume(pool, %i, %f) "
-                               "returned %s value", stream_idx, volume_val,
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_stream_set_volume(pool, %i, %f) returned %s value",
+                       stream_idx, volume_val, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -1049,98 +951,9 @@ static int __proxy_sound_pool_stream_get_volume(const char *pars)
        float volume = .0f;
        int ret = sound_pool_stream_get_volume(pools[idx], stream_idx, &volume);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_get_volume(pool, %zu, volume) "
-                               "returned %s value, volume is %f", stream_idx,
-                               __stringify_sound_pool_error(ret), volume);
-       else
-               _logger_log_err("sound_pool_stream_get_volume(pool, %zu, volume) "
-                               "returned %s value, volume is %f", stream_idx,
-                               __stringify_sound_pool_error(ret), volume);
-
-       return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_SET_STREAM_LOOP */
-static int __proxy_sound_pool_stream_set_loop(const char *pars)
-{
-       size_t idx = 0;
-       size_t stream_idx = 0;
-       int loop_val = 1;
-
-       if ((pars == NULL)
-                       || (sscanf(pars, " %zu %zu %i", &idx, &stream_idx, &loop_val) < 3)) {
-               _printf(CMD_COLOR_RED, "You have to specify all following parameters: "
-                               "pool identifier, stream identifier, and loop number! Format: "
-                               CMD_SET_STREAM_LOOP " <pool id> <stream id> <loop num>\n");
-               return FAIL;
-       }
-
-       if (idx > (MAX_POOL_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
-                               MAX_POOL_CNT - 1);
-               return FAIL;
-       }
-
-       if (pools[idx] == NULL)
-               _logger_log_warn("Pool with specified identifier is NULL");
-
-       if (loop_val < 0)
-               _logger_log_warn("Loop number should to be greater than 0, but it's"
-                               "value is %i", loop_val);
-
-       _logger_log_info(CMD_SET_STREAM_LOOP " command was called");
-
-       int ret = sound_pool_stream_set_loop(pools[idx], stream_idx, loop_val);
-
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_set_loop(pool, %zu, %i) "
-                               "returned %s value", stream_idx, loop_val,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_stream_set_loop(pool, %zu, %i) "
-                               "returned %s value", stream_idx, loop_val,
-                               __stringify_sound_pool_error(ret));
-
-       return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_GET_STREAM_LOOP */
-static int __proxy_sound_pool_stream_get_loop(const char *pars)
-{
-       size_t idx = 0;
-       size_t stream_idx = 0;
-       if ((pars == NULL) || (sscanf(pars, " %zu %zu", &idx, &stream_idx) < 2)) {
-               _printf(CMD_COLOR_RED, "You have to specify both pool and stream "
-                               "identifiers after command name! Format: "
-                               CMD_GET_STREAM_LOOP " <pool id> <stream id>\n");
-               return FAIL;
-       }
-
-       if (idx > (MAX_POOL_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
-                               MAX_POOL_CNT - 1);
-               return FAIL;
-       }
-
-       _logger_log_info(CMD_GET_STREAM_LOOP " command was called");
-       _logger_log_info("Getting the stream state by %zu identifier in %zu "
-                       "pool...", stream_idx, idx);
-
-       if (pools[idx] == NULL)
-               _logger_log_warn("Pool where stream should be located is NULL");
-
-       unsigned loop = 0;
-       int ret = sound_pool_stream_get_loop(pools[idx], stream_idx, &loop);
-
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_get_loop(pool, %zu, loop) "
-                               "returned %s value, loop value is %i", stream_idx,
-                               __stringify_sound_pool_error(ret), loop);
-       else
-               _logger_log_err("sound_pool_stream_get_loop(pool, %zu, loop) "
-                               "returned %s value, loop value is %i", stream_idx,
-                               __stringify_sound_pool_error(ret), loop);
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_stream_get_volume(pool, %zu, volume) returned %s value, "
+                       "volume is %f", stream_idx, __stringify_sound_pool_error(ret), volume);
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -1150,10 +963,10 @@ static int __proxy_sound_pool_stream_set_priority(const char *pars)
 {
        size_t idx = 0;
        size_t stream_idx = 0;
-       int rank_val = 0;
+       unsigned rank = 0;
 
        if ((pars == NULL)
-                       || (sscanf(pars, " %zu %zu %i", &idx, &stream_idx, &rank_val) < 3)) {
+                       || (sscanf(pars, " %zu %zu %u", &idx, &stream_idx, &rank) < 3)) {
                _printf(CMD_COLOR_RED, "You have to specify all following parameters: "
                                "pool identifier, stream identifier, and priority rank! Format: "
                                CMD_SET_STREAM_PRIORITY " <pool id> <stream id> <rank>\n");
@@ -1169,22 +982,13 @@ static int __proxy_sound_pool_stream_set_priority(const char *pars)
        if (pools[idx] == NULL)
                _logger_log_warn("Pool with specified identifier is NULL");
 
-       if (rank_val < 0)
-               _logger_log_warn("Priority rank should to be greater or equal 0, but "
-                               "it's value is %i", rank_val);
-
        _logger_log_info(CMD_SET_STREAM_PRIORITY " command was called");
 
-       int ret = sound_pool_stream_set_priority(pools[idx], stream_idx, rank_val);
+       int ret = sound_pool_stream_set_priority(pools[idx], stream_idx, rank);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_set_priority(pool, %zu, %i) "
-                               "returned %s value", stream_idx, rank_val,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_stream_set_priority(pool, %zu, %i) "
-                               "returned %s value", stream_idx, rank_val,
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_stream_set_priority(pool, %zu, %u) returned %s value",
+                       stream_idx, rank, __stringify_sound_pool_error(ret));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -1217,14 +1021,9 @@ static int __proxy_sound_pool_stream_get_priority(const char *pars)
        unsigned rank = 0;
        int ret = sound_pool_stream_get_priority(pools[idx], stream_idx, &rank);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_stream_get_priority(pool, %zu, rank) "
-                               "returned %s value, rank value is %i", stream_idx,
-                               __stringify_sound_pool_error(ret), rank);
-       else
-               _logger_log_err("sound_pool_stream_get_priority(pool, %zu, rank) "
-                               "returned %s value, rank value is %i", stream_idx,
-                               __stringify_sound_pool_error(ret), rank);
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_stream_get_priority(pool, %u, rank) returned %s value, "
+                       "rank value is %u", stream_idx, __stringify_sound_pool_error(ret), rank);
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -1257,181 +1056,10 @@ static int __proxy_sound_pool_get_stream_state(const char *pars)
        sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
        int ret = sound_pool_stream_get_state(pools[idx], stream_idx,  &state);
 
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_get_stream_state(pool, %zu, state) "
-                               "returned %s value, state is %s", stream_idx,
-                               __stringify_sound_pool_error(ret),
-                               __stringify_stream_state(state));
-       else
-               _logger_log_err("sound_pool_get_stream_state(pool, %zu, state) "
-                               "returned %s value, state is %s", stream_idx,
-                               __stringify_sound_pool_error(ret),
-                               __stringify_stream_state(state));
-
-       return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_SET_STREAM_CB_MSG */
-static int __proxy_sound_pool_set_stream_state_change_callback_message(const char *pars)
-{
-       size_t idx = 0;
-       size_t stream_idx = 0;
-
-       char msg[MAX_MSG_LEN] = { '\0' };
-
-       if ((pars == NULL) || sscanf(pars, " %zu %zu %"MAX_MSG_LEN_STR"[^ ]",
-                                            &idx, &stream_idx, msg) < 3) {
-               _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
-                               "pool and stream, plus message to be shown each time when "
-                               "state of the stream is changed! Message should be a single "
-                               "word. Format: "
-                               CMD_SET_STREAM_CB_MSG " <pool id> <stream id> <message>\n");
-               return FAIL;
-       }
-
-       if (idx > (MAX_POOL_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
-                               MAX_POOL_CNT - 1);
-               return FAIL;
-       }
-
-       if (stream_idx > (MAX_STREAM_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Stream identifier value can't be greater than %d\n",
-                               MAX_STREAM_CNT - 1);
-               return FAIL;
-       }
-
-       _logger_log_info(CMD_SET_STREAM_CB_MSG " command was called");
-       _logger_log_info("Set state changing callback (%s message) for stream %zu "
-                       "in pool with %zu identifier...", msg, stream_idx, idx);
-
-       if (pools[idx] == NULL)
-               _logger_log_warn("Pool with stream to set callback for is NULL");
-
-       if (stream_messages[idx][stream_idx])
-               free(stream_messages[idx][stream_idx]);
-       stream_messages[idx][stream_idx] = strndup(msg, MAX_MSG_LEN);
-
-       int ret = sound_pool_stream_set_state_change_callback(pools[idx], stream_idx,
-                       __s_cb_msg, stream_messages[idx][stream_idx]);
-
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_stream_state_change_callback(pool, "
-                               "%zu, cb, \"%s\") returned %s value", stream_idx, msg,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_stream_state_change_callback(pool, "
-                               "%zu, cb, \"%s\") returned %s value", stream_idx, msg,
-                               __stringify_sound_pool_error(ret));
-
-       return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_SET_STREAM_CB_SCRIPT */
-static int __proxy_sound_pool_set_stream_state_change_callback_script(const char *pars)
-{
-       size_t idx = 0;
-       size_t stream_idx = 0;
-
-       char scr[MAX_MSG_LEN] = { '\0' };
-
-       if ((pars == NULL) || sscanf(pars, " %zu %zu %"MAX_MSG_LEN_STR"[^ ]",
-                                                &idx, &stream_idx, scr) < 3) {
-               _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
-                               "pool and stream, plus file with script to be executed each "
-                               "time when state of the stream is changed! Message should be a "
-                               "single word. Format: " CMD_SET_STREAM_CB_SCRIPT
-                               " <pool id> <stream id> <script file>\n");
-               return FAIL;
-       }
-
-       if (idx > (MAX_POOL_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
-                               MAX_POOL_CNT - 1);
-               return FAIL;
-       }
-
-       if (stream_idx > (MAX_STREAM_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Stream identifier value can't be greater than %d\n",
-                               MAX_STREAM_CNT - 1);
-               return FAIL;
-       }
-
-       _logger_log_info(CMD_SET_STREAM_CB_SCRIPT " command was called");
-       _logger_log_info("Set state changing callback (%s script) for stream %zu "
-                       "in pool with %zu identifier...", scr, stream_idx, idx);
-
-       if (pools[idx] == NULL)
-               _logger_log_warn("Pool with stream to set callback for is NULL");
-
-       if (stream_scripts[idx][stream_idx])
-               free(stream_scripts[idx][stream_idx]);
-       stream_scripts[idx][stream_idx] = strndup(scr, MAX_MSG_LEN);
-
-       int ret = sound_pool_stream_set_state_change_callback(pools[idx], stream_idx,
-                       __s_cb_scr, stream_scripts[idx][stream_idx]);
-
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_set_stream_state_change_callback(pool, "
-                               "%zu, cb, \"%s\") returned %s value", stream_idx, scr,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_err("sound_pool_set_stream_state_change_callback(pool, "
-                               "%zu, cb, \"%s\") returned %s value", stream_idx, scr,
-                               __stringify_sound_pool_error(ret));
-
-       return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_UNSET_STREAM_CB */
-static int __proxy_sound_pool_unset_stream_state_change_callback(const char *pars)
-{
-       size_t idx = 0;
-       size_t stream_idx = 0;
-       if ((pars == NULL) || (sscanf(pars, " %zu %zu", &idx, &stream_idx) < 2)) {
-               _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
-                               " pool and stream! Format: " CMD_UNSET_STREAM_CB
-                               " <pool id> <stream id>\n");
-               return FAIL;
-       }
-
-       if (idx > (MAX_POOL_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
-                               MAX_POOL_CNT - 1);
-               return FAIL;
-       }
-
-       _logger_log_info(CMD_UNSET_STREAM_CB " command was called");
-       _logger_log_info("Unset state changing callback for the stream %zu in pool "
-                       "with %zu identifier...", stream_idx, idx);
-
-       if (pools[idx] == NULL)
-               _logger_log_warn("Pool to unset callback for is NULL");
-
-       int ret = sound_pool_stream_unset_state_change_callback(pools[idx], stream_idx);
-
-       if (stream_idx > (MAX_STREAM_CNT - 1)) {
-               _printf(CMD_COLOR_RED, "Stream identifier value can't be greater than %d\n",
-                               MAX_STREAM_CNT - 1);
-               return FAIL;
-       }
-
-       if (stream_messages[idx][stream_idx] != NULL)
-               free(stream_messages[idx][stream_idx]);
-       stream_messages[idx][stream_idx] = NULL;
-
-       if (stream_scripts[idx][stream_idx] != NULL)
-               free(stream_scripts[idx][stream_idx]);
-       stream_scripts[idx][stream_idx] = NULL;
-
-       if (ret == SOUND_POOL_ERROR_NONE)
-               _logger_log_info("sound_pool_unset_stream_state_change_callback(pool, "
-                               "%zu) returned %s value", stream_idx,
-                               __stringify_sound_pool_error(ret));
-       else
-               _logger_log_info("sound_pool_unset_stream_state_change_callback(pool, "
-                               "%zu) returned %s value", stream_idx,
-                               __stringify_sound_pool_error(ret));
+       PRINT_INFO_OR_ERROR_INFO(ret == SOUND_POOL_ERROR_NONE,
+                       "sound_pool_get_stream_state(pool, %zu, state) returned %s value, "
+                       "state is %s", stream_idx, __stringify_sound_pool_error(ret),
+                       __stringify_stream_state(state));
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
 }
@@ -1439,8 +1067,6 @@ static int __proxy_sound_pool_unset_stream_state_change_callback(const char *par
 /* CMD_SLEEP */
 static int __proxy_sleep(const char *pars)
 {
-       int ret = SOUND_POOL_ERROR_NONE;
-
        useconds_t stime = 0;
 
        if ((pars == NULL) || (sscanf(pars, " %u", &stime) < 1)) {
@@ -1455,7 +1081,7 @@ static int __proxy_sleep(const char *pars)
        usleep(stime);
        _logger_log_info("Main thread sleep has been finished...", stime);
 
-       return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
+       return OK;
 }
 
 /* CMD_EXECUTE_SCRIPT */
@@ -1487,6 +1113,8 @@ static int __proxy_sound_pool_execute_script(const char *pars)
                                                "Line was skipped.");
                }
                _logger_log_info("Lines were read...");
+               if (line)
+                   free(line);
        } else {
                _logger_log_err("File wasn't loaded...");
                return FAIL;
@@ -1502,7 +1130,7 @@ static int __proxy_sound_pool_execute_script(const char *pars)
 
 /* Number of parameters supported by each command */
 static int cmd_pars[MAX_COMMAND_LINE_LEN] = { /* CMD_EXIT */ 0,
-               /* CMD_HELP */ 0, /* CMD_CREATE_POOL */ 1, /* CMD_DESTROY_POOL */ 1,
+               /* CMD_HELP */ 0, /* CMD_CREATE_POOL */ 0, /* CMD_DESTROY_POOL */ 1,
                /* CMD_ACTIVATE_POOL */ 1, /* CMD_DEACTIVATE_POOL */ 1,
                /* CMD_GET_POOL_STATE */ 1, /* CMD_SET_POOL_VOLUME */ 2,
                /* CMD_GET_POOL_VOLUME */ 2, /* CMD_SET_POOL_CB_MSG */ 2,
@@ -1512,11 +1140,10 @@ static int cmd_pars[MAX_COMMAND_LINE_LEN] = { /* CMD_EXIT */ 0,
                /* CMD_PLAY_STREAM */ 5, /* CMD_STOP_STREAM */ 2,
                /* CMD_PAUSE_STREAM */ 2, /* CMD_RESUME_STREAM */ 2,
                /* CMD_SET_STREAM_VOLUME */ 3, /* CMD_GET_STREAM_VOLUME */ 2,
-               /* CMD_SET_STREAM_LOOP */ 3, /* CMD_GET_STREAM_LOOP */ 2,
                /* CMD_SET_STREAM_PRIORITY */ 3, /* CMD_GET_STREAM_PRIORITY */ 2,
                /* CMD_GET_STREAM_STATE */ 2, /* CMD_SET_STREAM_CB_MSG */ 3,
                /* CMD_SET_STREAM_CB_SCRIPT */ 3, /* CMD_UNSET_STREAM_CB */ 2,
-               /* CMD_EXECUTE_SCRIPT */ 1, /* CMD_SLEEP */ 1 };
+               /* CMD_EXECUTE_SCRIPT */ 1, /* CMD_SLEEP */ 1 };
 
 /* Command -> Function mapping */
 static int (*cmd_fcns[MAX_COMMAND_LINE_LEN])() = {
@@ -1529,9 +1156,9 @@ static int (*cmd_fcns[MAX_COMMAND_LINE_LEN])() = {
                /* CMD_GET_POOL_STATE */ __proxy_sound_pool_get_state,
                /* CMD_SET_POOL_VOLUME */ __proxy_sound_pool_set_volume,
                /* CMD_GET_POOL_VOLUME */ __proxy_sound_pool_get_volume,
-               /* CMD_SET_POOL_CB_MSG */ __proxy_sound_pool_set_state_change_callback_message,
-               /* CMD_SET_POOL_CB_SCRIPT */ __proxy_sound_pool_set_state_change_callback_script,
-               /* CMD_UNSET_POOL_CB */ __proxy_sound_pool_unset_state_change_callback,
+               /* CMD_SET_POOL_CB_MSG */ __proxy_sound_pool_set_state_changed_cb_message,
+               /* CMD_SET_POOL_CB_SCRIPT */ __proxy_sound_pool_set_state_changed_cb_script,
+               /* CMD_UNSET_POOL_CB */ __proxy_sound_pool_unset_state_changed_cb,
                /* CMD_LIST_POOL */ __proxy_sound_pool_list,
                /* CMD_LOAD_SOURCE */ __proxy_sound_pool_load_source_from_file,
                /* CMD_LOAD_MEDIA_PACKAGE */ NULL,
@@ -1542,15 +1169,10 @@ static int (*cmd_fcns[MAX_COMMAND_LINE_LEN])() = {
                /* CMD_RESUME_STREAM */ __proxy_sound_pool_resume_stream,
                /* CMD_SET_STREAM_VOLUME */ __proxy_sound_pool_stream_set_volume,
                /* CMD_GET_STREAM_VOLUME */ __proxy_sound_pool_stream_get_volume,
-               /* CMD_SET_STREAM_LOOP */ __proxy_sound_pool_stream_set_loop,
-               /* CMD_GET_STREAM_LOOP */ __proxy_sound_pool_stream_get_loop,
                /* CMD_SET_STREAM_PRIORITY */ __proxy_sound_pool_stream_set_priority,
                /* CMD_GET_STREAM_PRIORITY */ __proxy_sound_pool_stream_get_priority,
                /* CMD_GET_STREAM_STATE */ __proxy_sound_pool_get_stream_state,
-               /* CMD_SET_STREAM_CB_MSG */ __proxy_sound_pool_set_stream_state_change_callback_message,
-               /* CMD_SET_STREAM_CB_SCRIPT */ __proxy_sound_pool_set_stream_state_change_callback_script,
-               /* CMD_UNSET_STREAM_CB */ __proxy_sound_pool_unset_stream_state_change_callback,
-               /* CMD_EXECUTE_SCRIPT */ __proxy_sound_pool_execute_script,
+               /* CMD_EXECUTE_SCRIPT */ __proxy_sound_pool_execute_script,
                /* CMD_SLEEP */ __proxy_sleep };
 
 int _exec_cmd(const char *cmd_line)
@@ -1559,10 +1181,10 @@ int _exec_cmd(const char *cmd_line)
        if (strlen(cmd_line) == 0) return OK;
 
        size_t trim_len = 0;
-       while((cmd_line + trim_len)[0] == ' ')
+       while ((cmd_line + trim_len)[0] == ' ')
                trim_len++;
 
-       char *cmd = cmd_line + trim_len;
+       const char *cmd = cmd_line + trim_len;
 
        /* Macro for checking command correctness */
 #   define CHECK_CMD(ccmd, line) \