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);
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)
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);
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;
}
"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)
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);
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);
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)
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", ¤t_zoom, NULL);
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);
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)
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);
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;
}