~ubuntu-branches/ubuntu/precise/v4l-utils/precise

« back to all changes in this revision

Viewing changes to lib/include/libv4lconvert.h

  • Committer: Bazaar Package Importer
  • Author(s): Gregor Jasny
  • Date: 2010-02-28 19:44:15 UTC
  • Revision ID: james.westby@ubuntu.com-20100228194415-067hdj8rvawj91zw
Tags: upstream-0.7.90
ImportĀ upstreamĀ versionĀ 0.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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
#ifdef __FreeBSD__
 
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 __GNUC__ >= 4
 
46
#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
 
47
#else
 
48
#define LIBV4L_PUBLIC
 
49
#endif
 
50
 
 
51
struct v4lconvert_data;
 
52
 
 
53
LIBV4L_PUBLIC struct v4lconvert_data *v4lconvert_create(int fd);
 
54
LIBV4L_PUBLIC void v4lconvert_destroy(struct v4lconvert_data *data);
 
55
 
 
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);
 
62
 
 
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
 
67
   when not NULL.
 
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 */
 
75
);
 
76
 
 
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);
 
81
 
 
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 */
 
86
 
 
87
/* return value of -1 on error, otherwise the amount of bytes written to
 
88
   dest */
 
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);
 
93
 
 
94
/* get a string describing the last error*/
 
95
LIBV4L_PUBLIC const char *v4lconvert_get_error_message(struct v4lconvert_data *data);
 
96
 
 
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);
 
101
 
 
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);
 
106
 
 
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,
 
109
  void *arg);
 
110
LIBV4L_PUBLIC int v4lconvert_vidioc_g_ctrl(struct v4lconvert_data *data,
 
111
  void *arg);
 
112
LIBV4L_PUBLIC int v4lconvert_vidioc_s_ctrl(struct v4lconvert_data *data,
 
113
  void *arg);
 
114
 
 
115
/* Is the passed in pixelformat supported as destination format ? */
 
116
LIBV4L_PUBLIC int v4lconvert_supported_dst_format(unsigned int pixelformat);
 
117
 
 
118
#ifdef __cplusplus
 
119
}
 
120
#endif /* __cplusplus */
 
121
 
 
122
#endif