change codes to function such as ttsd_player_clear 32/221032/1
authorwn.jang <wn.jang@samsung.com>
Thu, 26 Dec 2019 10:31:57 +0000 (19:31 +0900)
committerwn.jang <wn.jang@samsung.com>
Thu, 26 Dec 2019 10:31:57 +0000 (19:31 +0900)
Change-Id: I7de5c91a82970b0113c3e543f61b81ed787e2f5c

server/ttsd_player.c

index a59fe2a..c96ed44 100644 (file)
@@ -1172,17 +1172,10 @@ int ttsd_player_play(int uid)
 
 int ttsd_player_stop(int uid)
 {
 
 int ttsd_player_stop(int uid)
 {
-       if (false == g_player_init) {
-               SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Not Initialized");
-               return -1;
-       }
-
-       /* Check uid */
-       player_s* current;
-       current = __player_get_item(uid);
-       if (NULL == current) {
-               SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] uid(%d) is not valid", uid);
-               return -1;
+       int ret = ttsd_player_clear(uid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to stop player, ret(%d)", ret);
+               return ret;
        }
 
        /* check whether uid is current playing or not */
        }
 
        /* check whether uid is current playing or not */
@@ -1195,23 +1188,6 @@ int ttsd_player_stop(int uid)
                SLOG(LOG_DEBUG, tts_tag(), "[Player] No current playing");
        }
 
                SLOG(LOG_DEBUG, tts_tag(), "[Player] No current playing");
        }
 
-       if (true == current->is_paused_data) {
-               if (NULL != current->paused_data) {
-                       if (NULL != current->paused_data->data) {
-                               free(current->paused_data->data);
-                               current->paused_data->data = NULL;
-                       }
-
-                       free(current->paused_data);
-                       current->paused_data = NULL;
-               }
-       }
-
-       current->event = TTSE_RESULT_EVENT_FINISH;
-       current->state = APP_STATE_READY;
-       current->is_paused_data = false;
-       current->idx = 0;
-
        if (NULL == g_playing_info) {
                SLOG(LOG_DEBUG, tts_tag(), "[Player] @@@@@");
                SLOG(LOG_ERROR, tts_tag(), "[Player] Active thread count : %d", ecore_thread_active_get());
        if (NULL == g_playing_info) {
                SLOG(LOG_DEBUG, tts_tag(), "[Player] @@@@@");
                SLOG(LOG_ERROR, tts_tag(), "[Player] Active thread count : %d", ecore_thread_active_get());