1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 1997 David Mosberger-Tang
3    Updates and bugfixes (C) 2002. 2003 Henning Meier-Geinitz
4 
5    This file is part of the SANE package.
6 
7    As a special exception, the authors of SANE give permission for
8    additional uses of the libraries contained in this release of SANE.
9 
10    The exception is that, if you link a SANE library with other files
11    to produce an executable, this does not by itself cause the
12    resulting executable to be covered by the GNU General Public
13    License.  Your use of that executable is in no way restricted on
14    account of linking the SANE library code into it.
15 
16    This exception does not, however, invalidate any other reasons why
17    the executable file might be covered by the GNU General Public
18    License.
19 
20    If you submit changes to SANE to the maintainers to be included in
21    a subsequent release, you agree by submitting the changes that
22    those changes may be distributed with this exception intact.
23 
24    If you write modifications of your own for SANE, it is your choice
25    whether to permit this exception to apply to your modifications.
26    If you do not wish that, delete this exception notice.
27 */
28 
29 #ifndef v4l_h
30 #define v4l_h
31 
32 #include <../include/sane/sane.h>
33 
34 #define MAX_CHANNELS 32
35 
36 typedef enum
37 {
38   V4L_RES_LOW = 0,
39   V4L_RES_HIGH
40 }
41 V4L_Resolution;
42 
43 typedef enum
44 {
45   OPT_NUM_OPTS = 0,
46 
47   OPT_MODE_GROUP,
48   OPT_MODE,
49   OPT_CHANNEL,
50 
51   OPT_GEOMETRY_GROUP,
52   OPT_TL_X,			/* top-left x */
53   OPT_TL_Y,			/* top-left y */
54   OPT_BR_X,			/* bottom-right x */
55   OPT_BR_Y,			/* bottom-right y */
56 
57   OPT_ENHANCEMENT_GROUP,
58   OPT_BRIGHTNESS,
59   OPT_HUE,
60   OPT_COLOR,
61   OPT_CONTRAST,
62   OPT_WHITE_LEVEL,
63 
64   /* must come last: */
65   NUM_OPTIONS
66 }
67 V4L_Option;
68 
69 typedef struct V4L_Device
70 {
71   struct V4L_Device *next;
72   SANE_Device sane;
73 }
74 V4L_Device;
75 
76 typedef struct V4L_Scanner
77 {
78   struct V4L_Scanner *next;
79 
80   SANE_Option_Descriptor opt[NUM_OPTIONS];
81   Option_Value val[NUM_OPTIONS];
82   V4L_Resolution resolution;
83   SANE_Parameters params;
84   SANE_String_Const devicename;	/* Name of the Device */
85   int fd;			/* Filedescriptor */
86   SANE_Int user_corner;		/* bitmask of user-selected coordinates */
87   SANE_Bool scanning;
88   SANE_Bool deliver_eof;
89   SANE_Bool is_mmap;		/* Do we use mmap ? */
90   /* state for reading a frame: */
91   size_t num_bytes;		/* # of bytes read so far */
92   size_t bytes_per_frame;	/* total number of bytes in frame */
93   struct video_capability capability;
94   struct video_picture pict;
95   struct video_window window;
96   struct video_mbuf mbuf;
97   struct video_mmap mmap;
98   SANE_String_Const channel[MAX_CHANNELS];
99   SANE_Int buffercount;
100 }
101 V4L_Scanner;
102 
103 #endif /* v4l_h */
104