[0.6.260] fix coverity issue
[platform/core/multimedia/libmm-player.git] / src / mm_player_360.c
index c269c4d..6dfb03a 100644 (file)
@@ -27,7 +27,7 @@
 #include <glib.h>
 
 static bool
-__mmplayer_check_video_360_used(mm_player_t* player)
+__mmplayer_check_video_360_used(mmplayer_t *player)
 {
        /* check video 360 plugin is created */
        MMPLAYER_RETURN_VAL_IF_FAIL(player &&
@@ -41,7 +41,7 @@ __mmplayer_check_video_360_used(mm_player_t* player)
 }
 
 static bool
-__mmplayer_check_audio_sink(mm_player_t* player)
+__mmplayer_check_audio_sink(mmplayer_t *player)
 {
        /* check audio sink is created */
        MMPLAYER_RETURN_VAL_IF_FAIL(player &&
@@ -54,9 +54,10 @@ __mmplayer_check_audio_sink(mm_player_t* player)
        return true;
 }
 
-int _mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
+int
+_mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -76,9 +77,10 @@ int _mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
+int
+_mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -86,22 +88,24 @@ int _mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
        LOGD("state %s, spherical info %d",
                        MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), player->is_content_spherical);
 
-       player->is_video360_enabled = enabled;
+       player->is_video360_enabled = (gboolean)enabled;
 
        if (player->is_content_spherical && __mmplayer_check_video_360_used(player)) {
                /* We will get here if player is pending ready or ready and above */
-               LOGD("set enabled %d", enabled);
+               LOGD("set enabled %d", player->is_video360_enabled);
                g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
-                               "passthrough", !enabled, NULL);
+                               "passthrough", !player->is_video360_enabled, NULL);
        }
 
        MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
+int
+_mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
+       gboolean is_enabled;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -112,22 +116,22 @@ int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
 
        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);
-               *enabled = !(*enabled);
-
-               LOGD("get enabled %d", *enabled);
-               return MM_ERROR_NONE;
+                               "passthrough", &is_enabled, NULL);
+               *enabled = !((bool)is_enabled);
+       } else {
+               *enabled = (bool)player->is_video360_enabled;
        }
 
-       *enabled = player->is_video360_enabled;
+       LOGD("get enabled %d", *enabled);
 
        MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float pitch)
+int
+_mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float pitch)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -148,13 +152,13 @@ int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float p
                if (__mmplayer_check_video_360_used(player)) {
                        LOGD("set yaw %f, pitch %f for video", yaw, pitch);
                        g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
-                                       "pose-yaw", (int) (yaw * 180.0f / M_PI),
-                                       "pose-pitch", (int) (pitch * 180.0f / M_PI), NULL);
+                                       "pose-yaw", (int)(yaw * 180.0f / M_PI),
+                                       "pose-pitch", (int)(pitch * 180.0f / M_PI), NULL);
                }
                if (player->is_openal_plugin_used && __mmplayer_check_audio_sink(player)) {
                        g_object_set(G_OBJECT(player->pipeline->audiobin[MMPLAYER_A_SINK].gst),
-                                       "source-orientation-y", (int) (yaw * 180.0f / M_PI),
-                                       "source-orientation-x", (int) (pitch * 180.0f / M_PI), NULL);
+                                       "source-orientation-y", (int)(yaw * 180.0f / M_PI),
+                                       "source-orientation-x", (int)(pitch * 180.0f / M_PI), NULL);
                }
        }
 
@@ -162,9 +166,10 @@ int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float p
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float *pitch)
+int
+_mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float *pitch)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
        int yaw_degrees = 0;
        int pitch_degrees = 0;
 
@@ -181,7 +186,7 @@ int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float
                *yaw = M_PI * yaw_degrees / 180.0f;
                *pitch = M_PI * pitch_degrees / 180.0f;
 
-               LOGD("get yaw %f, pitch %f", yaw, pitch);
+               LOGD("get yaw %f, pitch %f", *yaw, *pitch);
                return MM_ERROR_NONE;
        }
 
@@ -192,9 +197,10 @@ int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_zoom(MMHandleType hplayer, float level)
+int
+_mmplayer_360_set_zoom(MMHandleType hplayer, float level)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -221,9 +227,10 @@ int _mmplayer_360_set_zoom(MMHandleType hplayer, float level)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
+int
+_mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
        float current_zoom = 0.0;
 
        MMPLAYER_FENTER();
@@ -248,9 +255,10 @@ int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees, int vertical_degrees)
+int
+_mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees, int vertical_degrees)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -277,9 +285,10 @@ int _mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degrees, int *vertical_degrees)
+int
+_mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degrees, int *vertical_degrees)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mmplayer_t *player = (mmplayer_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);