2
# (C) 2008 Hans de Goede <hdegoede@redhat.com>
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#ifndef __LIBV4LCONVERT_H
20
#define __LIBV4LCONVERT_H
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 :( */
27
#include <linux/types.h>
28
#include <linux/ioctl.h>
33
#include <sys/types.h>
34
#include <sys/ioctl.h>
37
/* end broken header workaround includes */
39
#include <linux/videodev2.h>
43
#endif /* __cplusplus */
46
#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
51
struct v4lconvert_data;
53
LIBV4L_PUBLIC struct v4lconvert_data *v4lconvert_create(int fd);
54
LIBV4L_PUBLIC void v4lconvert_destroy(struct v4lconvert_data *data);
56
/* When doing flipping / rotating / video-processing, only supported
57
destination formats can be used (as flipping / rotating / video-processing
58
is not supported on other formats). This function can be used to query
59
if that is the case. */
60
LIBV4L_PUBLIC int v4lconvert_supported_dst_fmt_only(
61
struct v4lconvert_data *data);
63
/* With regards to dest_fmt just like VIDIOC_TRY_FMT, except that the try
64
format will succeed and return the requested V4L2_PIX_FMT_foo in dest_fmt if
65
the cam has a format from which v4lconvert can convert to dest_fmt.
66
The real format to which the cam should be set is returned through src_fmt
68
Note that just like the real VIDIOC_TRY_FMT this function will change the
69
dest_fmt when not supported. This includes changing it to a supported
70
destination format when trying a native format of the camera and
71
v4lconvert_supported_dst_fmt_only() returns true. */
72
LIBV4L_PUBLIC int v4lconvert_try_format(struct v4lconvert_data *data,
73
struct v4l2_format *dest_fmt, /* in / out */
74
struct v4l2_format *src_fmt /* out */
77
/* Like VIDIOC_ENUM_FMT, but the emulated formats are added at the end of the
78
list, except if flipping / processing is active for the device, then only
79
supported destination formats are listed */
80
LIBV4L_PUBLIC int v4lconvert_enum_fmt(struct v4lconvert_data *data, struct v4l2_fmtdesc *fmt);
82
/* Is conversion necessary or can the app use the data directly? */
83
LIBV4L_PUBLIC int v4lconvert_needs_conversion(struct v4lconvert_data *data,
84
const struct v4l2_format *src_fmt, /* in */
85
const struct v4l2_format *dest_fmt); /* in */
87
/* return value of -1 on error, otherwise the amount of bytes written to
89
LIBV4L_PUBLIC int v4lconvert_convert(struct v4lconvert_data *data,
90
const struct v4l2_format *src_fmt, /* in */
91
const struct v4l2_format *dest_fmt, /* in */
92
unsigned char *src, int src_size, unsigned char *dest, int dest_size);
94
/* get a string describing the last error*/
95
LIBV4L_PUBLIC const char *v4lconvert_get_error_message(struct v4lconvert_data *data);
97
/* Just like VIDIOC_ENUM_FRAMESIZE, except that the framesizes of emulated
98
formats can be enumerated as well. */
99
LIBV4L_PUBLIC int v4lconvert_enum_framesizes(struct v4lconvert_data *data,
100
struct v4l2_frmsizeenum *frmsize);
102
/* Just like VIDIOC_ENUM_FRAMEINTERVALS, except that the intervals of emulated
103
formats can be enumerated as well. */
104
LIBV4L_PUBLIC int v4lconvert_enum_frameintervals(struct v4lconvert_data *data,
105
struct v4l2_frmivalenum *frmival);
107
/* Pass calls to query, get and set video controls to the libv4lcontrol class */
108
LIBV4L_PUBLIC int v4lconvert_vidioc_queryctrl(struct v4lconvert_data *data,
110
LIBV4L_PUBLIC int v4lconvert_vidioc_g_ctrl(struct v4lconvert_data *data,
112
LIBV4L_PUBLIC int v4lconvert_vidioc_s_ctrl(struct v4lconvert_data *data,
115
/* Is the passed in pixelformat supported as destination format ? */
116
LIBV4L_PUBLIC int v4lconvert_supported_dst_format(unsigned int pixelformat);
120
#endif /* __cplusplus */