kopia lustrzana https://gitlab.com/sane-project/backends
Used GNU indent style.
rodzic
421fa4e12a
commit
2b54c3e7c4
|
@ -88,24 +88,26 @@
|
|||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
struct CHANLIST {
|
||||
char *name;
|
||||
int freq;
|
||||
struct CHANLIST
|
||||
{
|
||||
char *name;
|
||||
int freq;
|
||||
};
|
||||
|
||||
struct CHANLISTS {
|
||||
char *name;
|
||||
struct CHANLIST *list;
|
||||
int count;
|
||||
struct CHANLISTS
|
||||
{
|
||||
char *name;
|
||||
struct CHANLIST *list;
|
||||
int count;
|
||||
};
|
||||
|
||||
#define CHAN_COUNT(x) (sizeof(x)/sizeof(struct CHANLIST))
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
extern struct CHANLISTS chanlists[];
|
||||
extern struct CHANLISTS chanlists[];
|
||||
extern struct STRTAB chanlist_names[];
|
||||
|
||||
extern int chantab;
|
||||
extern struct CHANLIST *chanlist;
|
||||
extern int chancount;
|
||||
extern int chantab;
|
||||
extern struct CHANLIST *chanlist;
|
||||
extern int chancount;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#define VIDEO_RGB08 1 /* bt848 dithered */
|
||||
#define VIDEO_RGB08 1 /* bt848 dithered */
|
||||
#define VIDEO_GRAY 2
|
||||
#define VIDEO_RGB15_LE 3 /* 15 bpp little endian */
|
||||
#define VIDEO_RGB16_LE 4 /* 16 bpp little endian */
|
||||
#define VIDEO_RGB15_BE 5 /* 15 bpp big endian */
|
||||
#define VIDEO_RGB16_BE 6 /* 16 bpp big endian */
|
||||
#define VIDEO_BGR24 7 /* bgrbgrbgrbgr (LE) */
|
||||
#define VIDEO_BGR32 8 /* bgr-bgr-bgr- (LE) */
|
||||
#define VIDEO_RGB24 9 /* rgbrgbrgbrgb (BE)*/
|
||||
#define VIDEO_RGB32 10 /* -rgb-rgb-rgb (BE)*/
|
||||
#define VIDEO_LUT2 11 /* lookup-table 2 byte depth */
|
||||
#define VIDEO_LUT4 12 /* lookup-table 4 byte depth */
|
||||
#define VIDEO_RGB15_LE 3 /* 15 bpp little endian */
|
||||
#define VIDEO_RGB16_LE 4 /* 16 bpp little endian */
|
||||
#define VIDEO_RGB15_BE 5 /* 15 bpp big endian */
|
||||
#define VIDEO_RGB16_BE 6 /* 16 bpp big endian */
|
||||
#define VIDEO_BGR24 7 /* bgrbgrbgrbgr (LE) */
|
||||
#define VIDEO_BGR32 8 /* bgr-bgr-bgr- (LE) */
|
||||
#define VIDEO_RGB24 9 /* rgbrgbrgbrgb (BE) */
|
||||
#define VIDEO_RGB32 10 /* -rgb-rgb-rgb (BE) */
|
||||
#define VIDEO_LUT2 11 /* lookup-table 2 byte depth */
|
||||
#define VIDEO_LUT4 12 /* lookup-table 4 byte depth */
|
||||
|
||||
#define CAN_AUDIO_VOLUME 1
|
||||
|
||||
|
@ -17,37 +17,41 @@
|
|||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
struct STRTAB {
|
||||
long nr;
|
||||
char *str;
|
||||
struct STRTAB
|
||||
{
|
||||
long nr;
|
||||
char *str;
|
||||
};
|
||||
|
||||
struct OVERLAY_CLIP {
|
||||
int x1,x2,y1,y2;
|
||||
struct OVERLAY_CLIP
|
||||
{
|
||||
int x1, x2, y1, y2;
|
||||
};
|
||||
|
||||
struct GRABBER {
|
||||
char *name;
|
||||
int flags;
|
||||
struct STRTAB *norms;
|
||||
struct STRTAB *inputs;
|
||||
struct GRABBER
|
||||
{
|
||||
char *name;
|
||||
int flags;
|
||||
struct STRTAB *norms;
|
||||
struct STRTAB *inputs;
|
||||
|
||||
int (*grab_open)(char *opt);
|
||||
int (*grab_close)(void);
|
||||
int (*grab_open) (char *opt);
|
||||
int (*grab_close) (void);
|
||||
|
||||
int (*grab_setupfb)(int sw, int sh, int format, void *base, int bpl);
|
||||
int (*grab_overlay)(int x, int y, int width, int height, int format,
|
||||
struct OVERLAY_CLIP *oc, int count);
|
||||
int (*grab_setupfb) (int sw, int sh, int format, void *base, int bpl);
|
||||
int (*grab_overlay) (int x, int y, int width, int height, int format,
|
||||
struct OVERLAY_CLIP * oc, int count);
|
||||
|
||||
int (*grab_setparams)(int format, int *width, int *height, int *linelength);
|
||||
void* (*grab_capture)(int single);
|
||||
void (*grab_cleanup)(void);
|
||||
int (*grab_setparams) (int format, int *width, int *height,
|
||||
int *linelength);
|
||||
void *(*grab_capture) (int single);
|
||||
void (*grab_cleanup) (void);
|
||||
|
||||
int (*grab_tune)(unsigned long freq);
|
||||
int (*grab_tuned)(void);
|
||||
int (*grab_input)(int input, int norm);
|
||||
int (*grab_picture)(int color, int bright, int hue, int contrast);
|
||||
int (*grab_audio)(int mute, int volume, int *mode);
|
||||
int (*grab_tune) (unsigned long freq);
|
||||
int (*grab_tuned) (void);
|
||||
int (*grab_input) (int input, int norm);
|
||||
int (*grab_picture) (int color, int bright, int hue, int contrast);
|
||||
int (*grab_audio) (int mute, int volume, int *mode);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
@ -60,11 +64,11 @@ extern int fd_grab;
|
|||
extern struct GRABBER *grabber;
|
||||
|
||||
extern unsigned int format2depth[];
|
||||
extern unsigned char* format_desc[];
|
||||
extern unsigned char *format_desc[];
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int grabber_open(int sw, int sh, void *base, int format, int width);
|
||||
int grabber_setparams(int format, int *width, int *height,
|
||||
int *linelength, int lut_valid);
|
||||
void* grabber_capture(void *dest, int dest_linelength, int single);
|
||||
int grabber_open (int sw, int sh, void *base, int format, int width);
|
||||
int grabber_setparams (int format, int *width, int *height,
|
||||
int *linelength, int lut_valid);
|
||||
void *grabber_capture (void *dest, int dest_linelength, int single);
|
||||
|
|
907
backend/v4l.c
907
backend/v4l.c
Plik diff jest za duży
Load Diff
198
backend/v4l.h
198
backend/v4l.h
|
@ -50,145 +50,145 @@
|
|||
#ifndef v4l_h
|
||||
#define v4l_h
|
||||
|
||||
#include <sane/sane.h>
|
||||
#include <../include/sane/sane.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
V4L_MONO = 0x01,
|
||||
V4L_COLOR = 0x10
|
||||
}
|
||||
{
|
||||
V4L_MONO = 0x01,
|
||||
V4L_COLOR = 0x10
|
||||
}
|
||||
V4L_Model;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
V4L_RES_LOW = 0,
|
||||
V4L_RES_HIGH
|
||||
}
|
||||
{
|
||||
V4L_RES_LOW = 0,
|
||||
V4L_RES_HIGH
|
||||
}
|
||||
V4L_Resolution;
|
||||
|
||||
/* commands common to all quick-cameras: */
|
||||
typedef enum
|
||||
{
|
||||
V4L_SEND_VIDEO_FRAME = 7,
|
||||
V4L_SET_BRIGHTNESS = 11,
|
||||
V4L_SET_TOP = 13,
|
||||
V4L_SET_LEFT = 15,
|
||||
V4L_SET_NUM_V = 17,
|
||||
V4L_SET_NUM_H = 19,
|
||||
V4L_SEND_VERSION = 23,
|
||||
V4L_SET_BLACK = 29,
|
||||
V4L_SET_WHITE = 31,
|
||||
V4L_SET_SATURATION = 35,
|
||||
V4L_SEND_STATUS = 41,
|
||||
V4L_SET_SPEED = 45
|
||||
}
|
||||
{
|
||||
V4L_SEND_VIDEO_FRAME = 7,
|
||||
V4L_SET_BRIGHTNESS = 11,
|
||||
V4L_SET_TOP = 13,
|
||||
V4L_SET_LEFT = 15,
|
||||
V4L_SET_NUM_V = 17,
|
||||
V4L_SET_NUM_H = 19,
|
||||
V4L_SEND_VERSION = 23,
|
||||
V4L_SET_BLACK = 29,
|
||||
V4L_SET_WHITE = 31,
|
||||
V4L_SET_SATURATION = 35,
|
||||
V4L_SEND_STATUS = 41,
|
||||
V4L_SET_SPEED = 45
|
||||
}
|
||||
V4L_Command;
|
||||
|
||||
/* commands for grayscale camera: */
|
||||
typedef enum
|
||||
{
|
||||
V4L_MONO_SET_CONTRAST = 25,
|
||||
V4L_MONO_AUTO_ADJUST_OFFSET = 27,
|
||||
V4L_MONO_GET_OFFSET = 33
|
||||
}
|
||||
{
|
||||
V4L_MONO_SET_CONTRAST = 25,
|
||||
V4L_MONO_AUTO_ADJUST_OFFSET = 27,
|
||||
V4L_MONO_GET_OFFSET = 33
|
||||
}
|
||||
V4L_Mono_Command;
|
||||
|
||||
/* commands for color camera: */
|
||||
typedef enum
|
||||
{
|
||||
V4L_COL_LOAD_RAM = 27,
|
||||
V4L_COL_SET_HUE = 33,
|
||||
V4L_COL_SET_CONTRAST = 37
|
||||
}
|
||||
{
|
||||
V4L_COL_LOAD_RAM = 27,
|
||||
V4L_COL_SET_HUE = 33,
|
||||
V4L_COL_SET_CONTRAST = 37
|
||||
}
|
||||
V4L_Col_Command;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OPT_NUM_OPTS = 0,
|
||||
{
|
||||
OPT_NUM_OPTS = 0,
|
||||
|
||||
OPT_MODE_GROUP,
|
||||
OPT_DEPTH, /* 4 or 6 (b&w) or 24 (color) */
|
||||
OPT_RESOLUTION, /* resolution in pixels */
|
||||
OPT_XFER_SCALE, /* transfer-scale */
|
||||
OPT_DESPECKLE, /* turn on despeckling? */
|
||||
OPT_TEST, /* test image */
|
||||
OPT_MODE_GROUP,
|
||||
OPT_DEPTH, /* 4 or 6 (b&w) or 24 (color) */
|
||||
OPT_RESOLUTION, /* resolution in pixels */
|
||||
OPT_XFER_SCALE, /* transfer-scale */
|
||||
OPT_DESPECKLE, /* turn on despeckling? */
|
||||
OPT_TEST, /* test image */
|
||||
|
||||
OPT_GEOMETRY_GROUP,
|
||||
OPT_TL_X, /* top-left x */
|
||||
OPT_TL_Y, /* top-left y */
|
||||
OPT_BR_X, /* bottom-right x */
|
||||
OPT_BR_Y, /* bottom-right y */
|
||||
OPT_GEOMETRY_GROUP,
|
||||
OPT_TL_X, /* top-left x */
|
||||
OPT_TL_Y, /* top-left y */
|
||||
OPT_BR_X, /* bottom-right x */
|
||||
OPT_BR_Y, /* bottom-right y */
|
||||
|
||||
OPT_ENHANCEMENT_GROUP,
|
||||
OPT_BRIGHTNESS,
|
||||
OPT_CONTRAST,
|
||||
OPT_BLACK_LEVEL,
|
||||
OPT_WHITE_LEVEL,
|
||||
OPT_HUE,
|
||||
OPT_SATURATION,
|
||||
OPT_ENHANCEMENT_GROUP,
|
||||
OPT_BRIGHTNESS,
|
||||
OPT_CONTRAST,
|
||||
OPT_BLACK_LEVEL,
|
||||
OPT_WHITE_LEVEL,
|
||||
OPT_HUE,
|
||||
OPT_SATURATION,
|
||||
|
||||
/* must come last: */
|
||||
NUM_OPTIONS
|
||||
}
|
||||
/* must come last: */
|
||||
NUM_OPTIONS
|
||||
}
|
||||
V4L_Option;
|
||||
|
||||
typedef union
|
||||
{
|
||||
SANE_Word w;
|
||||
SANE_Word *wa; /* word array */
|
||||
SANE_String s;
|
||||
}
|
||||
{
|
||||
SANE_Word w;
|
||||
SANE_Word *wa; /* word array */
|
||||
SANE_String s;
|
||||
}
|
||||
Option_Value;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
V4L_UNIDIR,
|
||||
V4L_BIDIR
|
||||
}
|
||||
{
|
||||
V4L_UNIDIR,
|
||||
V4L_BIDIR
|
||||
}
|
||||
V4L_Port_Mode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t num_bytes; /* # of bytes to read */
|
||||
V4L_Resolution resolution; /* high-resolution? */
|
||||
SANE_Parameters params; /* other parameters */
|
||||
u_int mode; /* qcam scan code (get video data command) */
|
||||
int despeckle; /* apply despeckling filter? */
|
||||
}
|
||||
{
|
||||
size_t num_bytes; /* # of bytes to read */
|
||||
V4L_Resolution resolution; /* high-resolution? */
|
||||
SANE_Parameters params; /* other parameters */
|
||||
u_int mode; /* qcam scan code (get video data command) */
|
||||
int despeckle; /* apply despeckling filter? */
|
||||
}
|
||||
V4L_Scan_Request;
|
||||
|
||||
typedef struct V4L_Device
|
||||
{
|
||||
struct V4L_Device * next;
|
||||
SANE_Device sane;
|
||||
V4L_Port_Mode port_mode;
|
||||
int version; /* camera version */
|
||||
int lock_fd; /* used for locking protocol */
|
||||
}
|
||||
{
|
||||
struct V4L_Device *next;
|
||||
SANE_Device sane;
|
||||
V4L_Port_Mode port_mode;
|
||||
int version; /* camera version */
|
||||
int lock_fd; /* used for locking protocol */
|
||||
}
|
||||
V4L_Device;
|
||||
|
||||
typedef struct V4L_Scanner
|
||||
{
|
||||
struct V4L_Scanner *next;
|
||||
{
|
||||
struct V4L_Scanner *next;
|
||||
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
Option_Value val[NUM_OPTIONS];
|
||||
V4L_Resolution resolution;
|
||||
SANE_Parameters params;
|
||||
SANE_String_Const devicename; /* Name of the Device */
|
||||
int fd; /* Filedescriptor */
|
||||
SANE_Int user_corner; /* bitmask of user-selected coordinates */
|
||||
SANE_Int value_changed; /* bitmask of options that were set */
|
||||
SANE_Bool scanning;
|
||||
SANE_Bool deliver_eof;
|
||||
SANE_Bool mmap; /* Do we use mmap ? */
|
||||
/* state for reading a frame: */
|
||||
size_t num_bytes; /* # of bytes read so far */
|
||||
size_t bytes_per_frame; /* total number of bytes in frame */
|
||||
/* internal state for v4l_readbytes(): */
|
||||
int readbytes_state;
|
||||
unsigned int saved_bits;
|
||||
}
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
Option_Value val[NUM_OPTIONS];
|
||||
V4L_Resolution resolution;
|
||||
SANE_Parameters params;
|
||||
SANE_String_Const devicename; /* Name of the Device */
|
||||
int fd; /* Filedescriptor */
|
||||
SANE_Int user_corner; /* bitmask of user-selected coordinates */
|
||||
SANE_Int value_changed; /* bitmask of options that were set */
|
||||
SANE_Bool scanning;
|
||||
SANE_Bool deliver_eof;
|
||||
SANE_Bool mmap; /* Do we use mmap ? */
|
||||
/* state for reading a frame: */
|
||||
size_t num_bytes; /* # of bytes read so far */
|
||||
size_t bytes_per_frame; /* total number of bytes in frame */
|
||||
/* internal state for v4l_readbytes(): */
|
||||
int readbytes_state;
|
||||
unsigned int saved_bits;
|
||||
}
|
||||
V4L_Scanner;
|
||||
|
||||
#endif /* v4l_h */
|
||||
|
|
Ładowanie…
Reference in New Issue