• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
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 #include "linux/videodev2.h" /* vendor specific videodev2.h */
45 
46 /*! \ingroup exynos_v4l2 */
47 int exynos_v4l2_open(const char *filename, int oflag, ...);
48 /*! \ingroup exynos_v4l2 */
49 int exynos_v4l2_open_devname(const char *devname, int oflag, ...);
50 /*! \ingroup exynos_v4l2 */
51 int exynos_v4l2_close(int fd);
52 /*! \ingroup exynos_v4l2 */
53 bool exynos_v4l2_enuminput(int fd, int index, char *input_name_buf);
54 /*! \ingroup exynos_v4l2 */
55 int exynos_v4l2_s_input(int fd, int index);
56 /*! \ingroup exynos_v4l2 */
57 bool exynos_v4l2_querycap(int fd, unsigned int need_caps);
58 /*! \ingroup exynos_v4l2 */
59 bool exynos_v4l2_enum_fmt(int fd, enum v4l2_buf_type type, unsigned int fmt);
60 /*! \ingroup exynos_v4l2 */
61 int exynos_v4l2_g_fmt(int fd, struct v4l2_format *fmt);
62 /*! \ingroup exynos_v4l2 */
63 int exynos_v4l2_s_fmt(int fd, struct v4l2_format *fmt);
64 /*! \ingroup exynos_v4l2 */
65 int exynos_v4l2_try_fmt(int fd, struct v4l2_format *fmt);
66 /*! \ingroup exynos_v4l2 */
67 int exynos_v4l2_reqbufs(int fd, struct v4l2_requestbuffers *req);
68 /*! \ingroup exynos_v4l2 */
69 int exynos_v4l2_querybuf(int fd, struct v4l2_buffer *buf);
70 /*! \ingroup exynos_v4l2 */
71 int exynos_v4l2_qbuf(int fd, struct v4l2_buffer *buf);
72 /*! \ingroup exynos_v4l2 */
73 int exynos_v4l2_dqbuf(int fd, struct v4l2_buffer *buf);
74 /*! \ingroup exynos_v4l2 */
75 int exynos_v4l2_streamon(int fd, enum v4l2_buf_type type);
76 /*! \ingroup exynos_v4l2 */
77 int exynos_v4l2_streamoff(int fd, enum v4l2_buf_type type);
78 /*! \ingroup exynos_v4l2 */
79 int exynos_v4l2_cropcap(int fd, struct v4l2_cropcap *crop);
80 /*! \ingroup exynos_v4l2 */
81 int exynos_v4l2_g_crop(int fd, struct v4l2_crop *crop);
82 /*! \ingroup exynos_v4l2 */
83 int exynos_v4l2_s_crop(int fd, struct v4l2_crop *crop);
84 /*! \ingroup exynos_v4l2 */
85 int exynos_v4l2_g_ctrl(int fd, unsigned int id, int *value);
86 /*! \ingroup exynos_v4l2 */
87 int exynos_v4l2_s_ctrl(int fd, unsigned int id, int value);
88 /*! \ingroup exynos_v4l2 */
89 int exynos_v4l2_prepare(int fd, struct v4l2_buffer *arg);
90 /*! \ingroup exynos_v4l2 */
91 int exynos_v4l2_g_parm(int fd, struct v4l2_streamparm *streamparm);
92 /*! \ingroup exynos_v4l2 */
93 int exynos_v4l2_s_parm(int fd, struct v4l2_streamparm *streamparm);
94 /*! \ingroup exynos_v4l2 */
95 int exynos_v4l2_g_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl);
96 /*! \ingroup exynos_v4l2 */
97 int exynos_v4l2_s_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl);
98 
99 /* V4L2_SUBDEV */
100 #include <v4l2-subdev.h>
101 
102 /*! \ingroup exynos_v4l2 */
103 int exynos_subdev_open(const char *filename, int oflag, ...);
104 /*! \ingroup exynos_v4l2 */
105 int exynos_subdev_get_node_num(const char *devname, int oflag, ...);
106 /*! \ingroup exynos_v4l2 */
107 int exynos_subdev_open_devname(const char *devname, int oflag, ...);
108 /*! \ingroup exynos_v4l2 */
109 int exynos_subdev_close(int fd);
110 /*! \ingroup exynos_v4l2 */
111 int exynos_subdev_enum_frame_size(int fd, struct v4l2_subdev_frame_size_enum *frame_size_enum);
112 /*! \ingroup exynos_v4l2 */
113 int exynos_subdev_g_fmt(int fd, struct v4l2_subdev_format *fmt);
114 /*! \ingroup exynos_v4l2 */
115 int exynos_subdev_s_fmt(int fd, struct v4l2_subdev_format *fmt);
116 /*! \ingroup exynos_v4l2 */
117 int exynos_subdev_g_crop(int fd, struct v4l2_subdev_crop *crop);
118 /*! \ingroup exynos_v4l2 */
119 int exynos_subdev_s_crop(int fd, struct v4l2_subdev_crop *crop);
120 /*! \ingroup exynos_v4l2 */
121 int exynos_subdev_enum_frame_interval(int fd, struct v4l2_subdev_frame_interval_enum *frame_internval_enum);
122 /*! \ingroup exynos_v4l2 */
123 int exynos_subdev_g_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
124 /*! \ingroup exynos_v4l2 */
125 int exynos_subdev_s_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
126 /*! \ingroup exynos_v4l2 */
127 int exynos_subdev_enum_mbus_code(int fd, struct v4l2_subdev_mbus_code_enum *mbus_code_enum);
128 
129 /* MEDIA CONTORLLER */
130 #include <media.h>
131 
132 /*! media_link
133  * \ingroup exynos_v4l2
134  */
135 struct media_link {
136     struct media_pad *source;
137     struct media_pad *sink;
138     struct media_link *twin;
139     __u32 flags;
140     __u32 padding[3];
141 };
142 
143 /*! media_link
144  * \ingroup exynos_v4l2
145  */
146 struct media_pad {
147     struct media_entity *entity;
148     __u32 index;
149     __u32 flags;
150     __u32 padding[3];
151 };
152 
153 /*! media_link
154  * \ingroup exynos_v4l2
155  */
156 struct media_entity {
157     struct media_device *media;
158     struct media_entity_desc info;
159     struct media_pad *pads;
160     struct media_link *links;
161     unsigned int max_links;
162     unsigned int num_links;
163 
164     char devname[32];
165     int fd;
166     __u32 padding[6];
167 };
168 
169 /*! media_link
170  * \ingroup exynos_v4l2
171  */
172 struct media_device {
173     int fd;
174     struct media_entity *entities;
175     unsigned int entities_count;
176     void (*debug_handler)(void *, ...);
177     void *debug_priv;
178     __u32 padding[6];
179 };
180 
181 /*! \ingroup exynos_v4l2 */
182 struct media_device *exynos_media_open(const char *filename);
183 /*! \ingroup exynos_v4l2 */
184 void exynos_media_close(struct media_device *media);
185 /*! \ingroup exynos_v4l2 */
186 struct media_pad *exynos_media_entity_remote_source(struct media_pad *pad);
187 /*! \ingroup exynos_v4l2 */
188 struct media_entity *exynos_media_get_entity_by_name(struct media_device *media, const char *name, size_t length);
189 /*! \ingroup exynos_v4l2 */
190 struct media_entity *exynos_media_get_entity_by_id(struct media_device *media, __u32 id);
191 /*! \ingroup exynos_v4l2 */
192 int exynos_media_setup_link(struct media_device *media, struct media_pad *source, struct media_pad *sink, __u32 flags);
193 /*! \ingroup exynos_v4l2 */
194 int exynos_media_reset_links(struct media_device *media);
195 /*! \ingroup exynos_v4l2 */
196 struct media_pad *exynos_media_parse_pad(struct media_device *media, const char *p, char **endp);
197 /*! \ingroup exynos_v4l2 */
198 struct media_link *exynos_media_parse_link(struct media_device *media, const char *p, char **endp);
199 /*! \ingroup exynos_v4l2 */
200 int exynos_media_parse_setup_link(struct media_device *media, const char *p, char **endp);
201 /*! \ingroup exynos_v4l2 */
202 int exynos_media_parse_setup_links(struct media_device *media, const char *p);
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 
208 #endif /* __EXYNOS_LIB_V4L2_H__ */
209