1 /*
2  * Copyright@ Samsung Electronics 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 #ifndef LIBGSCALER_MEDIA_H_
18 #define LIBGSCALER_MEDIA_H_
19 
20 /* V4L2_SUBDEV */
21 #include <linux/v4l2-subdev.h>
22 
23 #ifdef __GNUC__
24 #  define __UNUSED__ __attribute__((__unused__))
25 #else
26 #  define __UNUSED__
27 #endif
28 
29 __BEGIN_DECLS
30 
31 /*! \ingroup exynos_v4l2 */
32 int exynos_subdev_open(const char *filename, int oflag, ...);
33 /*! \ingroup exynos_v4l2 */
34 int exynos_subdev_get_node_num(const char *devname, int oflag, ...);
35 /*! \ingroup exynos_v4l2 */
36 int exynos_subdev_open_devname(const char *devname, int oflag, ...);
37 /*! \ingroup exynos_v4l2 */
38 int exynos_subdev_close(int fd);
39 /*! \ingroup exynos_v4l2 */
40 int exynos_subdev_enum_frame_size(int fd, struct v4l2_subdev_frame_size_enum *frame_size_enum);
41 /*! \ingroup exynos_v4l2 */
42 int exynos_subdev_g_fmt(int fd, struct v4l2_subdev_format *fmt);
43 /*! \ingroup exynos_v4l2 */
44 int exynos_subdev_s_fmt(int fd, struct v4l2_subdev_format *fmt);
45 /*! \ingroup exynos_v4l2 */
46 int exynos_subdev_g_crop(int fd, struct v4l2_subdev_crop *crop);
47 /*! \ingroup exynos_v4l2 */
48 int exynos_subdev_s_crop(int fd, struct v4l2_subdev_crop *crop);
49 /*! \ingroup exynos_v4l2 */
50 int exynos_subdev_enum_frame_interval(int fd, struct v4l2_subdev_frame_interval_enum *frame_internval_enum);
51 /*! \ingroup exynos_v4l2 */
52 int exynos_subdev_g_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
53 /*! \ingroup exynos_v4l2 */
54 int exynos_subdev_s_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum);
55 /*! \ingroup exynos_v4l2 */
56 int exynos_subdev_enum_mbus_code(int fd, struct v4l2_subdev_mbus_code_enum *mbus_code_enum);
57 /* MEDIA CONTORLLER */
58 #include <linux/media.h>
59 
60 /*! media_link
61  * \ingroup exynos_v4l2
62  */
63 struct media_link {
64     struct media_pad *source;
65     struct media_pad *sink;
66     struct media_link *twin;
67     __u32 flags;
68     __u32 padding[3];
69 };
70 
71 /*! media_link
72  * \ingroup exynos_v4l2
73  */
74 struct media_pad {
75     struct media_entity *entity;
76     __u32 index;
77     __u32 flags;
78     __u32 padding[3];
79 };
80 
81 /*! media_link
82  * \ingroup exynos_v4l2
83  */
84 struct media_entity {
85     struct media_device *media;
86     struct media_entity_desc info;
87     struct media_pad *pads;
88     struct media_link *links;
89     unsigned int max_links;
90     unsigned int num_links;
91 
92     char devname[32];
93     int fd;
94     __u32 padding[6];
95 };
96 
97 /*! media_link
98  * \ingroup exynos_v4l2
99  */
100 struct media_device {
101     int fd;
102     struct media_entity *entities;
103     unsigned int entities_count;
104     void (*debug_handler)(void *, ...);
105     void *debug_priv;
106     __u32 padding[6];
107 };
108 
109 __END_DECLS
110 
111 #endif /* LIBGSCALER_MEDIA_H_  */
112