1 /* fswebcam - FireStorm.cx's webcam generator */
2 /*============================================================*/
3 /* Copyright (C)2005-2010 Philip Heron <phil@sanslogic.co.uk> */
5 /* This program is distributed under the terms of the GNU */
6 /* General Public License, version 2. You may use, modify, */
7 /* and redistribute it under the terms of this license. A */
8 /* copy should be included with this source. */
26 #define SRC_TYPE_NONE (0)
27 #define SRC_TYPE_DEVICE (1 << 0) /* Can capture from a device */
28 #define SRC_TYPE_FILE (1 << 1) /* Can capture from a file */
30 /* When updating the palette list remember to update src_palette[] in src.c */
32 #define SRC_PAL_ANY (-1)
33 #define SRC_PAL_PNG (0)
34 #define SRC_PAL_JPEG (1)
35 #define SRC_PAL_MJPEG (2)
36 #define SRC_PAL_S561 (3)
37 #define SRC_PAL_RGB32 (4)
38 #define SRC_PAL_BGR32 (5)
39 #define SRC_PAL_RGB24 (6)
40 #define SRC_PAL_BGR24 (7)
41 #define SRC_PAL_YUYV (8)
42 #define SRC_PAL_UYVY (9)
43 #define SRC_PAL_YUV420P (10)
44 #define SRC_PAL_NV12MB (11)
45 #define SRC_PAL_BAYER (12)
46 #define SRC_PAL_SGBRG8 (13)
47 #define SRC_PAL_SGRBG8 (14)
48 #define SRC_PAL_RGB565 (15)
49 #define SRC_PAL_RGB555 (16)
50 #define SRC_PAL_Y16 (17)
51 #define SRC_PAL_GREY (18)
53 #define SRC_LIST_INPUTS (1 << 1)
54 #define SRC_LIST_TUNERS (1 << 2)
55 #define SRC_LIST_FORMATS (1 << 3)
56 #define SRC_LIST_CONTROLS (1 << 4)
57 #define SRC_LIST_FRAMESIZES (1 << 5)
58 #define SRC_LIST_FRAMERATES (1 << 6)
60 /* The SCALE macro converts a value (sv) from one range (sf -> sr)
61 to another (df -> dr). */
62 #define SCALE(df, dr, sf, sr, sv) (((sv - sf) * (dr - df) / (sr - sf)) + df)
68 extern src_palette_t src_palette[];
83 /* Last captured image */
104 src_option_t **option;
106 /* For calculating capture FPS */
107 uint32_t captured_frames;
108 struct timeval tv_first;
109 struct timeval tv_last;
119 int (*open)(src_t *);
120 int (*close)(src_t *);
121 int (*grab)(src_t *);
122 const char *(*query)(src_t *, int*, int*, char **);
128 /* List of options. */
130 const struct option *long_opts;
132 /* When reading from the command line. */
135 /* When reading from a configuration file. */
149 /* General options. */
152 unsigned char background;
157 /* Capture start time. */
160 /* Device options. */
164 unsigned long frequency;
169 /* Image capture options. */
174 unsigned int skipframes;
176 src_option_t **option;
181 fswebcam_job_t **job;
183 /* Banner options. */
196 /* Overlay options. */
200 /* Output options. */
207 extern int src_open(src_t *src, char *source);
208 extern int src_close(src_t *src);
209 extern int src_grab(src_t *src);
210 extern const char *src_query(src_t *src, char *source, int *width, int *height, char **pixelformat);
212 extern int src_set_option(src_option_t ***options, char *name, char *value);
213 extern int src_get_option_by_number(src_option_t **opt, int number, char **name, char **value);
214 extern int src_get_option_by_name(src_option_t **opt, char *name, char **value);
215 extern int src_free_options(src_option_t ***options);