add new functions to control the display of 360 content 67/146367/3
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 28 Aug 2017 07:48:47 +0000 (16:48 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 28 Aug 2017 08:04:12 +0000 (17:04 +0900)
Change-Id: I4493ca421bb307f75fb4ff84915493921c89f312

src/Makefile.am
src/include/mm_player.h
src/include/mm_player_360.h [new file with mode: 0644]
src/mm_player.c

index ee184fe..698793c 100644 (file)
@@ -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) \
index 9a91623..7431abb 100644 (file)
@@ -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 (file)
index 0000000..fb1bae2
--- /dev/null
@@ -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 <mm_types.h>
+
+#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__ */
index c0e53dd..01612b3 100644 (file)
@@ -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;
+}