[0.3.63] release internal mem and reset cb 63/137263/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 5 Jul 2017 06:40:58 +0000 (15:40 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 5 Jul 2017 06:44:05 +0000 (15:44 +0900)
- release internal mem and reset cb
  regardless of the result of unprepare
- add new test code to set the accurate value

Change-Id: Ibe4864cce17955bf7f97045703a03d5d463fa17e

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

index dd35593d462516616515272c4de246deaef05ba7..c1712e5a09e61b3848e25894a63be856a1e1d380 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.62
+Version:    0.3.63
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 04be22e1d976e0d651ad11bffdc0a02ac3114344..cbb7d03d24e122d77cee3bbc9bbe5595747e7fd4 100644 (file)
@@ -1917,16 +1917,17 @@ int player_unprepare(player_h player)
                return PLAYER_ERROR_INVALID_STATE;
 
        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);
-               set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-               _player_release_internal_memory(pc);
-       }
+
+       set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
+       set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       _player_release_internal_memory(pc);
 
        pc->cb_info->video_frame_pool_size = 0;
        __player_remove_tsurf_list(pc);
 
        g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
index 9af7f55961f624fa11680204acbb2c62fc14cfad..4bdb6526b7377c9556e189683bcfbe15e5bffe0e 100644 (file)
@@ -131,8 +131,14 @@ enum {
        CURRENT_STATUS_NEXT_URI,
        CURRENT_STATUS_GAPLESS,
        CURRENT_STATUS_GET_TRACK_INFO,
+       CURRENT_STATUS_POSITION_ACCURATE,
 };
 
+typedef struct {
+       int pos;
+       bool accurate;
+} player_seek_pos_t;
+
 #define MAX_HANDLE 20
 
 /* for video display */
@@ -156,7 +162,7 @@ typedef struct {
 
 static appdata ad;
 static player_h g_player[MAX_HANDLE] = { 0, };
-
+static player_seek_pos_t seek_info = {0};
 int g_handle_num = 1;
 int g_menu_state = CURRENT_STATUS_MAINMENU;
 gboolean quit_pushing;
@@ -1373,9 +1379,9 @@ static void get_position()
        g_print("                                                            ==> [Player_Test] player_get_play_position()%d return : %d\n", ret, position);
 }
 
-static void set_position(int position)
+static void set_position(int position, bool accurate)
 {
-       if (player_set_play_position(g_player[0], position, TRUE, seek_completed_cb, g_player[0]) != PLAYER_ERROR_NONE)
+       if (player_set_play_position(g_player[0], position, accurate, seek_completed_cb, g_player[0]) != PLAYER_ERROR_NONE)
                g_print("failed to set position\n");
 }
 
@@ -2009,6 +2015,8 @@ static void displaymenu()
                g_print("*** input mute value.(0: Not Mute, 1: Mute) \n");
        } else if (g_menu_state == CURRENT_STATUS_POSITION_TIME) {
                g_print("*** input position value(msec)\n");
+       } else if (g_menu_state == CURRENT_STATUS_POSITION_ACCURATE) {
+               g_print("*** input accurate value(0/1)\n");
        } else if (g_menu_state == CURRENT_STATUS_LOOPING) {
                g_print("*** input looping value.(0: Not Looping, 1: Looping) \n");
        } else if (g_menu_state == CURRENT_STATUS_DISPLAY_SURFACE_CHANGE) {
@@ -2126,8 +2134,14 @@ static void interpret(char *cmd)
                break;
        case CURRENT_STATUS_POSITION_TIME:
                {
-                       long position = atol(cmd);
-                       set_position(position);
+                       seek_info.pos = atoi(cmd);
+                       g_menu_state = CURRENT_STATUS_POSITION_ACCURATE;
+               }
+               break;
+       case CURRENT_STATUS_POSITION_ACCURATE:
+               {
+                       seek_info.accurate = (atoi(cmd) != 0) ? (true) : (false);
+                       set_position(seek_info.pos, seek_info.accurate);
                        reset_menu_state();
                }
                break;