1 /* fswebcam - FireStorm.cx's webcam generator */
2 /*===========================================================*/
3 /* Copyright (C)2005 Philip Heron <phil@firestorm.cx> */
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. */
16 #define SRC_TYPE_NONE (0)
17 #define SRC_TYPE_DEVICE (1 << 0) /* Can capture from a device */
18 #define SRC_TYPE_FILE (1 << 1) /* Can capture from a file */
20 /* When updating the palette list remember to update src_palette[] in src.c */
22 #define SRC_PAL_ANY (-1)
23 #define SRC_PAL_PNG (0)
24 #define SRC_PAL_JPEG (1)
25 #define SRC_PAL_MJPEG (2)
26 #define SRC_PAL_RGB32 (3)
27 #define SRC_PAL_BGR32 (4)
28 #define SRC_PAL_RGB24 (5)
29 #define SRC_PAL_BGR24 (6)
30 #define SRC_PAL_YUYV (7)
31 #define SRC_PAL_UYVY (8)
32 #define SRC_PAL_YUV420P (9)
33 #define SRC_PAL_NV12MB (10)
34 #define SRC_PAL_BAYER (11)
35 #define SRC_PAL_SGBRG8 (12)
36 #define SRC_PAL_RGB565 (13)
37 #define SRC_PAL_RGB555 (14)
38 #define SRC_PAL_GREY (15)
40 #define SRC_LIST_INPUTS (1 << 1)
41 #define SRC_LIST_TUNERS (1 << 2)
42 #define SRC_LIST_FORMATS (1 << 3)
43 #define SRC_LIST_CONTROLS (1 << 4)
44 #define SRC_LIST_FRAMESIZES (1 << 5)
45 #define SRC_LIST_FRAMERATES (1 << 6)
47 /* The SCALE macro converts a value (sv) from one range (sf -> sr)
48 to another (df -> dr). */
49 #define SCALE(df, dr, sf, sr, sv) (((sv - sf) * (dr - df) / (sr - sf)) + df)
55 extern src_palette_t src_palette
[];
70 /* Last captured image */
91 src_option_t
**option
;
93 /* For calculating capture FPS */
94 uint32_t captured_frames
;
95 struct timeval tv_first
;
96 struct timeval tv_last
;
106 int (*open
)(src_t
*);
107 int (*close
)(src_t
*);
108 int (*grab
)(src_t
*);
112 extern int src_open(src_t
*src
, char *source
);
113 extern int src_close(src_t
*src
);
114 extern int src_grab(src_t
*src
);
116 extern int src_set_option(src_option_t
***options
, char *name
, char *value
);
117 extern int src_get_option_by_number(src_option_t
**opt
, int number
, char **name
, char **value
);
118 extern int src_get_option_by_name(src_option_t
**opt
, char *name
, char **value
);
119 extern int src_free_options(src_option_t
***options
);