kopia lustrzana https://gitlab.com/sane-project/backends
Used GNU indent style.
rodzic
421fa4e12a
commit
2b54c3e7c4
|
@ -88,12 +88,14 @@
|
|||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
struct CHANLIST {
|
||||
struct CHANLIST
|
||||
{
|
||||
char *name;
|
||||
int freq;
|
||||
};
|
||||
|
||||
struct CHANLISTS {
|
||||
struct CHANLISTS
|
||||
{
|
||||
char *name;
|
||||
struct CHANLIST *list;
|
||||
int count;
|
||||
|
|
|
@ -17,16 +17,19 @@
|
|||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
struct STRTAB {
|
||||
struct STRTAB
|
||||
{
|
||||
long nr;
|
||||
char *str;
|
||||
};
|
||||
|
||||
struct OVERLAY_CLIP {
|
||||
struct OVERLAY_CLIP
|
||||
{
|
||||
int x1, x2, y1, y2;
|
||||
};
|
||||
|
||||
struct GRABBER {
|
||||
struct GRABBER
|
||||
{
|
||||
char *name;
|
||||
int flags;
|
||||
struct STRTAB *norms;
|
||||
|
@ -39,7 +42,8 @@ struct GRABBER {
|
|||
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);
|
||||
int (*grab_setparams) (int format, int *width, int *height,
|
||||
int *linelength);
|
||||
void *(*grab_capture) (int single);
|
||||
void (*grab_cleanup) (void);
|
||||
|
||||
|
|
|
@ -52,11 +52,11 @@
|
|||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#ifdef _AIX
|
||||
# include "lalloca.h" /* MUST come first for AIX! */
|
||||
# include "../include/lalloca.h" /* MUST come first for AIX! */
|
||||
#endif
|
||||
|
||||
#include "sane/config.h"
|
||||
#include "lalloca.h"
|
||||
#include "../include/sane/config.h"
|
||||
#include "../include/lalloca.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
@ -79,13 +79,13 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#include "sane/sane.h"
|
||||
#include "sane/sanei.h"
|
||||
#include "sane/saneopts.h"
|
||||
#include "../include/sane/sane.h"
|
||||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
|
||||
#include "v4l-grab.h"
|
||||
#if what_is_this
|
||||
# include "colorspace.h"
|
||||
# include "colorspace.h" /* ??? */
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <asm/types.h> /* XXX glibc */
|
||||
|
@ -99,13 +99,13 @@
|
|||
#include "v4l.h"
|
||||
|
||||
#define BACKEND_NAME v4l
|
||||
#include "sane/sanei_backend.h"
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
#include "sane/sanei_config.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
#define V4L_CONFIG_FILE "v4l.conf"
|
||||
|
||||
static const SANE_Device **devlist = NULL;
|
||||
|
@ -117,34 +117,29 @@ static char *buffer;
|
|||
static int buffercount;
|
||||
|
||||
|
||||
static const SANE_String_Const resolution_list[] =
|
||||
{
|
||||
static const SANE_String_Const resolution_list[] = {
|
||||
"Low", /* million-mode */
|
||||
"High", /* billion-mode */
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static const SANE_Int color_depth_list[] =
|
||||
{
|
||||
static const SANE_Int color_depth_list[] = {
|
||||
3, /* # of elements */
|
||||
6, 8, 24 /* "thousand" mode not implemented yet */
|
||||
};
|
||||
|
||||
static const SANE_Int xfer_scale_list[] =
|
||||
{
|
||||
static const SANE_Int xfer_scale_list[] = {
|
||||
4, /* # of elements */
|
||||
1, 2, 4, 8
|
||||
};
|
||||
|
||||
static const SANE_Range u8_range =
|
||||
{
|
||||
static const SANE_Range u8_range = {
|
||||
/* min, max, quantization */
|
||||
0, 255, 0
|
||||
};
|
||||
|
||||
static const SANE_Range brightness_range =
|
||||
{
|
||||
static const SANE_Range brightness_range = {
|
||||
/* min, max, quantization */
|
||||
0, 255, 0 /* 255 is bulb mode! */
|
||||
};
|
||||
|
@ -158,8 +153,7 @@ static SANE_Range y_range = {0,249,1};
|
|||
static SANE_Range odd_y_range = { 1, 250, 1 };
|
||||
|
||||
|
||||
static SANE_Parameters parms =
|
||||
{
|
||||
static SANE_Parameters parms = {
|
||||
SANE_FRAME_RGB,
|
||||
1, /* 1 = Last Frame , 0 = More Frames to come */
|
||||
0, /* Number of bytes returned per scan line: */
|
||||
|
@ -604,12 +598,14 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize)
|
|||
attach (dev_name, 0);
|
||||
}
|
||||
else
|
||||
DBG (1, "sane_init: ioctl (%d, VIDIOCGCAP,..) failed on `%s': %s\n",
|
||||
DBG (1,
|
||||
"sane_init: ioctl (%d, VIDIOCGCAP,..) failed on `%s': %s\n",
|
||||
v4ldev, dev_name, strerror (errno));
|
||||
close (v4ldev);
|
||||
}
|
||||
else
|
||||
DBG (1, "sane_init: failed to open device `%s': %s\n", dev_name, strerror (errno));
|
||||
DBG (1, "sane_init: failed to open device `%s': %s\n", dev_name,
|
||||
strerror (errno));
|
||||
}
|
||||
fclose (fp);
|
||||
return SANE_STATUS_GOOD;
|
||||
|
@ -971,7 +967,8 @@ sane_start (SANE_Handle handle)
|
|||
if (-1 == ioctl (s->fd, VIDIOCGMBUF, &ov_mbuf))
|
||||
{
|
||||
s->mmap = FALSE;
|
||||
buffer = malloc(capability.maxwidth * capability.maxheight * pict.depth);
|
||||
buffer =
|
||||
malloc (capability.maxwidth * capability.maxheight * pict.depth);
|
||||
if (0 == buffer)
|
||||
return SANE_STATUS_NO_MEM;
|
||||
DBG (2, "sane_start: V4L READING Frame\n");
|
||||
|
@ -984,7 +981,8 @@ sane_start (SANE_Handle handle)
|
|||
DBG (2, "sane_start: MMAP Frame\n");
|
||||
DBG (2, "sane_start: Buffersize %d , Buffers %d , Offset %p\n",
|
||||
ov_mbuf.size, ov_mbuf.frames, ov_mbuf.offsets);
|
||||
buffer = mmap (0,ov_mbuf.size,PROT_READ|PROT_WRITE,MAP_SHARED,s->fd,0);
|
||||
buffer =
|
||||
mmap (0, ov_mbuf.size, PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, 0);
|
||||
DBG (2, "sane_start: MMAPed Frame, Capture 1 Pict into %p\n", buffer);
|
||||
gb.frame = 0;
|
||||
gb.width = window.width;
|
||||
|
@ -1001,7 +999,8 @@ sane_start (SANE_Handle handle)
|
|||
len = ioctl (v4ldev, VIDIOCSYNC, &(gb.frame));
|
||||
if (-1 == len)
|
||||
{
|
||||
DBG (1, "sane_start: Call to ioctl(%d, VIDIOCSYNC, ..) failed\n", v4ldev);
|
||||
DBG (1, "sane_start: Call to ioctl(%d, VIDIOCSYNC, ..) failed\n",
|
||||
v4ldev);
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#ifndef v4l_h
|
||||
#define v4l_h
|
||||
|
||||
#include <sane/sane.h>
|
||||
#include <../include/sane/sane.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue