use tbm_bo to send albumart data 85/61685/2 accepted/tizen/common/20160311.201020 accepted/tizen/ivi/20160310.062600 accepted/tizen/mobile/20160310.062435 accepted/tizen/tv/20160310.062504 accepted/tizen/wearable/20160310.062530 submit/tizen/20160310.024054
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 10 Mar 2016 00:39:31 +0000 (09:39 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 10 Mar 2016 00:40:16 +0000 (09:40 +0900)
Change-Id: I444c6d39e02d3f0db98cc774e446254f261b4f65
Signed-off-by: Eunhae Choi <eunhae1.choi@samsung.com>
legacy/test/legacy_player_test.c
muse/src/muse_player_msg_dispatcher.c

index e913807..1e45397 100644 (file)
@@ -322,7 +322,7 @@ int _save(unsigned char *src, int length)
        static int WRITE_COUNT = 0;
 
        /* gchar *filename  = CAPTUERD_IMAGE_SAVE_PATH; */
-       snprintf(filename, 256, "ALBUM_ART_IMAGE_%d", WRITE_COUNT);
+       snprintf(filename, 256, "/tmp/ALBUM_ART_IMAGE_%d", WRITE_COUNT);
        WRITE_COUNT++;
        fp = fopen(filename, "w+");
        if (fp == NULL) {
@@ -1045,6 +1045,7 @@ static void get_stream_info()
        void *album;
        int size;
        legacy_player_get_album_art(g_player[0], &album, &size);
+       _save(album, size);
        g_print("                                                            ==> [Player_Test] Album art : [ data : %p, size : %d ]\n", (unsigned int *)album, size);
        if (value != NULL) {
                free(value);
index e5f6d1a..7703ba5 100644 (file)
@@ -1308,17 +1308,60 @@ static int player_disp_get_album_art(muse_module_h module)
        muse_player_api_e api = MUSE_PLAYER_API_GET_ALBUM_ART;
        void *album_art;
        int size;
+       tbm_bo bo;
+       tbm_bo_handle thandle;
+       tbm_key key;
+       char checker = 1;
+       unsigned int expired = 0x0fffffff;
 
        handle = muse_core_ipc_get_handle(module);
 
        ret = legacy_player_get_album_art((player_h)handle, &album_art, &size);
+       if (ret == PLAYER_ERROR_NONE) {
+               bo = tbm_bo_alloc(bufmgr, size+1, TBM_BO_DEFAULT);
+               if (!bo) {
+                       LOGE("TBM get error : tbm_bo_alloc return NULL");
+                       ret = PLAYER_ERROR_INVALID_OPERATION; /* according to the api desc */
+                       goto exit;
+               }
+               thandle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_WRITE);
+               if (thandle.ptr == NULL) {
+                       LOGE("TBM get error : handle pointer is NULL");
+                       ret = PLAYER_ERROR_INVALID_OPERATION; /* according to the api desc */
+                       tbm_bo_unref(bo);
+                       goto exit;
+               }
 
-       if (ret == PLAYER_ERROR_NONE)
-               player_msg_return_array(api, ret, module, album_art, size, sizeof(char));
+               memcpy(thandle.ptr, album_art, size);
+               /* mark to write */
+               *((char *)thandle.ptr + size) = 1;
+               tbm_bo_unmap(bo);
+
+               key = tbm_bo_export(bo);
+               if (key == 0) {
+                       LOGE("TBM get error : export key is 0");
+                       ret = PLAYER_ERROR_INVALID_OPERATION; /* according to the api desc */
+                       tbm_bo_unref(bo);
+                       goto exit;
+               }
+
+               LOGE("size %d key %d", size, key);
+               player_msg_return2(api, ret, module, INT, size, INT, key);
+
+               while (checker && expired--) {
+                       thandle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
+                       checker = *((char *)thandle.ptr + size);
+                       tbm_bo_unmap(bo);
+               }
+       }
        else
                player_msg_return(api, ret, module);
 
        return ret;
+
+exit:
+       player_msg_return(api, ret, module);
+       return ret;
 }
 
 static int player_disp_get_eq_bands_count(muse_module_h module)