Sync with the latest code of phone profile
[platform/framework/web/data-provider-master.git] / include / buffer_handler.h
1 /*
2  * Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 struct buffer_info;
18 struct inst_info;
19 struct buffer;
20
21 enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer, liblivebox-edje */
22         BUFFER_TYPE_FILE,
23         BUFFER_TYPE_SHM,
24         BUFFER_TYPE_PIXMAP,
25         BUFFER_TYPE_ERROR
26 };
27
28 /*!
29  * \brief
30  * \param[in] type
31  * \param[in] w
32  * \param[in] h
33  * \param[in] pixel_size
34  * \return buffer_info
35  */
36 extern struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size);
37
38 /*!
39  * \brief
40  * \param[in] info
41  * \return int
42  */
43 extern int buffer_handler_destroy(struct buffer_info *info);
44
45 /*!
46  * \brief
47  * \param[in] info
48  * \return int
49  */
50 extern int buffer_handler_load(struct buffer_info *info);
51
52 /*!
53  * \brief
54  * \param[in] info
55  * \return int
56  */
57 extern int buffer_handler_unload(struct buffer_info *info);
58
59 /*!
60  * \brief
61  * \param[in] info
62  * \return int
63  */
64 extern int buffer_handler_is_loaded(const struct buffer_info *info);
65
66 /*!
67  * \brief Reallocate buffer
68  * \param[in] info
69  * \param[in] w
70  * \param[in] h
71  * \return int
72  */
73 extern int buffer_handler_resize(struct buffer_info *info, int w, int h);
74
75 /*!
76  * \brief Only update the size information
77  * \param[in] info
78  * \param[in] w
79  * \param[in] h
80  * \return void
81  */
82 extern void buffer_handler_update_size(struct buffer_info *info, int w, int h);
83
84 /*!
85  * \brief
86  * \param[in] info
87  * \return const char *
88  */
89 extern const char *buffer_handler_id(const struct buffer_info *info);
90
91 /*!
92  * \param[in] info
93  * \return buffer_type
94  */
95 extern enum buffer_type buffer_handler_type(const struct buffer_info *info);
96
97 /*!
98  * \brief This API is not supported for Pixmap.
99  * \param[in] info
100  * \return void*
101  */
102 extern void *buffer_handler_fb(struct buffer_info *info);
103
104 /*!
105  * \brief
106  * \param[in] info
107  * \param[out] w
108  * \param[out] h
109  * \return int
110  */
111 extern int buffer_handler_get_size(struct buffer_info *info, int *w, int *h);
112
113 /*!
114  * \brief This API only can be used for file type buffer
115  * \param[in] info
116  * \return void
117  */
118 extern void buffer_handler_flush(struct buffer_info *info);
119
120 /*!
121  * \brief
122  * \param[in] info
123  * \return 0 if fails. Return value should be casted to Pixmap type
124  */
125 extern int buffer_handler_pixmap(const struct buffer_info *info);
126
127 /*!
128  * \brief
129  * \param[in] info
130  * \return buffer
131  */
132 extern void *buffer_handler_pixmap_acquire_buffer(struct buffer_info *info);
133
134 /*!
135  * \brief
136  * \param[in] info
137  * \return int
138  */
139 extern int buffer_handler_pixmap_release_buffer(void *canvas);
140
141 /*!
142  * \brief
143  * \return int
144  */
145 extern int buffer_handler_init(void);
146
147 /*!
148  * \brief
149  * \details
150  * \remarks
151  * \return int
152  * \retval
153  * \pre
154  * \post
155  * \sa
156  */
157 extern int buffer_handler_fini(void);
158
159 /*!
160  * \brief
161  * \details
162  * \remarks
163  * \param[in] info
164  * \return void *
165  * \retval NULL
166  * \retval address
167  * \pre
168  * \post
169  * \sa
170  */
171 extern void *buffer_handler_pixmap_ref(struct buffer_info *info);
172
173 /*!
174  * \brief
175  * \details
176  * \remarks
177  * \param[in] buffer_ptr
178  * \return int
179  * \retval 
180  * \pre
181  * \post
182  * \sa
183  */
184 extern int buffer_handler_pixmap_unref(void *buffer_ptr);
185
186 /*!
187  * \brief
188  * \details
189  * \remarks
190  * \param[in] pixmap
191  * \return void *
192  * \retval
193  * \pre
194  * \post
195  * \sa
196  */
197 extern void *buffer_handler_pixmap_find(int pixmap);
198
199 /*!
200  * \brief
201  * \details
202  * \remarks
203  * \param[in] info
204  * \return void *
205  * \retval
206  * \pre
207  * \post
208  * \sa
209  */
210 extern void *buffer_handler_pixmap_buffer(struct buffer_info *info);
211
212 /*!
213  * \brief
214  * \details
215  * \remarks
216  * \param[in] info
217  * \return struct inst_info *
218  * \retval
219  * \pre
220  * \post
221  * \sa
222  */
223 extern struct inst_info *buffer_handler_instance(struct buffer_info *info);
224
225 /*!
226  * \brief
227  * \details
228  * \remarks
229  * \param[in] type
230  * \param[in] resource
231  * \return struct buffer *
232  * \retval NULL
233  * \retval address
234  * \pre
235  * \post
236  * \sa
237  */
238 extern struct buffer *buffer_handler_raw_open(enum buffer_type type, void *resource);
239
240 /*!
241  * \brief
242  * \details
243  * \remarks
244  * \param[in] buffer
245  * \return int
246  * \retval
247  * \pre
248  * \post
249  * \sa
250  */
251 extern int buffer_handler_raw_close(struct buffer *buffer);
252
253 /*!
254  * \brief
255  * \details
256  * \remarks
257  * \param[in] buffer
258  * \return void *
259  * \retval NULL
260  * \pre
261  * \post
262  * \sa
263  */
264 extern void *buffer_handler_raw_data(struct buffer *buffer);
265
266 /*!
267  * \brief
268  * \details
269  * \remarks
270  * \param[in] buffer
271  * \return int
272  * \retval
273  * \pre
274  * \post
275  * \sa
276  */
277 extern int buffer_handler_raw_size(struct buffer *buffer);
278
279 /*!
280  * \brief
281  * \details
282  * \remarks
283  * \param[in] buffer
284  * \return int
285  * \retval
286  * \pre
287  * \post
288  * \sa
289  */
290 extern int buffer_handler_lock(struct buffer_info *buffer);
291
292 /*!
293  * \brief
294  * \details
295  * \remarks
296  * \param[in] buffer
297  * \return int
298  * \retval
299  * \pre
300  * \post
301  * \sa
302  */
303 extern int buffer_handler_unlock(struct buffer_info *buffer);
304
305 /*!
306  * \brief
307  * \details
308  * \remarks
309  * \param[in] buffer
310  * \param[in] data
311  * \return int
312  * \retval
313  * \pre
314  * \post
315  * \sa
316  */
317 extern int buffer_handler_set_data(struct buffer_info *buffer, void *data);
318
319 /*!
320  * \brief
321  * \details
322  * \remarks
323  * \param[in] buffer
324  * \return void *
325  * \retval NULL
326  * \retval address
327  * \pre
328  * \post
329  * \sa
330  */
331 extern void *buffer_handler_data(struct buffer_info *buffer);
332 /* End of a file */