summaryrefslogtreecommitdiff
path: root/include/buffer_handler.h
blob: c2084cd93e684882663b9cda4c7a1f77079640d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 * Copyright 2013  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://floralicense.org/license/
 *
 * 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.
 */

struct buffer_info;
struct inst_info;

enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer */
	BUFFER_TYPE_FILE,
	BUFFER_TYPE_SHM,
	BUFFER_TYPE_PIXMAP,
	BUFFER_TYPE_ERROR
};

/*!
 * \brief
 * \param[in] type
 * \param[in] w
 * \param[in] h
 * \param[in] pixel_size
 * \return buffer_info
 */
extern struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size);

/*!
 * \brief
 * \param[in] info
 * \return int
 */
extern int buffer_handler_destroy(struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \return int
 */
extern int buffer_handler_load(struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \return int
 */
extern int buffer_handler_unload(struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \return int
 */
extern int buffer_handler_is_loaded(const struct buffer_info *info);

/*!
 * \brief Reallocate buffer
 * \param[in] info
 * \param[in] w
 * \param[in] h
 * \return int
 */
extern int buffer_handler_resize(struct buffer_info *info, int w, int h);

/*!
 * \brief Only update the size information
 * \param[in] info
 * \param[in] w
 * \param[in] h
 * \return void
 */
extern void buffer_handler_update_size(struct buffer_info *info, int w, int h);

/*!
 * \brief
 * \param[in] info
 * \return const char *
 */
extern const char *buffer_handler_id(const struct buffer_info *info);

/*!
 * \param[in] info
 * \return buffer_type
 */
extern enum buffer_type buffer_handler_type(const struct buffer_info *info);

/*!
 * \brief This API is not supported for Pixmap.
 * \param[in] info
 * \return void*
 */
extern void *buffer_handler_fb(struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \param[out] w
 * \param[out] h
 * \return int
 */
extern int buffer_handler_get_size(struct buffer_info *info, int *w, int *h);

/*!
 * \brief This API only can be used for file type buffer
 * \param[in] info
 * \return void
 */
extern void buffer_handler_flush(struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \return 0 if fails. Return value should be casted to Pixmap type
 */
extern int buffer_handler_pixmap(const struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \return buffer
 */
extern void *buffer_handler_pixmap_acquire_buffer(struct buffer_info *info);

/*!
 * \brief
 * \param[in] info
 * \return int
 */
extern int buffer_handler_pixmap_release_buffer(void *canvas);

/*!
 * \brief
 * \return int
 */
extern int buffer_handler_init(void);

/*!
 * \brief
 * \return int
 */
extern int buffer_handler_fini(void);

extern void *buffer_handler_pixmap_ref(struct buffer_info *info);

extern int buffer_handler_pixmap_unref(void *buffer_ptr);

extern void *buffer_handler_pixmap_find(int pixmap);

extern void *buffer_handler_pixmap_buffer(struct buffer_info *info);

extern struct inst_info *buffer_handler_instance(struct buffer_info *info);

/* End of a file */