[0.2.70] fix the wrong captured video size info 89/168589/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 25 Jan 2018 07:56:06 +0000 (16:56 +0900)
committereunhae choi <eunhae1.choi@samsung.com>
Mon, 29 Jan 2018 11:00:33 +0000 (11:00 +0000)
- captured_frame is not used anymore.
- the orientation value is applied to capture->w/h in libmm player.

Change-Id: Idfb5a7a25a18bab2e2c4c757f71528a65b695879
(cherry picked from commit fceeae7afc3243f691e90165e9b8a93091e46017)

legacy/src/legacy_player.c
packaging/mmsvc-player.spec

index 22bafba..9f2216c 100644 (file)
@@ -495,50 +495,33 @@ static int __msg_callback(int message, void *param, void *user_data)
                        ((player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
                break;
        case MM_MESSAGE_VIDEO_CAPTURED: /* 0x110 */
+       {
+               MMPlayerVideoCapture *capture = (MMPlayerVideoCapture *)msg->data;
+
                if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) {
-                       int w;
-                       int h;
-                       MMPlayerVideoCapture *capture = (MMPlayerVideoCapture *)msg->data;
-                       int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_WIDTH, &w, MM_PLAYER_VIDEO_HEIGHT, &h, (char *)NULL);
-                       if (ret != MM_ERROR_NONE && handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) {
-                               LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : Failed to get video size on video captured (0x%x)", __FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED, ret);
+                       if (!capture || !capture->data) {
+                               LOGE("PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : Failed to get capture data", PLAYER_ERROR_VIDEO_CAPTURE_FAILED);
                                err_code = PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
                        } else {
-                               switch (msg->captured_frame.orientation) {
-                               case 0:
-                               case 180:
-                                       {
-                                               /* use video resolution from above */
-                                       }
-                                       break;
-                               case 90:
-                               case 270:
-                                       {
-                                               /* use calculated size during rotation */
-                                               w = msg->captured_frame.width;
-                                               h = msg->captured_frame.height;
-                                       }
-                                       break;
-                               default:
-                                       break;
-                               }
-
-                               LOGI("[%s] captured image width : %d   height : %d", __FUNCTION__, w, h);
+                               LOGI("captured image ori: %d, width: %d, height: %d, size: %d",
+                                                       capture->orientation, capture->width, capture->height, capture->size);
 
                                /* call application callback */
-                               ((player_video_captured_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
-                       }
-
-                       /* capure->data have to be released to avoid mem leak even if _get_attribute got failed. */
-                       if (capture && capture->data) {
-                               g_free(capture->data);
-                               capture->data = NULL;
+                               ((player_video_captured_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])
+                                               (capture->data, capture->width, capture->height, capture->size, handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
                        }
 
                        handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
                        handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
                }
+
+               /* capure->data have to be released to avoid mem leak in all cases. */
+               if (capture && capture->data) {
+                       g_free(capture->data);
+                       capture->data = NULL;
+               }
                break;
+       }
        case MM_MESSAGE_FILE_NOT_SUPPORTED:     /* 0x10f */
                LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED", __FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
                err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
index d0c2b17..e72723d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.69
+Version:    0.2.70
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0