[0.3.50] check the state in player_set_display 59/116959/1
authorGilbok Lee <gilbok.lee@samsung.com>
Mon, 20 Feb 2017 11:07:36 +0000 (20:07 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 2 Mar 2017 06:34:17 +0000 (15:34 +0900)
Change-Id: If863b02985a56c97139de76726d96d414408437d

packaging/capi-media-player.spec
src/player.c

index a35627f8b72db1bef71ae21a9a3e6928aa07d51f..22d1da5649cdb2810d90555da6fb2205b71915f8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.49
+Version:    0.3.50
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 513c9e013a88dd07053481be6d3285ba4a28f412..319df222ac263be3b00f17a9a9953819390cdffa 100755 (executable)
@@ -2631,6 +2631,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
        Ecore_Wl_Window *wl_window = NULL;
        Evas *e;
        player_private_display_type_e conv_type;
+       player_state_e state = PLAYER_STATE_NONE;
 
        /* init */
        wl_win.wl_window_x = 0;
@@ -2644,6 +2645,24 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                 LOGW("DEPRECATION WARNING: display type(%d) is deprecated and will be removed from next release. Use newly defined type value instead.", type);
        }
 
+       player_msg_send(MUSE_PLAYER_API_GET_STATE, pc, ret_buf, ret);
+
+       /* check player state */
+       if (ret == PLAYER_ERROR_NONE) {
+               player_msg_get(state, ret_buf);
+               g_free(ret_buf);
+               ret_buf = NULL;
+
+               if (state > PLAYER_STATE_IDLE) {
+                       LOGE("Invalid state %d", state);
+                       return PLAYER_ERROR_INVALID_STATE;
+               }
+       } else {
+               g_free(ret_buf);
+               ret_buf = NULL;
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
        ret = _player_convert_display_type(type, &conv_type);
        if (ret != PLAYER_ERROR_NONE)
                return ret;