summaryrefslogtreecommitdiff
path: root/libv4l2/exynos_v4l2.h
blob: eff56d4c59e951de556ec0ecc94abadd72af19a4 (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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.
 */

/*!
 * \file      exynos_v4l2.h
 * \brief     header file for libv4l2
 * \author    Jinsung Yang (jsgood.yang@samsung.com)
 * \date      2011/12/15
 *
 * <b>Revision History: </b>
 * - 2011/12/15 : Jinsung Yang (jsgood.yang@samsung.com) \n
 *   Initial version
 *
 */

/*!
 * \defgroup exynos_v4l2
 * \brief API for v4l2
 * \addtogroup Exynos
 */

#ifndef __EXYNOS_LIB_V4L2_H__
#define __EXYNOS_LIB_V4L2_H__

#ifdef __cplusplus
extern "C" {
#endif

/* V4L2 */
#include <stdbool.h>
#include "linux/videodev2.h" /* vendor specific videodev2.h */

/*! \ingroup exynos_v4l2 */
int exynos_v4l2_open(const char *filename, int oflag, ...);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_open_devname(const char *devname, int oflag, ...);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_close(int fd);
/*! \ingroup exynos_v4l2 */
bool exynos_v4l2_enuminput(int fd, int index, char *input_name_buf);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_s_input(int fd, int index);
/*! \ingroup exynos_v4l2 */
bool exynos_v4l2_querycap(int fd, unsigned int need_caps);
/*! \ingroup exynos_v4l2 */
bool exynos_v4l2_enum_fmt(int fd, enum v4l2_buf_type type, unsigned int fmt);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_g_fmt(int fd, struct v4l2_format *fmt);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_s_fmt(int fd, struct v4l2_format *fmt);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_try_fmt(int fd, struct v4l2_format *fmt);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_reqbufs(int fd, struct v4l2_requestbuffers *req);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_querybuf(int fd, struct v4l2_buffer *buf);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_qbuf(int fd, struct v4l2_buffer *buf);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_dqbuf(int fd, struct v4l2_buffer *buf);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_streamon(int fd, enum v4l2_buf_type type);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_streamoff(int fd, enum v4l2_buf_type type);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_cropcap(int fd, struct v4l2_cropcap *crop);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_g_crop(int fd, struct v4l2_crop *crop);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_s_crop(int fd, struct v4l2_crop *crop);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_g_ctrl(int fd, unsigned int id, int *value);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_s_ctrl(int fd, unsigned int id, int value);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_prepare(int fd, struct v4l2_buffer *arg);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_g_parm(int fd, struct v4l2_streamparm *streamparm);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_s_parm(int fd, struct v4l2_streamparm *streamparm);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_g_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl);
/*! \ingroup exynos_v4l2 */
int exynos_v4l2_s_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl);

/* V4L2_SUBDEV */
#include <v4l2-subdev.h>

/*! \ingroup exynos_v4l2 */
int exynos_subdev_open(const char *filename, int oflag, ...);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_get_node_num(const char *devname, int oflag, ...);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_open_devname(const char *devname, int oflag, ...);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_close(int fd);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_enum_frame_size(int fd, struct v4l2_subdev_frame_size_enum *frame_size_enum);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_g_fmt(int fd, struct v4l2_subdev_format *fmt);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_s_fmt(int fd, struct v4l2_subdev_format *fmt);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_g_crop(int fd, struct v4l2_subdev_crop *crop);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_s_crop(int fd, struct v4l2_subdev_crop *crop);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_enum_frame_interval(int fd, struct v4l2_subdev_frame_interval_enum *frame_internval_enum);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_g_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_s_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
/*! \ingroup exynos_v4l2 */
int exynos_subdev_enum_mbus_code(int fd, struct v4l2_subdev_mbus_code_enum *mbus_code_enum);

/* MEDIA CONTORLLER */
#include <media.h>

/*! media_link
 * \ingroup exynos_v4l2
 */
struct media_link {
    struct media_pad *source;
    struct media_pad *sink;
    struct media_link *twin;
    __u32 flags;
    __u32 padding[3];
};

/*! media_link
 * \ingroup exynos_v4l2
 */
struct media_pad {
    struct media_entity *entity;
    __u32 index;
    __u32 flags;
    __u32 padding[3];
};

/*! media_link
 * \ingroup exynos_v4l2
 */
struct media_entity {
    struct media_device *media;
    struct media_entity_desc info;
    struct media_pad *pads;
    struct media_link *links;
    unsigned int max_links;
    unsigned int num_links;

    char devname[32];
    int fd;
    __u32 padding[6];
};

/*! media_link
 * \ingroup exynos_v4l2
 */
struct media_device {
    int fd;
    struct media_entity *entities;
    unsigned int entities_count;
    void (*debug_handler)(void *, ...);
    void *debug_priv;
    __u32 padding[6];
};

/*! \ingroup exynos_v4l2 */
struct media_device *exynos_media_open(const char *filename);
/*! \ingroup exynos_v4l2 */
void exynos_media_close(struct media_device *media);
/*! \ingroup exynos_v4l2 */
struct media_pad *exynos_media_entity_remote_source(struct media_pad *pad);
/*! \ingroup exynos_v4l2 */
struct media_entity *exynos_media_get_entity_by_name(struct media_device *media, const char *name, size_t length);
/*! \ingroup exynos_v4l2 */
struct media_entity *exynos_media_get_entity_by_id(struct media_device *media, __u32 id);
/*! \ingroup exynos_v4l2 */
int exynos_media_setup_link(struct media_device *media, struct media_pad *source, struct media_pad *sink, __u32 flags);
/*! \ingroup exynos_v4l2 */
int exynos_media_reset_links(struct media_device *media);
/*! \ingroup exynos_v4l2 */
struct media_pad *exynos_media_parse_pad(struct media_device *media, const char *p, char **endp);
/*! \ingroup exynos_v4l2 */
struct media_link *exynos_media_parse_link(struct media_device *media, const char *p, char **endp);
/*! \ingroup exynos_v4l2 */
int exynos_media_parse_setup_link(struct media_device *media, const char *p, char **endp);
/*! \ingroup exynos_v4l2 */
int exynos_media_parse_setup_links(struct media_device *media, const char *p);

#ifdef __cplusplus
}
#endif

#endif /* __EXYNOS_LIB_V4L2_H__ */