From: Eunhae Choi Date: Mon, 28 Aug 2017 07:48:47 +0000 (+0900) Subject: add new functions to control the display of 360 content X-Git-Tag: accepted/tizen/unified/20170907.185646~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f2ae6cab1938250175d28d74f94abdc53da1b56;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git add new functions to control the display of 360 content Change-Id: I4493ca421bb307f75fb4ff84915493921c89f312 --- diff --git a/src/Makefile.am b/src/Makefile.am index ee184fe..698793c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,7 +49,8 @@ noinst_HEADERS = include/mm_player_utils.h \ include/mm_player_pd.h \ include/mm_player_tracks.h \ include/mm_player_streaming.h \ - include/mm_player_es.h + include/mm_player_es.h \ + include/mm_player_360.h libmmfplayer_la_LIBADD = $(GST_LIBS) \ $(MMCOMMON_LIBS) \ diff --git a/src/include/mm_player.h b/src/include/mm_player.h index 9a91623..7431abb 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -2298,6 +2298,21 @@ int mm_player_set_streaming_buffering_time(MMHandleType player, int buffer_ms, i int mm_player_get_streaming_buffering_time(MMHandleType player, int *buffer_ms, int *rebuffer_ms); /** + * These functions are to display the 360 video content + */ +int mm_player_360_set_enable(MMHandleType player, bool enable); +int mm_player_360_is_enabled(MMHandleType player, bool *enabled); + +int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch); +int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch); + +int mm_player_360_set_zoom(MMHandleType player, float level); +int mm_player_360_get_zoom(MMHandleType player, float *level); + +int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees); +int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees); + +/** @} */ diff --git a/src/include/mm_player_360.h b/src/include/mm_player_360.h new file mode 100644 index 0000000..fb1bae2 --- /dev/null +++ b/src/include/mm_player_360.h @@ -0,0 +1,50 @@ +/* + * libmm-player + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __MM_PLAYER_360_H__ +#define __MM_PLAYER_360_H__ + +/*======================================================================================= +| INCLUDE FILES | +========================================================================================*/ +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*======================================================================================= +| GLOBAL FUNCTION PROTOTYPES | +========================================================================================*/ + +int _mmplayer_360_set_enable(MMHandleType player, bool enable); +int _mmplayer_360_is_enabled(MMHandleType player, bool *enabled); +int _mmplayer_360_set_direction_of_view(MMHandleType player, float yaw, float pitch); +int _mmplayer_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch); +int _mmplayer_360_set_zoom(MMHandleType player, float level); +int _mmplayer_360_get_zoom(MMHandleType player, float *level); +int _mmplayer_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees); +int _mmplayer_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees); + +#ifdef __cplusplus +} +#endif + +#endif /* __MM_PLAYER_360_H__ */ diff --git a/src/mm_player.c b/src/mm_player.c index c0e53dd..01612b3 100644 --- a/src/mm_player.c +++ b/src/mm_player.c @@ -36,6 +36,7 @@ #include "mm_player_tracks.h" #include "mm_player_es.h" #include "mm_player_sound_focus.h" +#include "mm_player_360.h" int mm_player_create(MMHandleType *player) { @@ -1402,3 +1403,123 @@ int mm_player_get_audio_only(MMHandleType player, bool *audio_only) return result; } + +int mm_player_360_set_enable(MMHandleType player, bool enable) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_set_enable(player, enable); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_is_enabled(MMHandleType player, bool *enabled) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_is_enabled(player, enabled); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_set_direction_of_view(player, yaw, pitch); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(yaw && pitch, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_get_direction_of_view(player, yaw, pitch); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_set_zoom(MMHandleType player, float level) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_set_zoom(player, level); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_get_zoom(MMHandleType player, float *level) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_get_zoom(player, level); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_set_field_of_view(player, horizontal_degrees, vertical_degrees); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +} + +int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(horizontal_degrees && vertical_degrees, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK( player ); + + result = _mmplayer_360_get_field_of_view(player, horizontal_degrees, vertical_degrees); + + MMPLAYER_CMD_UNLOCK( player ); + + return result; +}