[0.6.109] remove state dependency of return value 89/178889/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 14 May 2018 11:07:27 +0000 (20:07 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 14 May 2018 11:07:27 +0000 (20:07 +0900)
Change-Id: Ic3c4c011322344336f2f9a9b94ee151c40e8184b

packaging/libmm-player.spec
src/mm_player_360.c

index 6625078..bd961ac 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.108
+Version:    0.6.109
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index b78679e..c269c4d 100644 (file)
@@ -79,7 +79,6 @@ int _mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
 int _mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
 {
        mm_player_t* player = (mm_player_t*) hplayer;
-       int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -94,16 +93,10 @@ int _mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
                LOGD("set enabled %d", enabled);
                g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "passthrough", !enabled, NULL);
-               return MM_ERROR_NONE;
-       }
-
-       if (player->state >= MM_PLAYER_STATE_READY) {
-               LOGE("the content is not for 360 playback.");
-               ret = MM_ERROR_PLAYER_INTERNAL;
        }
 
        MMPLAYER_FLEAVE();
-       return ret;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
@@ -117,11 +110,6 @@ int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
        LOGD("state %s, spherical info %d",
                        MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), player->is_content_spherical);
 
-       if (player->state < MM_PLAYER_STATE_READY) {
-               *enabled = player->is_video360_enabled;
-               return MM_ERROR_NONE;
-       }
-
        if (player->is_content_spherical && __mmplayer_check_video_360_used(player)) {
                g_object_get(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "passthrough", enabled, NULL);
@@ -131,21 +119,20 @@ int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
                return MM_ERROR_NONE;
        }
 
-       LOGE("the content is not for 360 playback.");
+       *enabled = player->is_video360_enabled;
 
        MMPLAYER_FLEAVE();
-       return MM_ERROR_PLAYER_INTERNAL;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float pitch)
 {
        mm_player_t* player = (mm_player_t*) hplayer;
-       int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       if (yaw > M_PI || yaw < -M_PI || pitch > M_PI_2 || pitch < -M_PI_2) {
+       if (yaw > (float)(M_PI) || yaw < (float)(-M_PI) || pitch > (float)(M_PI_2) || pitch < (float)(-M_PI_2)) {
                LOGE("invalid argument %f, %f", yaw, pitch);
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -169,16 +156,10 @@ int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float p
                                        "source-orientation-y", (int) (yaw * 180.0f / M_PI),
                                        "source-orientation-x", (int) (pitch * 180.0f / M_PI), NULL);
                }
-               return MM_ERROR_NONE;
-       }
-
-       if (player->state >= MM_PLAYER_STATE_READY) {
-               LOGE("the content is not for 360 playback.");
-               ret = MM_ERROR_PLAYER_INTERNAL;
        }
 
        MMPLAYER_FLEAVE();
-       return ret;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float *pitch)
@@ -194,12 +175,6 @@ int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float
        LOGD("state %s, spherical info %d",
                        MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), player->is_content_spherical);
 
-       if (player->state < MM_PLAYER_STATE_READY) {
-               *yaw = player->video360_yaw_radians;
-               *pitch = player->video360_pitch_radians;
-               return MM_ERROR_NONE;
-       }
-
        if (player->is_content_spherical && __mmplayer_check_video_360_used(player)) {
                g_object_get(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "pose-yaw", &yaw_degrees, "pose-pitch", &pitch_degrees, NULL);
@@ -210,16 +185,16 @@ int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float
                return MM_ERROR_NONE;
        }
 
-       LOGE("the content is not for 360 playback.");
+       *yaw = player->video360_yaw_radians;
+       *pitch = player->video360_pitch_radians;
 
        MMPLAYER_FLEAVE();
-       return MM_ERROR_PLAYER_INTERNAL;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_set_zoom(MMHandleType hplayer, float level)
 {
        mm_player_t* player = (mm_player_t*) hplayer;
-       int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -240,16 +215,10 @@ int _mmplayer_360_set_zoom(MMHandleType hplayer, float level)
                LOGD("set level %f", level);
                g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "zoom", 1.0f / level, NULL);
-               return MM_ERROR_NONE;
-       }
-
-       if (player->state >= MM_PLAYER_STATE_READY) {
-               LOGE("the content is not for 360 playback.");
-               ret = MM_ERROR_PLAYER_INTERNAL;
        }
 
        MMPLAYER_FLEAVE();
-       return ret;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
@@ -264,11 +233,6 @@ int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
        LOGD("state %s, spherical info %d",
                        MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), player->is_content_spherical);
 
-       if (player->state < MM_PLAYER_STATE_READY) {
-               *level = player->video360_zoom;
-               return MM_ERROR_NONE;
-       }
-
        if (player->is_content_spherical && __mmplayer_check_video_360_used(player)) {
                g_object_get(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "zoom", &current_zoom, NULL);
@@ -278,16 +242,15 @@ int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
                return MM_ERROR_NONE;
        }
 
-       LOGE("the content is not for 360 playback.");
+       *level = player->video360_zoom;
 
        MMPLAYER_FLEAVE();
-       return MM_ERROR_PLAYER_INTERNAL;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees, int vertical_degrees)
 {
        mm_player_t* player = (mm_player_t*) hplayer;
-       int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -308,16 +271,10 @@ int _mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees
                LOGD("set h-fov %d, v-fov %d", horizontal_degrees, vertical_degrees);
                g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "horizontal-fov", horizontal_degrees, "vertical-fov", vertical_degrees, NULL);
-               return MM_ERROR_NONE;
-       }
-
-       if (player->state >= MM_PLAYER_STATE_READY) {
-               LOGE("the content is not for 360 playback.");
-               ret = MM_ERROR_PLAYER_INTERNAL;
        }
 
        MMPLAYER_FLEAVE();
-       return ret;
+       return MM_ERROR_NONE;
 }
 
 int _mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degrees, int *vertical_degrees)
@@ -331,12 +288,6 @@ int _mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degree
        LOGD("state %s, spherical info %d",
                        MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), player->is_content_spherical);
 
-       if (player->state < MM_PLAYER_STATE_READY) {
-               *horizontal_degrees = player->video360_horizontal_fov;
-               *vertical_degrees = player->video360_vertical_fov;
-               return MM_ERROR_NONE;
-       }
-
        if (player->is_content_spherical && __mmplayer_check_video_360_used(player)) {
                g_object_get(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
                                "horizontal-fov", horizontal_degrees, "vertical-fov", vertical_degrees, NULL);
@@ -345,8 +296,9 @@ int _mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degree
                return MM_ERROR_NONE;
        }
 
-       LOGE("the content is not for 360 playback.");
+       *horizontal_degrees = player->video360_horizontal_fov;
+       *vertical_degrees = player->video360_vertical_fov;
 
        MMPLAYER_FLEAVE();
-       return MM_ERROR_PLAYER_INTERNAL;
+       return MM_ERROR_NONE;
 }