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