[0.3.57] Modify player and player_test for supporting prepare() after unprepare() 98/126798/1
authorHyunil <hyunil46.park@samsung.com>
Tue, 25 Apr 2017 05:37:02 +0000 (14:37 +0900)
committerHyunil <hyunil46.park@samsung.com>
Tue, 25 Apr 2017 05:37:02 +0000 (14:37 +0900)
Change-Id: I049db7d23a1f0c2faab2f294081207e91f55e46d
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
include/player_msg.h
packaging/capi-media-player.spec
src/player.c
test/player_test.c

index 3f0df8d..d11ba07 100644 (file)
@@ -628,10 +628,11 @@ do {      \
  * @brief Create and send message. Does not wait server result.
  * @remarks Does NOT guarantee thread safe.
  * @param[in] api The enum of module API.
- * @param[in] player The server side handle of media player.
  * @param[in] fd socket fd
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
+ * @param[in] type1 The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
+ * @param[in] param1 the name of param is key, must be local variable. never be pointer.
+ * @param[in] type2 The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
+ * @param[in] param2 the name of param is key, must be local variable. never be pointer.
  */
 #define player_msg_create_handle(api, fd, type1, param1, type2, param2) \
        do {    \
index 0998d9f..00b5af5 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.56
+Version:    0.3.57
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 4be7e6d..c059cda 100644 (file)
@@ -2047,14 +2047,7 @@ int player_unprepare(player_h player)
 
        if (!CALLBACK_INFO(pc))
                return PLAYER_ERROR_INVALID_STATE;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-       if (EVAS_HANDLE(pc)) {
-               player_unset_media_packet_video_frame_decoded_cb(player);
-               if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
-                       LOGW("fail to unset evas client");
-               __player_unset_retrieve_buffer_cb(player);
-       }
-#endif
+
        player_msg_send(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
@@ -2773,11 +2766,16 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
 
                                if (EVAS_HANDLE(pc)) {
                                        LOGW("evas client already exists");
+                                       if (CALLBACK_INFO(pc))
+                                               player_unset_media_packet_video_frame_decoded_cb(player);
                                        if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
                                                LOGW("fail to unset evas client");
+                                       __player_unset_retrieve_buffer_cb(player);
+                                       g_free(pc->cb_info->evas_info);
                                        /* need to set display information again to new handle */
                                        EVAS_INFO(pc)->update_needed = TRUE;
                                }
+
                                if (mm_evas_renderer_create(&EVAS_HANDLE(pc), obj) != MM_ERROR_NONE) {
                                        LOGW("fail to set evas client");
                                        return PLAYER_ERROR_INVALID_OPERATION;
index 473e031..c203775 100644 (file)
@@ -945,8 +945,8 @@ static void _player_prepare(bool async)
                player_set_subtitle_updated_cb(g_player[0], subtitle_updated_cb, (void *)g_player[0]);
        }
        if (g_current_surface_type == -1) {
-               player_set_display(g_player[0], PLAYER_DISPLAY_TYPE_OVERLAY, GET_DISPLAY(selected_win_id));
-               g_current_surface_type = PLAYER_DISPLAY_TYPE_OVERLAY;
+               g_print("You must set display surface type before setting prepare.\n");
+               return;
        }
 
        if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
@@ -1072,9 +1072,7 @@ static void _player_unprepare()
                        }
                }
        }
-       /* attention! surface(evas) -> unprepare -> surface(evas) : evas object will disappear. */
-       reset_display();
-       g_current_surface_type = -1;
+
        memset(g_subtitle_uri, 0, sizeof(g_subtitle_uri));
        player_state_e state;
        if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
@@ -1093,11 +1091,8 @@ static void _player_destroy()
        int i = 0;
 
        if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
-               player_unprepare(g_player[0]);
-               for (i = 0; i < g_handle_num; i++) {
-                       player_destroy(g_player[i]);
-                       g_player[i] = 0;
-               }
+               player_destroy(g_player[0]);
+               g_player[0] = 0;
        } else {
                for (i = 0; i < g_handle_num; i++) {
                        if (g_player[i] != NULL) {
@@ -1782,18 +1777,15 @@ static void get_audio_eq()
 
 void quit_program()
 {
-       int i = 0;
 
        if (g_pcm_fd)
                fclose(g_pcm_fd);
 
-       for (i = 0; i < g_handle_num; i++) {
-               if (g_player[i] != NULL) {
-                       player_unprepare(g_player[i]);
-                       player_destroy(g_player[i]);
-                       g_player[i] = 0;
-               }
+       if (g_player[0] != NULL || g_player[1] != NULL) {
+               _player_unprepare();
+               _player_destroy();
        }
+
        elm_exit();
 
        if (g_audio_fmt)
@@ -1885,9 +1877,17 @@ void _interpret_main_menu(char *cmd)
        } else if (len == 2) {
                if (strncmp(cmd, "pr", 2) == 0) {
                        /* sync */
-                       _player_prepare(FALSE);
+                       if (g_current_surface_type == -1) {
+                               g_print("You must set display surface type before setting prepare. please 'pr' after setting display surface type.\n");
+                               g_menu_state = CURRENT_STATUS_DISPLAY_SURFACE_CHANGE;
+                       } else
+                               _player_prepare(FALSE);
                } else if (strncmp(cmd, "pa", 2) == 0) {
                        /* async */
+                       if (g_current_surface_type == -1) {
+                               g_print("You must set display surface type before setting prepare. please 'pr' after setting display surface type.\n");
+                               g_menu_state = CURRENT_STATUS_DISPLAY_SURFACE_CHANGE;
+                       } else
                        _player_prepare(TRUE);
                } else if (strncmp(cmd, "un", 2) == 0) {
                        _player_unprepare();