Re: Starting a discussion about SANE and TWAIN...

Nick Lamb (njl98r@ecs.soton.ac.uk)
Sun, 15 Aug 1999 03:49:16 +0100 (GMT)

On Sat, 14 Aug 1999, Stephen Williams wrote:

> So all I'm looking for at the moment is some sort of means to negotiate
> frame formats.

Ok. IIRC Your scanners can do RGB, but prefer not to for speed reasons?
So in writing the backend, first start by supporting this (slow) option
as the default and then add an option (eventually to be a well-known
option in SANE 2.0) which controls the compression.

I haven't finished looking at this, but so far I think this will work
for SANE_FRAME_JFIF (perhaps code 6 in the enumeration)

OPTION ONE -- If the backend knows before sending any data how much
there will be exactly in the JFIF image.

format = SANE_FRAME_JFIF (6)
last_frame = TRUE
lines = 1
depth = 8
pixels_per_line = 0
bytes_per_line = sizeof(JFIF image)

OPTION TWO -- If the backend doesn't know how much data there is until
later, or until it runs out.

format = SANE_FRAME_JFIF (6)
last_frame = TRUE
lines = -1
depth = 8
pixels_per_line = 0
bytes_per_line = 4096 (or 65536, whatever)

A compliant SANE 1.0 frontend will reject such frames without danger, a
proposed 2.0 frontend without any JFIF code will save them to a file
and likely use a buffer with size ~= bytes_per_line.
An intelligent SANE 2.0 frontend will know to sane_read(...) until EOF
and then deal with the JFIF data appropriately.

OPTION TWO is probably the one to go for, but I like OPTION ONE at lot
because it's so very simple ;)

Might try to write a modifed scanimage which handles all this tomorrow
if I get a chance. Now, time for bed.

Nick.

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com