Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/v4l-utils/lib/include/libv4lconvert.h

Issue 700383004: Add use_v4lplugin flag to enable v4l2 library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use v4l2_fd_open Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 # (C) 2008 Hans de Goede <hdegoede@redhat.com>
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU Lesser General Public License as published by
6 # the Free Software Foundation; either version 2.1 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17 */
18
19 #ifndef __LIBV4LCONVERT_H
20 #define __LIBV4LCONVERT_H
21
22 /* These headers are not needed by us, but by linux/videodev2.h,
23 which is broken on some systems and doesn't include them itself :( */
24
25 #ifdef linux
26 #include <sys/time.h>
27 #include <linux/types.h>
28 #include <linux/ioctl.h>
29 #endif
30
31 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
32 #include <sys/time.h>
33 #include <sys/types.h>
34 #include <sys/ioctl.h>
35 #endif
36
37 /* end broken header workaround includes */
38
39 #include <linux/videodev2.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif /* __cplusplus */
44
45 #if HAVE_VISIBILITY
46 #define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
47 #else
48 #define LIBV4L_PUBLIC
49 #endif
50
51 struct libv4l_dev_ops;
52 struct v4lconvert_data;
53
54 LIBV4L_PUBLIC const struct libv4l_dev_ops *v4lconvert_get_default_dev_ops();
55
56 LIBV4L_PUBLIC struct v4lconvert_data *v4lconvert_create(int fd);
57 LIBV4L_PUBLIC struct v4lconvert_data *v4lconvert_create_with_dev_ops(int fd,
58 void *dev_ops_priv, const struct libv4l_dev_ops *dev_ops);
59 LIBV4L_PUBLIC void v4lconvert_destroy(struct v4lconvert_data *data);
60
61 /* When doing flipping / rotating / video-processing, only supported
62 destination formats can be used (as flipping / rotating / video-processing
63 is not supported on other formats). This function can be used to query
64 if that is the case. */
65 LIBV4L_PUBLIC int v4lconvert_supported_dst_fmt_only(
66 struct v4lconvert_data *data);
67
68 /* With regards to dest_fmt just like VIDIOC_TRY_FMT, except that the try
69 format will succeed and return the requested V4L2_PIX_FMT_foo in dest_fmt if
70 the cam has a format from which v4lconvert can convert to dest_fmt.
71 The real format to which the cam should be set is returned through src_fmt
72 when not NULL.
73 Note that just like the real VIDIOC_TRY_FMT this function will change the
74 dest_fmt when not supported. This includes changing it to a supported
75 destination format when trying a native format of the camera and
76 v4lconvert_supported_dst_fmt_only() returns true. */
77 LIBV4L_PUBLIC int v4lconvert_try_format(struct v4lconvert_data *data,
78 struct v4l2_format *dest_fmt, /* in / out */
79 struct v4l2_format *src_fmt); /* out */
80
81 /* Like VIDIOC_ENUM_FMT, but the emulated formats are added at the end of the
82 list, except if flipping / processing is active for the device, then only
83 supported destination formats are listed */
84 LIBV4L_PUBLIC int v4lconvert_enum_fmt(struct v4lconvert_data *data,
85 struct v4l2_fmtdesc *fmt);
86
87 /* Is conversion necessary or can the app use the data directly? */
88 LIBV4L_PUBLIC int v4lconvert_needs_conversion(struct v4lconvert_data *data,
89 const struct v4l2_format *src_fmt, /* in */
90 const struct v4l2_format *dest_fmt); /* in */
91
92 /* This function does the following conversions:
93 - format conversion
94 - cropping
95 if enabled:
96 - processing (auto whitebalance, auto gain, gamma correction)
97 - horizontal/vertical flipping
98 - 90 degree (clockwise) rotation
99
100 NOTE: the last 3 steps are enabled/disabled depending on
101 - the internal device list
102 - the state of the (software emulated) image controls
103
104 Therefore this function should
105 - not be used when getting the frames from libv4l
106 - be called only once per frame
107 Otherwise this may result in unintended double conversions !
108
109 Returns the amount of bytes written to dest and -1 on error */
110 LIBV4L_PUBLIC int v4lconvert_convert(struct v4lconvert_data *data,
111 const struct v4l2_format *src_fmt, /* in */
112 const struct v4l2_format *dest_fmt, /* in */
113 unsigned char *src, int src_size, unsigned char *dest, int dest_ size);
114
115 /* get a string describing the last error */
116 LIBV4L_PUBLIC const char *v4lconvert_get_error_message(struct v4lconvert_data *d ata);
117
118 /* Just like VIDIOC_ENUM_FRAMESIZE, except that the framesizes of emulated
119 formats can be enumerated as well. */
120 LIBV4L_PUBLIC int v4lconvert_enum_framesizes(struct v4lconvert_data *data,
121 struct v4l2_frmsizeenum *frmsize);
122
123 /* Just like VIDIOC_ENUM_FRAMEINTERVALS, except that the intervals of emulated
124 formats can be enumerated as well. */
125 LIBV4L_PUBLIC int v4lconvert_enum_frameintervals(struct v4lconvert_data *data,
126 struct v4l2_frmivalenum *frmival);
127
128 /* Pass calls to query, get and set video controls to the libv4lcontrol class */
129 LIBV4L_PUBLIC int v4lconvert_vidioc_queryctrl(struct v4lconvert_data *data,
130 void *arg);
131 LIBV4L_PUBLIC int v4lconvert_vidioc_g_ctrl(struct v4lconvert_data *data,
132 void *arg);
133 LIBV4L_PUBLIC int v4lconvert_vidioc_s_ctrl(struct v4lconvert_data *data,
134 void *arg);
135 LIBV4L_PUBLIC int v4lconvert_vidioc_g_ext_ctrls(struct v4lconvert_data *data,
136 void *arg);
137 LIBV4L_PUBLIC int v4lconvert_vidioc_try_ext_ctrls(struct v4lconvert_data *data,
138 void *arg);
139 LIBV4L_PUBLIC int v4lconvert_vidioc_s_ext_ctrls(struct v4lconvert_data *data,
140 void *arg);
141
142 /* Is the passed in pixelformat supported as destination format? */
143 LIBV4L_PUBLIC int v4lconvert_supported_dst_format(unsigned int pixelformat);
144
145 /* Get/set the no fps libv4lconvert uses to decide if a compressed format
146 must be used as src fmt to stay within the bus bandwidth */
147 LIBV4L_PUBLIC int v4lconvert_get_fps(struct v4lconvert_data *data);
148 LIBV4L_PUBLIC void v4lconvert_set_fps(struct v4lconvert_data *data, int fps);
149
150 /* Fixup bytesperline and sizeimage for supported destination formats */
151 LIBV4L_PUBLIC void v4lconvert_fixup_fmt(struct v4l2_format *fmt);
152
153 #ifdef __cplusplus
154 }
155 #endif /* __cplusplus */
156
157 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698