for callback invoke when resolution is changed
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / exynos / include / exynos_v4l2.h
1 /*
2  * Copyright 2012 Samsung Electronics S.LSI Co. LTD
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 /*!
18  * \file      exynos_v4l2.h
19  * \brief     header file for libv4l2
20  * \author    Jinsung Yang (jsgood.yang@samsung.com)
21  * \date      2011/12/15
22  *
23  * <b>Revision History: </b>
24  * - 2011/12/15 : Jinsung Yang (jsgood.yang@samsung.com) \n
25  *   Initial version
26  *
27  */
28
29 /*!
30  * \defgroup exynos_v4l2
31  * \brief API for v4l2
32  * \addtogroup Exynos
33  */
34
35 #ifndef __EXYNOS_LIB_V4L2_H__
36 #define __EXYNOS_LIB_V4L2_H__
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /* V4L2 */
43 #include <stdbool.h>
44 #ifdef TIZEN_FEATURE_E3250
45 #include <linux/videodev2.h>
46 #include <linux/videodev2_exynos_media.h>
47 #else
48 #include "videodev2.h" /* vendor specific videodev2.h */
49 #include "videodev2_exynos_media.h"
50 #endif
51
52 /*! \ingroup exynos_v4l2 */
53 int exynos_v4l2_open(const char *filename, int oflag, ...);
54 /*! \ingroup exynos_v4l2 */
55 int exynos_v4l2_open_devname(const char *devname, int oflag, ...);
56 /*! \ingroup exynos_v4l2 */
57 int exynos_v4l2_close(int fd);
58 /*! \ingroup exynos_v4l2 */
59 bool exynos_v4l2_enuminput(int fd, int index, char *input_name_buf);
60 /*! \ingroup exynos_v4l2 */
61 int exynos_v4l2_s_input(int fd, int index);
62 /*! \ingroup exynos_v4l2 */
63 bool exynos_v4l2_querycap(int fd, unsigned int need_caps);
64 /*! \ingroup exynos_v4l2 */
65 bool exynos_v4l2_enum_fmt(int fd, enum v4l2_buf_type type, unsigned int fmt);
66 /*! \ingroup exynos_v4l2 */
67 int exynos_v4l2_g_fmt(int fd, struct v4l2_format *fmt);
68 /*! \ingroup exynos_v4l2 */
69 int exynos_v4l2_s_fmt(int fd, struct v4l2_format *fmt);
70 /*! \ingroup exynos_v4l2 */
71 int exynos_v4l2_try_fmt(int fd, struct v4l2_format *fmt);
72 /*! \ingroup exynos_v4l2 */
73 int exynos_v4l2_reqbufs(int fd, struct v4l2_requestbuffers *req);
74 /*! \ingroup exynos_v4l2 */
75 int exynos_v4l2_querybuf(int fd, struct v4l2_buffer *buf);
76 #ifdef TIZEN_FEATURE_E3250
77 int exynos_v4l2_expbuf(int fd, int *buf_fd, __u32 mem_offset);
78 #endif
79 /*! \ingroup exynos_v4l2 */
80 int exynos_v4l2_qbuf(int fd, struct v4l2_buffer *buf);
81 /*! \ingroup exynos_v4l2 */
82 int exynos_v4l2_dqbuf(int fd, struct v4l2_buffer *buf);
83 /*! \ingroup exynos_v4l2 */
84 int exynos_v4l2_streamon(int fd, enum v4l2_buf_type type);
85 /*! \ingroup exynos_v4l2 */
86 int exynos_v4l2_streamoff(int fd, enum v4l2_buf_type type);
87 /*! \ingroup exynos_v4l2 */
88 int exynos_v4l2_cropcap(int fd, struct v4l2_cropcap *crop);
89 /*! \ingroup exynos_v4l2 */
90 int exynos_v4l2_g_crop(int fd, struct v4l2_crop *crop);
91 /*! \ingroup exynos_v4l2 */
92 int exynos_v4l2_s_crop(int fd, struct v4l2_crop *crop);
93 /*! \ingroup exynos_v4l2 */
94 int exynos_v4l2_g_ctrl(int fd, unsigned int id, int *value);
95 /*! \ingroup exynos_v4l2 */
96 int exynos_v4l2_s_ctrl(int fd, unsigned int id, int value);
97 /*! \ingroup exynos_v4l2 */
98 int exynos_v4l2_g_parm(int fd, struct v4l2_streamparm *streamparm);
99 /*! \ingroup exynos_v4l2 */
100 int exynos_v4l2_s_parm(int fd, struct v4l2_streamparm *streamparm);
101 /*! \ingroup exynos_v4l2 */
102 int exynos_v4l2_g_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl);
103 /*! \ingroup exynos_v4l2 */
104 int exynos_v4l2_s_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl);
105
106 /* V4L2_SUBDEV */
107 #ifndef TIZEN_FEATURE_E3250 /* build env */
108 #include <v4l2-subdev.h>
109 #else
110 #include <linux/v4l2-subdev.h>
111 #endif
112
113 /*! \ingroup exynos_v4l2 */
114 int exynos_subdev_open(const char *filename, int oflag, ...);
115 /*! \ingroup exynos_v4l2 */
116 int exynos_subdev_open_devname(const char *devname, int oflag, ...);
117 /*! \ingroup exynos_v4l2 */
118 int exynos_subdev_enum_frame_size(int fd, struct v4l2_subdev_frame_size_enum *frame_size_enum);
119 /*! \ingroup exynos_v4l2 */
120 int exynos_subdev_g_fmt(int fd, struct v4l2_subdev_format *fmt);
121 /*! \ingroup exynos_v4l2 */
122 int exynos_subdev_s_fmt(int fd, struct v4l2_subdev_format *fmt);
123 /*! \ingroup exynos_v4l2 */
124 int exynos_subdev_g_crop(int fd, struct v4l2_subdev_crop *crop);
125 /*! \ingroup exynos_v4l2 */
126 int exynos_subdev_s_crop(int fd, struct v4l2_subdev_crop *crop);
127 /*! \ingroup exynos_v4l2 */
128 int exynos_subdev_enum_frame_interval(int fd, struct v4l2_subdev_frame_interval_enum *frame_internval_enum);
129 /*! \ingroup exynos_v4l2 */
130 int exynos_subdev_g_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
131 /*! \ingroup exynos_v4l2 */
132 int exynos_subdev_s_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
133 /*! \ingroup exynos_v4l2 */
134 int exynos_subdev_enum_mbus_code(int fd, struct v4l2_subdev_mbus_code_enum *mbus_code_enum);
135
136 /* MEDIA CONTORLLER */
137 #ifndef TIZEN_FEATURE_E3250 /* build env */
138 #include <media.h>
139 #else
140 #include <linux/media.h>
141 #endif
142
143 /*! media_link
144  * \ingroup exynos_v4l2
145  */
146 struct media_link {
147     struct media_pad *source;
148     struct media_pad *sink;
149     struct media_link *twin;
150     __u32 flags;
151     __u32 padding[3];
152 };
153
154 /*! media_link
155  * \ingroup exynos_v4l2
156  */
157 struct media_pad {
158     struct media_entity *entity;
159     __u32 index;
160     __u32 flags;
161     __u32 padding[3];
162 };
163
164 /*! media_link
165  * \ingroup exynos_v4l2
166  */
167 struct media_entity {
168     struct media_device *media;
169     struct media_entity_desc info;
170     struct media_pad *pads;
171     struct media_link *links;
172     unsigned int max_links;
173     unsigned int num_links;
174
175     char devname[32];
176     int fd;
177     __u32 padding[6];
178 };
179
180 /*! media_link
181  * \ingroup exynos_v4l2
182  */
183 struct media_device {
184     int fd;
185     struct media_entity *entities;
186     unsigned int entities_count;
187     void (*debug_handler)(void *, ...);
188     void *debug_priv;
189     __u32 padding[6];
190 };
191
192 /*! \ingroup exynos_v4l2 */
193 struct media_device *exynos_media_open(const char *filename);
194 /*! \ingroup exynos_v4l2 */
195 void exynos_media_close(struct media_device *media);
196 /*! \ingroup exynos_v4l2 */
197 struct media_pad *exynos_media_entity_remote_source(struct media_pad *pad);
198 /*! \ingroup exynos_v4l2 */
199 struct media_entity *exynos_media_get_entity_by_name(struct media_device *media, const char *name, size_t length);
200 /*! \ingroup exynos_v4l2 */
201 struct media_entity *exynos_media_get_entity_by_id(struct media_device *media, __u32 id);
202 /*! \ingroup exynos_v4l2 */
203 int exynos_media_setup_link(struct media_device *media, struct media_pad *source, struct media_pad *sink, __u32 flags);
204 /*! \ingroup exynos_v4l2 */
205 int exynos_media_reset_links(struct media_device *media);
206 /*! \ingroup exynos_v4l2 */
207 struct media_pad *exynos_media_parse_pad(struct media_device *media, const char *p, char **endp);
208 /*! \ingroup exynos_v4l2 */
209 struct media_link *exynos_media_parse_link(struct media_device *media, const char *p, char **endp);
210 /*! \ingroup exynos_v4l2 */
211 int exynos_media_parse_setup_link(struct media_device *media, const char *p, char **endp);
212 /*! \ingroup exynos_v4l2 */
213 int exynos_media_parse_setup_links(struct media_device *media, const char *p);
214
215 #ifdef __cplusplus
216 }
217 #endif
218
219 #endif /* __EXYNOS_LIB_V4L2_H__ */