screenmirror: init screenmirror
[platform/core/api/efl-util.git] / include / efl_util_screenshot_extension.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_UI_EFL_UTIL_SCREENSHOT_EXTENSION_H__
18 #define __TIZEN_UI_EFL_UTIL_SCREENSHOT_EXTENSION_H__
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #ifdef __GNUC__
25 # if __GNUC__ >= 4
26 #  ifndef API
27 #   define API __attribute__ ((visibility("default")))
28 #  endif
29 # endif
30 #endif
31
32 /**
33  * @file efl_util_screenshot_extension.h
34  */
35
36 /**
37  * @addtogroup CAPI_EFL_UTIL_MODULE
38  * @{
39  */
40
41 /**
42  * @platform
43  * @brief Set auto rotation value for screenshot.
44  * @since_tizen 4.0
45  * @privlevel platform
46  * @privilege %http://tizen.org/privilege/screenshot
47  * @param[in]  screenshot  efl_util_screenshot_h handle
48  * @param[in]  set  auto rotation value (1:use auto rotation, 0:don't use auto rotation)
49  * @return @c 0 on success, otherwise a negative error value
50  * @retval #EFL_UTIL_ERROR_NONE Successful
51  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
52  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenshot
53  * @see efl_util_screenshot_get_auto_rotation()
54  */
55 API int efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, int set);
56
57 /**
58  * @platform
59  * @brief Get current auto rotation value of screenshot.
60  * @since_tizen 4.0
61  * @privlevel platform
62  * @privilege %http://tizen.org/privilege/screenshot
63  * @param[in]  screenshot  efl_util_screenshot_h handle
64  * @param[out]  set  The current auto rotation value of screenshot
65  * @return @c 0 on success, otherwise a negative error value
66  * @retval #EFL_UTIL_ERROR_NONE Successful
67  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
68  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenshot
69  * @see efl_util_screenshot_set_auto_rotation()
70  */
71 API int efl_util_screenshot_get_auto_rotation(efl_util_screenshot_h screenshot, int *set);
72
73 /**
74  * @platform
75  * @brief Definition for the screenmirror handle.
76  * @since_tizen 7.0
77  */
78 typedef struct _efl_util_screenmirror_h * efl_util_screenmirror_h;
79
80 /**
81  * @brief The screenmirror handler
82  * @details This handler will be called when mirror buffer is received.
83  * @since_tizen 7.0
84  */
85 typedef void (*efl_util_screenmirror_handler)(efl_util_screenmirror_h screenmirror,
86                                               tbm_surface_h t_surface, void *user_data);
87
88 /**
89  * @platform
90  * @brief Initializes a screenmirror.
91  * @since_tizen 7.0
92  * @privlevel platform
93  * @privilege %http://tizen.org/privilege/screenshot
94  * @remarks The specific error code can be obtained using the get_last_result()
95  * method. Error codes are described in Exception section.
96  * @param[in] width width of the screenmirror surface
97  * @param[in] height height of the screenmirror surface
98  * @return #efl_util_screenmirror_h on success, otherwise @c NULL
99  * @retval #efl_util_screenmirror_h The screenmirror handle
100  * @exception #EFL_UTIL_ERROR_NONE Successful
101  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
102  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
103  * @exception #EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL Initialization failure
104  * @exception #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenmirror
105  * @see efl_util_screenmirror_deinitialize()
106  */
107 API efl_util_screenmirror_h efl_util_screenmirror_initialize(int width, int height);
108
109 /**
110  * @platform
111  * @brief Deinitializes the screenmirror.
112  * @since_tizen 7.0
113  * @privlevel platform
114  * @privilege %http://tizen.org/privilege/screenshot
115  * @param[in]  screenmirror  #efl_util_screenmirror_h handle
116  * @return @c 0 on success, otherwise a negative error value
117  * @retval #EFL_UTIL_ERROR_NONE Successful
118  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
119  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenmirror
120  * @see efl_util_screenmirror_initialize()
121  */
122 API int efl_util_screenmirror_deinitialize(efl_util_screenmirror_h screenmirror);
123
124 /**
125  * @platform
126  * @brief Set handler to get screenmirror buffer.
127  * @since_tizen 7.0
128  * @privlevel platform
129  * @privilege %http://tizen.org/privilege/screenshot
130  * @param[in]  screenmirror  #efl_util_screenmirror_h handle
131  * @param[in]  func  mirror buffer get handler
132  * @param[in]  data  user data
133  * @return @c 0 on success, otherwise a negative error value
134  * @retval #EFL_UTIL_ERROR_NONE Successful
135  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
136  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenmirror
137  * @see efl_util_screenmirror_initialize()
138  */
139 API int efl_util_screenmirror_set_handler(efl_util_screenmirror_h screenmirror,
140                                           efl_util_screenmirror_handler func, void *data);
141
142 /**
143  * @platform
144  * @brief Start the screenmirror.
145  * @since_tizen 7.0
146  * @privlevel platform
147  * @privilege %http://tizen.org/privilege/screenshot
148  * @param[in]  screenmirror  #efl_util_screenmirror_h handle
149  * @return @c 0 on success, otherwise a negative error value
150  * @retval #EFL_UTIL_ERROR_NONE Successful
151  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
152  * @retval #EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL Execution failure
153  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenmirror
154  * @see efl_util_screenmirror_initialize()
155  */
156 API int efl_util_screenmirror_start(efl_util_screenmirror_h screenmirror);
157
158 /**
159  * @platform
160  * @brief Stop the screenmirror.
161  * @since_tizen 7.0
162  * @privlevel platform
163  * @privilege %http://tizen.org/privilege/screenshot
164  * @param[in]  screenmirror  #efl_util_screenmirror_h handle
165  * @return @c 0 on success, otherwise a negative error value
166  * @retval #EFL_UTIL_ERROR_NONE Successful
167  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
168  * @retval #EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL Execution failure
169  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenmirror
170  * @see efl_util_screenmirror_initialize()
171  * @see efl_util_screenmirror_start();
172  */
173 API int efl_util_screenmirror_stop(efl_util_screenmirror_h screenmirror);
174
175 /**
176  * @}
177  */
178
179 #ifdef __cplusplus
180 }
181 #endif
182 #endif /* __TIZEN_UI_EFL_UTIL_SCREENSHOT_EXTENSION_H__ */