Remove obsolete camlib.

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@6644 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Till Adam
2003-08-15 20:14:49 +00:00
parent 7b04de1a12
commit be72bf3889
24 changed files with 0 additions and 3469 deletions

View File

@@ -1,10 +0,0 @@
*~ .*~
*.lo
*.la
.libs
.deps
Makefile
Makefile.in
*.patch
protocol.xml
crw

View File

@@ -1,9 +0,0 @@
Mon Jan 20 20:45:15 2003 Till Adam <till@adam-lilienthal.de>
* remove unused exit handler
* write the current date and time to the cam in init, to sync it. It seems
to require that occasionally to be able to keep time.
Sam Jan 18 22:00:10 2003 Till Adam <till@adam-lilienthal.de>
* initial import

View File

@@ -1,12 +0,0 @@
camlib_LTLIBRARIES = libgphoto2_benq.la
INCLUDES = \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/libgphoto2_port/libgphoto2_port \
-I$(top_srcdir)/libgphoto2 \
-I$(top_builddir)/libgphoto2
libgphoto2_benq_la_SOURCES = benq.c \
benq.h library.c
libgphoto2_benq_la_LDFLAGS = -module -avoid-version
libgphoto2_benq_la_LIBADD = $(top_builddir)/libgphoto2/libgphoto2.la

View File

@@ -1,20 +0,0 @@
What is it?
-----------
This is a camlib supporting the Benq DC1300 camera and possibly others. It was
implemented using information obtained by sniffing the usb bus on Windows,
disassembling the windows driver dll's and some guesswork.
Features
--------
It currently supports downloading of images and deleting all files on the
camera.
Author
-------
Till Adam <till@adam-lilienthal.de>
Thanks
------
Johan Nilsson <jni@users.sourceforge.net> made windows snoops, tested the
early versions and helped debug them. Without him, this would not have been
possible.

View File

@@ -1,208 +0,0 @@
/****************************************************************/
/* benq.c - Gphoto2 library for Benq DC1300 cameras and friends */
/* */
/* Author: Till Adam <till@adam-lilienthal.de> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "benq.h"
#include <gphoto2.h>
#include <gphoto2-port.h>
#include <gphoto2-port-log.h>
#define GP_MODULE "benq"
static int
benq_wait_for_ready(GPPort *port)
{
int timeout = 30;
uint8_t ready = 0;
while (timeout--) {
sleep(1);
CHECK (gp_port_usb_msg_read (port, 0x21, 0x0000, 0x0000,
(char*)&ready, 0x01));
if (ready)
return GP_OK;
}
return GP_ERROR;
}
int
benq_get_TOC(CameraPrivateLibrary *pl, int *filecount)
{
uint16_t n_toc_entries;
int toc_size = 0;
CHECK (gp_port_usb_msg_read (pl->gpdev, 0x54, 0x0000, 0x0000,
(char*)&n_toc_entries, 0x02));
*filecount = n_toc_entries;
if (n_toc_entries == 0)
return GP_OK;
/* Request the TOC */
CHECK (gp_port_usb_msg_read (pl->gpdev, 0x54, n_toc_entries, 0x0001,
NULL, 0x00));
/* slurp it in. Supposedly there's 32 bytes in each entry. */
toc_size = n_toc_entries * 32;
/* align */
if (toc_size % 512 != 0)
toc_size = ((toc_size / 512) + 1) * 512;
if (pl->toc)
free (pl->toc);
pl->toc = malloc(toc_size);
if (!pl->toc)
return GP_ERROR_NO_MEMORY;
CHECK (benq_wait_for_ready(pl->gpdev));
CHECK (gp_port_read (pl->gpdev, pl->toc, toc_size));
return GP_OK;
}
int
benq_get_filecount (GPPort *port, int *filecount)
{
uint16_t response = 0;
CHECK (gp_port_usb_msg_read (port, 0x54, 0x0000, 0x0000,
(char*)&response, 0x02));
*filecount = response;
return GP_OK;
}
int
benq_delete_all (GPPort *port)
{
CHECK (gp_port_usb_msg_write (port, 0x52, 0x0, 0x0, NULL, 0x0));
return GP_OK;
}
int
benq_get_file_name (CameraPrivateLibrary *lib, int index, char *name)
{
uint8_t *p;
p = lib->toc + index*32;
memcpy (name, p, 8);
name[8] = '.';
memcpy (name+9, p+8, 3);
name[12] = '\0';
return GP_OK;
}
int
benq_get_file_size (CameraPrivateLibrary *lib, int index, int *size)
{
uint8_t *p;
p = lib->toc + index*32;
*size = (p[0x1c] & 0xff)
+ (p[0x1d] & 0xff) * 0x100
+ (p[0x1e] & 0xff) * 0x10000
+ (p[0x1f] & 0xff) * 0x1000000;
return GP_OK;
}
int
benq_get_file (CameraPrivateLibrary *lib, GPContext *context,
uint8_t ** data, unsigned int *len, int index, int thumbnail)
{
uint32_t file_size = 0, aligned_size = 0;
uint32_t addr = 0;
uint8_t *p, *buf;
p = lib->toc + index*32;
aligned_size = file_size =
(p[0x1c] & 0xff)
+ (p[0x1d] & 0xff) * 0x100
+ (p[0x1e] & 0xff) * 0x10000;
addr = (p[0x18] & 0xff)
+ (p[0x19] & 0xff) * 0x100
+ (p[0x1a] & 0xff) * 0x10000
+ (p[0x1b] & 0xff) * 0x1000000;
/* Trigger download of image data */
CHECK (gp_port_usb_msg_write (lib->gpdev,
0x54, index+1, 0x0002, NULL, 0x00));
/* align */
if (file_size % 16384 != 0)
aligned_size = ((file_size / 16384) + 1) * 16384;
buf = malloc (aligned_size);
if (!buf)
return GP_ERROR_NO_MEMORY;
CHECK (benq_wait_for_ready(lib->gpdev));
CHECK (gp_port_read (lib->gpdev, buf, aligned_size));
*data = buf;
*len = file_size;
return GP_OK;
}
int
benq_init (GPPort *port, GPContext *context)
{
uint8_t bytes[7];
time_t t;
struct tm *ftm;
int i;
/* firmware detection */
CHECK (gp_port_usb_msg_read (port, 0x20, 0x0000, 0x0000, bytes, 0x01));
CHECK (gp_port_usb_msg_read (port, 0x20, 0x0000, 0x0000, bytes, 0x05));
CHECK (gp_port_usb_msg_read (port, 0x21, 0x0000, 0x0000, bytes, 0x01));
/*
* The cam is supposed to sync up with the computer time here
* somehow, or at least that's what we think.
*/
time(&t);
ftm = localtime(&t);
bytes[0] = ftm->tm_sec;
bytes[1] = ftm->tm_min;
bytes[2] = ftm->tm_hour;
bytes[3] = 0; /* what is that? either 0x0 or 0x6 */
bytes[4] = ftm->tm_mday;
bytes[5] = ftm->tm_mon+1;
bytes[6] = ftm->tm_year-100; /* stupido. Year is 1900 + tm_year.
We need two digits only. */
GP_DEBUG("Timestamp: %4d-%02d-%02d %2d:%02d:%02d",
ftm->tm_year+1900,ftm->tm_mon+1,ftm->tm_mday,
ftm->tm_hour,ftm->tm_min,ftm->tm_sec);
for (i=0;i<7;i++)
CHECK (gp_port_usb_msg_write (port, 0x29, 0x0000, i,
bytes+i, 0x01));
return GP_OK;
}

View File

@@ -1,41 +0,0 @@
/* benq.h
*
* This library is free software; you can redistribute and/or
* modify it inder the terms of the GNU Lesser Genreral Public
* License as publiced by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warrenty of
* MERCHANTABULITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* lesser General Public License for more details.
*
* Author: Till Adam <till@adam-lilienthal.de>
*/
#ifndef __BENQ_H__
#define __BENQ_H__
#include <inttypes.h>
#include <gphoto2.h>
#include <gphoto2-port.h>
#define CHECK(result) {int res; res = result; if (res < 0) return (res);}
struct _CameraPrivateLibrary
{
GPPort *gpdev;
uint8_t *toc;
};
int benq_init(GPPort *port, GPContext *context);
int benq_get_TOC(CameraPrivateLibrary *pl, int *filecount);
int benq_get_file_name(CameraPrivateLibrary *pl, int index, char *name);
int benq_get_file (CameraPrivateLibrary *lib, GPContext *context,
uint8_t **buf, unsigned int *len, int index, int thumbnail);
int benq_get_file_size(CameraPrivateLibrary *pl, int index, int *size);
int benq_get_filecount(GPPort *port, int *filecount);
int benq_delete_all (GPPort *port);
#endif

View File

@@ -1,238 +0,0 @@
/****************************************************************/
/*library.c - Gphoto2 library for Benq DC1300 cameras and */
/* friends */
/* */
/* Author: Till Adam <till@adam-lilienthal.de> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#include "config.h"
#include "benq.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gphoto2.h>
#include <gphoto2-port.h>
#define GP_MODULE "benq"
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (GETTEXT_PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define _(String) (String)
# define N_(String) (String)
#endif
struct models
{
char *name;
unsigned short idVendor;
unsigned short idProduct;
}
models[] =
{
{"Benq:DC1300", 0x04a5, 0x3003},
{ NULL, 0, 0}
};
static int delete_all_func (CameraFilesystem *fs, const char *folder,
void *data, GPContext *context);
int
camera_id (CameraText *id)
{
strcpy (id->text, "benq");
return (GP_OK);
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof (CameraAbilities));
strcpy (a.model, models[i].name);
a.status = GP_DRIVER_STATUS_EXPERIMENTAL;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product = models[i].idProduct;
a.operations = GP_OPERATION_NONE;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_DELETE;
gp_abilities_list_append (list, a);
}
return GP_OK;
}
static int
file_list_func (CameraFilesystem *fs, const char *folder,
CameraList *list, void *data, GPContext *context)
{
Camera *camera = data;
int i = 0, filecount = 0;
char temp_file[14];
CHECK (benq_get_TOC(camera->pl, &filecount));
for (i=0; i<filecount; i++)
{
CHECK(benq_get_file_name (camera->pl, i, temp_file));
gp_list_append (list, temp_file, NULL);
}
return GP_OK;
}
static int
get_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileType type,
CameraFile *file, void *user_data, GPContext *context)
{
Camera *camera = user_data;
unsigned char *data = NULL;
int size, number;
CHECK (number =
gp_filesystem_number (camera->fs, folder, filename, context));
switch (type) {
case GP_FILE_TYPE_NORMAL:
CHECK (benq_get_file (camera->pl, context,
&data, &size, number, 0));
break;
case GP_FILE_TYPE_PREVIEW:
CHECK (benq_get_file (camera->pl, context,
&data, &size, number, 1));
CHECK (gp_file_set_mime_type (file, GP_MIME_BMP));
break;
default:
return GP_ERROR_NOT_SUPPORTED;
}
if (!data)
return GP_ERROR;
CHECK (gp_file_set_data_and_size (file, data, size));
CHECK (gp_file_set_name (file, filename));
return GP_OK;
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text,
("benq camlib\n"
"Author: Till Adam\n <till@adam-lilienthal.de>\n"));
return GP_OK;
}
static int
get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileInfo *info, void *data, GPContext *context)
{
Camera *camera = data;
int n, filecount;
unsigned int size;
char name[14];
/* Get the file number from the CameraFileSystem */
CHECK (n =
gp_filesystem_number (camera->fs, folder, filename, context));
CHECK (benq_get_TOC(camera->pl, &filecount));
CHECK (benq_get_file_name(camera->pl, n, name));
CHECK (benq_get_file_size(camera->pl, n, &size));
info->file.fields = GP_FILE_INFO_NAME | GP_FILE_INFO_SIZE;
strncpy (info->file.name, name, sizeof (info->file.name));
info->file.size = size;
return GP_OK;
}
static int
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
GPContext *context)
{
Camera *camera = data;
CHECK (benq_delete_all (camera->port));
return GP_OK;
}
int
camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
int ret = 0;
camera->functions->about = camera_about;
switch (camera->port->type) {
case GP_PORT_USB:
ret = gp_port_get_settings (camera->port, &settings);
if (ret < 0)
return ret;
settings.usb.inep = 0x82;
settings.usb.outep = 0x03;
settings.usb.config = 1;
settings.usb.interface = 1;
settings.usb.altsetting = 0;
ret = gp_port_set_settings (camera->port, settings);
if (ret < 0)
return ret;
break;
case GP_PORT_SERIAL:
return GP_ERROR_IO_SUPPORTED_SERIAL;
default:
return GP_ERROR_NOT_SUPPORTED;
}
CHECK (benq_init (camera->port, context));
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
return (GP_ERROR_NO_MEMORY);
memset (camera->pl, 0, sizeof (CameraPrivateLibrary));
camera->pl->gpdev = camera->port;
gp_filesystem_set_info_funcs (camera->fs, get_info_func, NULL, camera);
gp_filesystem_set_list_funcs (camera->fs, file_list_func, NULL, camera);
gp_filesystem_set_file_funcs (camera->fs, get_file_func, NULL, camera);
gp_filesystem_set_folder_funcs
(camera->fs, NULL, delete_all_func, NULL, NULL, camera);
return GP_OK;
}

View File

@@ -1,6 +0,0 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.la

View File

@@ -1,86 +0,0 @@
Fri Jan 24 12:15:01 2003 Till Adam <till@adam-lilienthal.de>
* fix thumbnail colors for low res images. Ported from a patch by
Mark Zimmerman <mark@foresthaven.com> for the spca504_flash camlib
Don Jan 16 23:34:21 2003 Till Adam <till@adam-lilienthal.de>
* add avi support for the Maxell and related models
Don Jan 16 20:44:22 2003 Till Adam <till@adam-lilienthal.de>
* add experimental support for the Maxell Max Pocket cam with a slightly
different firmware
* bump version number to 0.4
Sam Dez 07 21:04:46 2002 Till Adam <till@adam-lilienthal.de>
* the lowest res of the mini is a different format, cope with that
* fix cases where the number of frames advertised by one of the fat pages of
an avi exceed the total number of frames it has
(Reported by Gerd Flaig <gefla@pond.sub.org>)
Tue Nov 05 12:17:30 2002 Till Adam <till@adam-lilienthal.de>
* return unssuported for avi downloading and small and large image
resolutions if the bridge is a SPCA500 (gsmart mini).
Sat Oct 19 22:52:34 2002 Till Adam <till@adam-lilienthal.de>
* another patch from Piotr Pawlow <pp@sieziba.pl> which omits the standard
huffmann tables in the mjpeg thereby reducing them in size. This seems
to be a standard extension of the mjpeg "standard" and works with the
players I've tested
Mon Oct 14 20:32:08 2002 Till Adam <till@adam-lilienthal.de>
* move jpeg creation into function
* add experimental support for the "gsmart mini"
* bump version number to 0.3
* driver status for the spca504a based is now TESTING
* patch from Piotr Pawlow <pp@siedziba.pl> adding an index to downloaded
avi's and fixing a few bugs.
* endianess fixes
Wed Oct 09 19:58:01 2002 Till Adam <till@adam-lilienthal.de>
* add experimental support for the "gSmart mini 3" and "So. Show 301"
* (identical to the gSmart mini 2)
Tue Oct 08 22:14:04 2002 Till Adam <till@adam-lilienthal.de>
* add support for avi downloading
2002-10-03 Lutz Müller <lutz@users.sourceforge.net>
* Makefile.am: -I$(top_builddir)/libgphoto2
Sam Aug 31 20:15:03 2002 Till Adam <till@adam-lilienthal.de>
* return name in the file_info as well. Fixes kamera kio-slave
* endianess fix reported by Carl Lunde <chlunde@student.matnat.uio.no>
* spelling fix
Thu Aug 22 20:46:02 2002 Till Adam <till@adam-lilienthal.de>
* add support for avi thumbnails
Tue Aug 13 21:37:08 2002 Till Adam <till@adam-lilienthal.de>
* add a little timeout after deletion of a file. The camera ignores
successive deletes otherwise.
Tue Aug 13 14:13:27 2002 Till Adam <till@adam-lilienthal.de>
* disallow deletion of anything but the last file on the camera
Sat Aug 10 19:03:31 2002 Till Adam <till@adam-lilienthal.de>
* remove debugging calls
* allocate space for GsmartFile structures dynamically
* sprintf -> snprintf, strcpy -> strncpy, fprintf -> gp_context_error
* make internally used functions static and remove them from gsmart.h
Mon Aug 05 00:01:06 2002 Till Adam <till@adam-lilienthal.de>
* initial release of the module

View File

@@ -1,13 +0,0 @@
camlib_LTLIBRARIES = libgphoto2_gsmart.la
INCLUDES = \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/libgphoto2_port/libgphoto2_port \
-I$(top_srcdir)/libgphoto2 \
-I$(top_builddir)/libgphoto2
libgphoto2_gsmart_la_SOURCES = gsmart.c gsmart.h library.c \
gsmart-jpeg-header.h gsmart-registers.h \
gsmart-avi-header.h
libgphoto2_gsmart_la_LDFLAGS = -module -avoid-version
libgphoto2_gsmart_la_LIBADD = $(top_builddir)/libgphoto2/libgphoto2.la

View File

@@ -1,58 +0,0 @@
Mustek gSmart mini
This driver is based on the windows driver source for the gSmart mini 2 kindly
provided by Mustek. It is known to work with the following camera models:
Mustek gSmart mini
Mustek gSmart mini 2
Mustek gSmart mini 3
So. Show 301 (identical to the mini 3)
Aiptek 1.3 mega PocketCam
Maxell Max Pocket
If you want to hack on this module, or have questions or suggestions,
don't hesitate to email me:
Till Adam <till@adam-lilienthal.de>
---------------------------------------------------------------
NOTE
----
The cameras always delete the last file on them, no matter what file number is
passed to it for deletion. It is impossible to delete a specific image or
movie on the camera.
----------------------------------------------------------------
TODO
----
The cameras of this series are based on the spca504a and spca500 chip
manufactured by Sunplus. Both chips are capable of streaming, so there's a
project working on video4linux support for them. spca50x.sourceforge.net
-----------------------------------------------------------------
Thanks
-------
Special thanks go to Bjorn Borud <borud@gua.no> who extorted the above
mentioned sources for the windows driver from Mustek and to Buster Lee at
Mustek for being helpful and responsive.
Special thanks also to Tim Sampson <tim@columbia-staver.co.uk>, who made the
support for spca500 based cams (such as the gsmart mini) possible by boldly
trying out my untested alpha versions.
Adam Pribyl <covex@ahoj.fsik.cvut.cz> helped debugging the lowest resolution
of the gsmart mini and had to put his cam in the fridge (!) several times in
the process. Brave man. ;)
Michel Xhaard <mxhaard@free.fr> helped add support for the Maxell Max Pocket
with patches and testing. Thanks a lot.
Very special thanks to Piotr Pawlow <pp@siedziba.pl> for adding avi index
functionality and fixing a few bugs.
Also thanks to the following people for testing and feedback:
Torfinn Ingolfsen <torfinn.ingolfsen@broadpark.no>
Mikael Nilsson <mini@nada.kth.se>
Miah Gregory <mace@darksilence.net>
Soenke Reimers <soenke.reimers@freenet.de>
Gerd Flaig <gefla@pond.sub.org>

View File

@@ -1,76 +0,0 @@
#ifndef __GSMART_AVI_HEADER_H
#define __GSMART_AVI_HEADER_H
#define GSMART_AVI_FRAME_HEADER_LENGTH 8
uint8_t GsmartAviFrameHeader[GSMART_AVI_FRAME_HEADER_LENGTH] = {
0x30, 0x30, 0x64, 0x63, // 00dc
0x00, 0x00, 0x00, 0x00 // size of frame
};
#define GSMART_AVI_HEADER_LENGTH 224
uint8_t GsmartAviHeader[GSMART_AVI_HEADER_LENGTH] = {
/* -- RIFF HEADER -- */
0x52, 0x49, 0x46, 0x46, // 0x00; RIFF
0x00, 0x00, 0x00, 0x00, // 0x04; number of bytes following
0x41, 0x56, 0x49, 0x20, // 0x08; AVI
0x4C, 0x49, 0x53, 0x54, // 0x0c; LIST
0xC0, 0x00, 0x00, 0x00, // 0x10; length of list in bytes
0x68, 0x64, 0x72, 0x6C, // 0x14; hdrl
0x61, 0x76, 0x69, 0x68, // 0x18; avih
0x38, 0x00, 0x00, 0x00, // 0x1c; number of bytes to follow
0xb5, 0x8c, 0x01, 0x00, // 0x20; microseconds per frame
0x00, 0x00, 0x06, 0x00, // 0x24; max bytes per second
0x00, 0x00, 0x00, 0x00, // 0x28; PaddingGranularity (whatever that might be)
// Other sources call it 'reserved'
0x10, 0x00, 0x01, 0x00, // 0x2c; flags, WASCAPTUREFILE | HASINDEX
0x00, 0x00, 0x00, 0x00, // 0x30; total frames
0x00, 0x00, 0x00, 0x00, // 0x34: initial frames
0x01, 0x00, 0x00, 0x00, // 0x38: number of streams
0x00, 0x00, 0x00, 0x00, // 0x3c: suggested buffer size
0x40, 0x01, 0x00, 0x00, // 0x40: width
0xf0, 0x00, 0x00, 0x00, // 0x44: height
0x00, 0x00, 0x00, 0x00, // 0x48: some reserved long values
0x00, 0x00, 0x00, 0x00, // 0x4c:
0x00, 0x00, 0x00, 0x00, // 0x50:
0x00, 0x00, 0x00, 0x00, // 0x54:
/* -- video stream list -- */
0x4C, 0x49, 0x53, 0x54, // 0x58: LIST
0x74, 0x00, 0x00, 0x00, // 0x5c: length of list in bytes
0x73, 0x74, 0x72, 0x6C, // 0x60: strl
/* -- video stream header -- */
0x73, 0x74, 0x72, 0x68, // 0x64: strh
0x38, 0x00, 0x00, 0x00, // 0x68: # of bytes to follow
0x76, 0x69, 0x64, 0x73, // 0x6c: vids
0x4D, 0x4A, 0x50, 0x47, // 0x70: MJPG
0x00, 0x00, 0x00, 0x00, // 0x74: some more reserved longs
0x00, 0x00, 0x00, 0x00, // 0x78:
0x00, 0x00, 0x00, 0x00, // 0x7c:
0x33, 0x18, 0x00, 0x00, // 0x80: ms_per_frame scale
0x48, 0xEE, 0x00, 0x00, // 0x84: Rate: Rate/Scale == samples/second
0x00, 0x00, 0x00, 0x00, // 0x88: start
0x00, 0x00, 0x00, 0x00, // 0x8c: length (video_frames)
0x00, 0x00, 0x00, 0x00, // 0x90: suggested buffer size
0xFF, 0xFF, 0xFF, 0xFF, // 0x94: quality
0x00, 0x00, 0x00, 0x00, // 0x98: sample size
0x00, 0x00, 0x00, 0x00, // 0x9c: frame
0x00, 0x00, 0x00, 0x00, // 0xa0: frame
/* -- video stream format -- */
0x73, 0x74, 0x72, 0x66, // 0xa4: strf
0x28, 0x00, 0x00, 0x00, // 0xa8: number of bytes to follow (40)
0x28, 0x00, 0x00, 0x00, // 0xac: size (dito)
0x40, 0x01, 0x00, 0x00, // 0xb0: width
0xf0, 0x00, 0x00, 0x00, // 0xb4: height
0x01, 0x00, 0x0C, 0x00, // 0xb8: planes(1) : count(24)
0x4D, 0x4A, 0x50, 0x47, // 0xbc: encoder MJPG
0x00, 0xC2, 0x01, 0x00, // 0xc0: Size image
0x00, 0x00, 0x00, 0x00, // 0xc4: XPelsPerMeter
0x00, 0x00, 0x00, 0x00, // 0xc8: YPelsPerMeter
0x00, 0x00, 0x00, 0x00, // 0xcc: Number of colors used
0x00, 0x00, 0x00, 0x00, // 0xd0: Number of colors important
/* do we have to pad with JUNK here ? */
0x4C, 0x49, 0x53, 0x54, // 0xd4: LIST
0x00, 0x00, 0x00, 0x00, // 0xd8: size of list
0x6D, 0x6F, 0x76, 0x69 // 0xda: movi
};
#endif /* __GSMART_AVI_HEADER_H */

View File

@@ -1,273 +0,0 @@
#ifndef __GSMART_JPEG_HEADER_H
#define __GSMART_JPEG_HEADER_H
/*
* Start from 0 -> 588
* 7 - 70 : Quantization Table[0]
* 72 - 135 : Quantization Table[1]
*/
#define GSMART_JPG_DEFAULT_HEADER_PART1_LENGTH 136
#define GSMART_JPG_DEFAULT_HEADER_PART2_LENGTH 420
#define GSMART_JPG_DEFAULT_HEADER_PART3_LENGTH 33
#define GSMART_JPG_DEFAULT_HEADER_LENGTH 589
uint8_t GsmartJPGDefaultHeaderPart1[GSMART_JPG_DEFAULT_HEADER_PART1_LENGTH] = {
//SOI(Start of Image)
0xFF,0xD8,
//DQT(Define Quantization Table)
0xFF,0xDB,
0x00,0x84,
0x00,
0x05,0x03,0x04,0x04,0x04,0x03,0x05,0x04,0x04,0x04,0x06,0x05,0x05,0x06,0x08,0x0D,
0x08,0x08,0x07,0x07,0x08,0x10,0x0C,0x0C,0x0A,0x0D,0x14,0x11,0x15,0x14,0x13,0x11,
0x13,0x13,0x16,0x18,0x1F,0x1A,0x16,0x17,0x1E,0x17,0x13,0x13,0x1B,0x25,0x1C,0x1E,
0x20,0x21,0x23,0x23,0x23,0x15,0x1A,0x27,0x29,0x26,0x22,0x29,0x1F,0x22,0x23,0X22,
0X01,
0x05,0x06,0x06,0x08,0x07,0x08,0x10,0x08,0x08,0x10,0x22,0x16,0x13,0x16,0x22,0x22,
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22
};
uint8_t GsmartJPGDefaultHeaderPart2[GSMART_JPG_DEFAULT_HEADER_PART2_LENGTH] = {
//DHT(Define Huffman Table)
0xFF,0xC4,
0x01,0xA2,
0x00,0x00,0x01,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x01,0x00,0x03,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x10,0x00,0x02,0x01,0x03,0x03,
0x02,0x04,0x03,0x05,0x05,0x04,0x04,0x00,0x00,0x01,0x7D,0x01,0x02,0x03,0x00,0x04,
0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,
0x91,0xA1,0x08,0x23,0x42,0xB1,0xC1,0x15,0x52,0xD1,0xF0,0x24,0x33,0x62,0x72,0x82,
0x09,0x0A,0x16,0x17,0x18,0x19,0x1A,0x25,0x26,0x27,0x28,0x29,0x2A,0x34,0x35,0x36,
0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x53,0x54,0x55,0x56,
0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x73,0x74,0x75,0x76,
0x77,0x78,0x79,0x7A,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x92,0x93,0x94,0x95,
0x96,0x97,0x98,0x99,0x9A,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xB2,0xB3,
0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,
0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
0xE8,0xE9,0xEA,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0x11,0x00,0x02,
0x01,0x02,0x04,0x04,0x03,0x04,0x07,0x05,0x04,0x04,0x00,0x01,0x02,0x77,0x00,0x01,
0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,
0x32,0x81,0x08,0x14,0x42,0x91,0xA1,0xB1,0xC1,0x09,0x23,0x33,0x52,0xF0,0x15,0x62,
0x72,0xD1,0x0A,0x16,0x24,0x34,0xE1,0x25,0xF1,0x17,0x18,0x19,0x1A,0x26,0x27,0x28,
0x29,0x2A,0x35,0x36,0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,
0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,
0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
0x8A,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,
0xA8,0xA9,0xAA,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xC2,0xC3,0xC4,0xC5,
0xC6,0xC7,0xC8,0xC9,0xCA,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xE2,0xE3,
0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA
};
/*
* 5 - 6 : Image Height(H Byte,L Byte)
* 7 - 8 : Image Width(H Byte,L Byte)
*/
uint8_t GsmartJPGDefaultHeaderPart3[GSMART_JPG_DEFAULT_HEADER_PART3_LENGTH] = {
//SOFn(Start of Frame)
0xFF,0xC0,
0x00,0x11,
0x08,0x00,0x78,0x00,0xA0,0x03,0x01,0x21,0x00,0x02,0x11,0x01,0x03,0x11,0x01,
//SOS(Start of Scan)
0xFF,0xDA,
0x00,0x0C,
0x03,0x01,0x00,0x02,0x11,0x03,0x11,0x00,0x3F,0x00
};
uint8_t GsmartQTable[20][64]=
{
// index 0, Q50
{ 16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40,
26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61, 60, 57, 51,
56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80,109, 81, 87,
95, 98,103,104,103, 62, 77,113,121,112,100,120, 92,101,103, 99 },
{ 17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56, 66, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 },
// index 1, Q70
{ 10, 7, 7, 8, 7, 6, 10, 8, 8, 8, 11, 10, 10, 11, 14, 24,
16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31,
34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52,
57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59 },
{ 10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
// index 2, Q80
{ 6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16,
10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20,
22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35,
38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40 },
{ 7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
// index 3, Q85
{ 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12,
8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, 15,
17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26,
29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30 },
{ 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
// index 4, Q90
{ 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 4, 3, 3, 4, 5, 8,
5, 5, 4, 4, 5, 10, 7, 7, 6, 8, 12, 10, 12, 12, 11, 10,
11, 11, 13, 14, 18, 16, 13, 14, 17, 14, 11, 11, 16, 22, 16, 17,
19, 20, 21, 21, 21, 12, 15, 23, 24, 22, 20, 24, 18, 20, 21, 20 },
{ 3, 4, 4, 5, 4, 5, 9, 5, 5, 9, 20, 13, 11, 13, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
// index 5, Q60
{ 13, 9, 10, 11, 10, 8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32,
21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41,
45, 44, 51, 58, 74, 62, 51, 54, 70, 55, 44, 45, 64, 87, 65, 70,
76, 78, 82, 83, 82, 50, 62, 90, 97, 90, 80, 96, 74, 81, 82, 79 },
{ 14, 14, 14, 19, 17, 19, 38, 21, 21, 38, 79, 53, 45, 53, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
// index 6, Q25
{ 32, 22, 24, 28, 24, 20, 32, 28, 26, 28, 36, 34, 32, 38, 48, 80,
52, 48, 44, 44, 48, 98, 70, 74, 58, 80,116,102,122,120,114,102,
112,110,128,144,184,156,128,136,174,138,110,112,160,218,162,174,
190,196,206,208,206,124,154,226,242,224,200,240,184,202,206,198 },
{ 34, 36, 36, 48, 42, 48, 94, 52, 52, 94,198,132,112,132,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
// index 7, Q95
{ 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 4,
3, 2, 2, 2, 2, 5, 4, 4, 3, 4, 6, 5, 6, 6, 6, 5,
6, 6, 6, 7, 9, 8, 6, 7, 9, 7, 6, 6, 8, 11, 8, 9,
10, 10, 10, 10, 10, 6, 8, 11, 12, 11, 10, 12, 9, 10, 10, 10 },
{ 2, 2, 2, 2, 2, 2, 5, 3, 3, 5, 10, 7, 6, 7, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
// index 8, Q93
{ 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 3, 3, 6,
4, 3, 3, 3, 3, 7, 5, 5, 4, 6, 8, 7, 9, 8, 8, 7,
8, 8, 9, 10, 13, 11, 9, 10, 12, 10, 8, 8, 11, 15, 11, 12,
13, 14, 14, 15, 14, 9, 11, 16, 17, 16, 14, 17, 13, 14, 14, 14 },
{ 2, 3, 3, 3, 3, 3, 7, 4, 4, 7, 14, 9, 8, 9, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 },
// index 9, Q40
{ 20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50,
33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64,
70, 69, 80, 90,115, 98, 80, 85,109, 86, 69, 70,100,136,101,109,
119,123,129,130,129, 78, 96,141,151,140,125,150,115,126,129,124 },
{ 21, 23, 23, 30, 26, 30, 59, 33, 33, 59,124, 83, 70, 83,124,124,
124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 }
};
uint8_t GsmartOriginal_QTable_4NF_M[18][64]= //not Z-Z
{
// index 0, Q50
{ 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55,
14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62,
18, 22, 37, 56, 68,109,103, 77, 24, 35, 55, 64, 81,104,113, 92,
49, 64, 78, 87,103,121,120,101, 72, 92, 95, 98,112,100,103, 99 },
{ 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99,
24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 },
// index 1, Q70
{ 10, 7, 6, 10, 14, 24, 31, 37, 7, 7, 8, 11, 16, 35, 36, 33,
8, 8, 10, 14, 24, 34, 41, 34, 8, 10, 13, 17, 31, 52, 48, 37,
11, 13, 22, 34, 41, 65, 62, 46, 14, 21, 33, 38, 49, 62, 68, 55,
29, 38, 47, 52, 62, 73, 72, 61, 43, 55, 57, 59, 67, 60, 62, 59 },
{ 10, 11, 14, 28, 59, 59, 59, 59, 11, 13, 16, 40, 59, 59, 59, 59,
14, 16, 34, 59, 59, 59, 59, 59, 28, 40, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
// index 2, Q80
{ 6, 4, 4, 6, 10, 16, 20, 24, 5, 5, 6, 8, 10, 23, 24, 22,
6, 5, 6, 10, 16, 23, 28, 22, 6, 7, 9, 12, 20, 35, 32, 25,
7, 9, 15, 22, 27, 44, 41, 31, 10, 14, 22, 26, 32, 42, 45, 37,
20, 26, 31, 35, 41, 48, 48, 40, 29, 37, 38, 39, 45, 40, 41, 40 },
{ 7, 7, 10, 19, 40, 40, 40, 40, 7, 8, 10, 26, 40, 40, 40, 40,
10, 10, 22, 40, 40, 40, 40, 40, 19, 26, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
// index 3, Q85
{ 5, 3, 3, 5, 7, 12, 15, 18, 4, 4, 4, 6, 8, 17, 18, 17,
4, 4, 5, 7, 12, 17, 21, 17, 4, 5, 7, 9, 15, 26, 24, 19,
5, 7, 11, 17, 20, 33, 31, 23, 7, 11, 17, 19, 24, 31, 34, 28,
15, 19, 23, 26, 31, 36, 36, 30, 22, 28, 29, 29, 34, 30, 31, 30 },
{ 5, 5, 7, 14, 30, 30, 30, 30, 5, 6, 8, 20, 30, 30, 30, 30,
7, 8, 17, 30, 30, 30, 30, 30, 14, 20, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
// index 4, Q90
{ 3, 2, 2, 3, 5, 8, 10, 12, 2, 2, 3, 4, 5, 12, 12, 11,
3, 3, 3, 5, 8, 11, 14, 11, 3, 3, 4, 6, 10, 17, 16, 12,
4, 4, 7, 11, 14, 22, 21, 15, 5, 7, 11, 13, 16, 21, 23, 18,
10, 13, 16, 17, 21, 24, 24, 20, 14, 18, 19, 20, 22, 20, 21, 20 },
{ 3, 4, 5, 9, 20, 20, 20, 20, 4, 4, 5, 13, 20, 20, 20, 20,
5, 5, 11, 20, 20, 20, 20, 20, 9, 13, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
// index 5, Q60
{ 13, 9, 8, 13, 19, 32, 41, 49, 10, 10, 11, 15, 21, 46, 48, 44,
11, 10, 13, 19, 32, 46, 55, 45, 11, 14, 18, 23, 41, 70, 64, 50,
14, 18, 30, 45, 54, 87, 82, 62, 19, 28, 44, 51, 65, 83, 90, 74,
39, 51, 62, 70, 82, 97, 96, 81, 58, 74, 76, 78, 90, 80, 82, 79 },
{ 14, 14, 19, 38, 79, 79, 79, 79, 14, 17, 21, 53, 79, 79, 79, 79,
19, 21, 45, 79, 79, 79, 79, 79, 38, 53, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
// index 6, Q25
{ 32, 22, 20, 32, 48, 80,102,122, 24, 24, 28, 38, 52,116,120,110,
28, 26, 32, 48, 80,114,138,112, 28, 34, 44, 58,102,174,160,124,
36, 44, 74,112,136,218,206,154, 48, 70,110,128,162,208,226,184,
98,128,156,174,206,242,240,202,144,184,190,196,224,200,206,198 },
{ 34, 36, 48, 94,198,198,198,198, 36, 42, 52,132,198,198,198,198,
48, 52,112,198,198,198,198,198, 94,132,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
// index 7, Q95
{ 2, 1, 1, 2, 2, 4, 5, 6, 1, 1, 1, 2, 3, 6, 6, 6,
1, 1, 2, 2, 4, 6, 7, 6, 1, 2, 2, 3, 5, 9, 8, 6,
2, 2, 4, 6, 7, 11, 10, 8, 2, 4, 6, 6, 8, 10, 11, 9,
5, 6, 8, 9, 10, 12, 12, 10, 7, 9, 10, 10, 11, 10, 10, 10 },
{ 2, 2, 2, 5, 10, 10, 10, 10, 2, 2, 3, 7, 10, 10, 10, 10,
2, 3, 6, 10, 10, 10, 10, 10, 5, 7, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
// index 8, Q93
{ 2, 2, 1, 2, 3, 6, 7, 9, 2, 2, 2, 3, 4, 8, 8, 8,
2, 2, 2, 3, 6, 8, 10, 8, 2, 2, 3, 4, 7, 12, 11, 9,
3, 3, 5, 8, 10, 15, 14, 11, 3, 5, 8, 9, 11, 15, 16, 13,
7, 9, 11, 12, 14, 17, 17, 14, 10, 13, 13, 14, 16, 14, 14, 14 },
{ 2, 3, 3, 7, 14, 14, 14, 14, 3, 3, 4, 9, 14, 14, 14, 14,
3, 4, 8, 14, 14, 14, 14, 14, 7, 9, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }
};
#endif /* __GSMART_JPEG_HEADER_H */

View File

@@ -1,84 +0,0 @@
/****************************************************************/
/* gsmart-registers.h - Gphoto2 library for the Mustek gSmart */
/* mini 2 */
/* */
/* Copyright © 2002 Till Adam */
/* */
/* Author: Till Adam <till@adam-lilienthal.de> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#ifndef __GSMART_REGISTERS_H__
#define __GSMART_REGISTERS_H__
/* ---- Register ---- */
#define GSMART_REG_CamMode 0x2000
/* ---- CamMode Value ---- */
typedef enum
{
GSMART_CamMode_Idle = 0,
GSMART_CamMode_DSC = 1,
GSMART_CamMode_VideoClip = 2,
GSMART_CamMode_PcCamera = 3,
GSMART_CamMode_Upload = 4
}
GsmartCamMode;
#define GSMART_REG_PbSrc 0x2301
/* ---- PbSrc Value ---- */
#define GSMART_DramUsb 0x13
#define GSMART_REG_AutoPbSize 0x2306
#define GSMART_REG_DramType 0x2705
#define GSMART_REG_ImageType 0x270c
#define GSMART_REG_SdramSizeL 0x2710 /* Size [7:0] */
#define GSMART_REG_SdramSizeM 0x2711 /* Size [15:8] */
#define GSMART_REG_SdramSizeH 0x2712 /* Size [21:16] */
#define GSMART_REG_VlcAddressL 0x2713
#define GSMART_REG_VlcAddressM 0x2714
#define GSMART_REG_VlcAddressH 0x2715
#define GSMART_REG_MemWidthL 0x2720
#define GSMART_REG_MemWidthH 0x2721
#define GSMART_REG_MemHeightL 0x2722
#define GSMART_REG_MemHeightH 0x2723
#define GSMART_REG_Trigger 0x27a1
/* ---- Trigger bit Value ---- */
#define GSMART_TrigDramFifo 2
#define GSMART_REG_JFIF 0x2884
#define GSMART_REG_CompSizeL 0x2887
#define GSMART_REG_CompSizeM 0x2888
#define GSMART_REG_CompSizeH 0x2889
#define GSMART_REG_I2C_wIndex 0x2a08
#define GSMART_REG_I2C_wValue 0x2a10
#define GSMART_REG_I2C_rValue 0x2a30
#define GSMART_REG_I2C_rStatus 0x2a06
#endif /* __GSMART_REGISTERS_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,83 +0,0 @@
/****************************************************************/
/* gsmart.h - Gphoto2 library for the Mustek gSmart mini 2 */
/* */
/* Copyright © 2002 Till Adam */
/* */
/* Author: Till Adam <till@adam-lilienthal.de> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#ifndef __GSMART_H__
#define __GSMART_H__
#include <_stdint.h>
#include <gphoto2-camera.h>
#define FLASH_PAGE_SIZE 0x100
#define GSMART_FILE_TYPE_IMAGE 0x00
#define GSMART_FILE_TYPE_AVI 0x01
#define CHECK(result) {int res; res = result; if (res < 0) return (res);}
struct GsmartFile
{
char *name;
int width;
int height;
int fat_start;
int fat_end;
uint8_t *fat;
int mime_type;
};
typedef enum {
GSMART_BRIDGE_SPCA500,
GSMART_BRIDGE_SPCA504A,
GSMART_BRIDGE_SPCA504B
} GsmartBridgeChip;
struct _CameraPrivateLibrary
{
GPPort *gpdev;
GsmartBridgeChip bridge;
int dirty;
int num_files;
int num_images;
int num_movies;
int num_fats;
int size_used;
int size_free;
uint8_t *fats;
struct GsmartFile *files;
};
int gsmart_reset (CameraPrivateLibrary * lib);
int gsmart_capture (CameraPrivateLibrary * lib);
int gsmart_get_info (CameraPrivateLibrary * lib);
int gsmart_delete_file (CameraPrivateLibrary * lib, unsigned int index);
int gsmart_delete_all (CameraPrivateLibrary * lib);
int gsmart_get_file_info (CameraPrivateLibrary * lib, unsigned int index,
struct GsmartFile **file);
int gsmart_get_firmware_revision (CameraPrivateLibrary *lib);
int gsmart_request_file (CameraPrivateLibrary * lib, uint8_t ** buf,
unsigned int *len, unsigned int number, int *type);
int gsmart_request_thumbnail (CameraPrivateLibrary * lib, uint8_t ** buf,
unsigned int *len, unsigned int number, int *type);
#endif /* __GSMART_H__ */

View File

@@ -1,448 +0,0 @@
/****************************************************************/
/* library.c - Gphoto2 library for the Mustek gSmart mini 2 */
/* */
/* Copyright © 2002 Till Adam */
/* */
/* Author: Till Adam <till@adam-lilienthal.de> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gphoto2.h>
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (GETTEXT_PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define _(String) (String)
# define N_(String) (String)
#endif
#include "gsmart.h"
#define GP_MODULE "gsmartmini"
#define TIMEOUT 5000
#define GSMART_VERSION "0.3"
#define GSMART_LAST_MOD "08/09/02 - 23:14:11"
/* forward declarations */
static int file_list_func (CameraFilesystem *fs, const char *folder,
CameraList *list, void *data, GPContext *context);
static int get_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileType type,
CameraFile *file, void *user_data,
GPContext *context);
static int delete_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, void *data,
GPContext *context);
static int delete_all_func (CameraFilesystem *fs, const char *folder,
void *data, GPContext *context);
static int get_info_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileInfo *info,
void *data, GPContext *context);
/* define what cameras we support */
static struct
{
char *model;
int usb_vendor;
int usb_product;
GsmartBridgeChip bridge;
}
models[] =
{
{
"Mustek:gSmart mini", 0x055f, 0xc220, GSMART_BRIDGE_SPCA500}
, {
"Mustek:gSmart mini 2", 0x055f, 0xc420, GSMART_BRIDGE_SPCA504A}
, {
"Mustek:gSmart mini 3", 0x055f, 0xc520, GSMART_BRIDGE_SPCA504A}
, {
"So.:Show 301", 0x0ec7, 0x1008, GSMART_BRIDGE_SPCA504A}
, {
"Aiptek:1.3 mega PocketCam", 0x04fc, 0x504b, GSMART_BRIDGE_SPCA504B}
, {
"Maxwell:Max Pocket", 0x04fc, 0x504b, GSMART_BRIDGE_SPCA504B}
, {
NULL, 0, 0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "gsmartmini");
return (GP_OK);
}
int
camera_abilities (CameraAbilitiesList *list)
{
int x = 0;
char *ptr;
CameraAbilities a;
ptr = models[x].model;
while (ptr) {
memset (&a, 0, sizeof (a));
strcpy (a.model, ptr);
a.port = GP_PORT_USB;
a.speed[0] = 0;
if (models[x].bridge == GSMART_BRIDGE_SPCA504A) {
a.operations = GP_OPERATION_CAPTURE_IMAGE;
a.status = GP_DRIVER_STATUS_TESTING;
} else {
a.status = GP_DRIVER_STATUS_EXPERIMENTAL;
}
a.file_operations =
GP_FILE_OPERATION_PREVIEW | GP_FILE_OPERATION_DELETE;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
a.usb_vendor = models[x].usb_vendor;
a.usb_product = models[x].usb_product;
gp_abilities_list_append (list, a);
ptr = models[++x].model;
}
return (GP_OK);
}
static int
camera_capture (Camera *camera, CameraCaptureType type,
CameraFilePath * path, GPContext *context)
{
struct GsmartFile *file;
CameraAbilities a;
/* Not all our cameras support capture */
gp_camera_get_abilities (camera, &a);
if (!a.operations & GP_OPERATION_CAPTURE_IMAGE)
return GP_ERROR_NOT_SUPPORTED;
CHECK (gsmart_capture (camera->pl));
CHECK (gsmart_get_info (camera->pl));
CHECK (gsmart_get_file_info
(camera->pl, camera->pl->num_files - 1, &file));
/* Now tell the frontend where to look for the image */
strncpy (path->folder, "/", sizeof (path->folder) - 1);
path->folder[sizeof (path->folder) - 1] = '\0';
strncpy (path->name, file->name, sizeof (path->name) - 1);
path->name[sizeof (path->name) - 1] = '\0';
CHECK (gp_filesystem_append
(camera->fs, path->folder, path->name, context));
return GP_OK;
}
static int
camera_exit (Camera *camera, GPContext *context)
{
if (camera->pl) {
if (camera->pl->fats) {
free (camera->pl->fats);
camera->pl->fats = NULL;
}
if (camera->pl->files) {
free (camera->pl->files);
camera->pl->files = NULL;
}
free (camera->pl);
camera->pl = NULL;
}
return (GP_OK);
}
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
char tmp[1024];
/* possibly get # pics, mem free, etc. if needed */
if (camera->pl->dirty)
CHECK (gsmart_get_info (camera->pl));
snprintf (tmp, sizeof (tmp),
"Files: %d\n Images: %4d\n Movies: %4d\nSpace used: %8d\nSpace free: %8d\n",
camera->pl->num_files, camera->pl->num_images,
camera->pl->num_movies, camera->pl->size_used,
camera->pl->size_free);
strcat (summary->text, tmp);
return (GP_OK);
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text,
_("gsmart library v" GSMART_VERSION
" " GSMART_LAST_MOD "\n"
"Till Adam <till@adam-lilienthal.de>\n"
"Support for the Mustek gSmart mini series of digital "
"cameras based on several other gphoto2 camlib modules and "
"the windows driver source kindly provided by Mustek.\n"
"\n"));
return (GP_OK);
}
int
camera_init (Camera *camera, GPContext *context)
{
int ret;
int x = 0;
char *model;
GPPortSettings settings;
CameraAbilities abilities;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->capture = camera_capture;
CHECK (gp_port_get_settings (camera->port, &settings));
switch (camera->port->type) {
case GP_PORT_USB:
settings.usb.inep = 0x82;
settings.usb.outep = 0x03;
settings.usb.config = 1;
settings.usb.interface = 0;
settings.usb.altsetting = 0;
CHECK (gp_port_set_settings (camera->port, settings));
CHECK (gp_port_set_timeout (camera->port, TIMEOUT));
break;
default:
gp_context_error (context,
_("Unsupported port type: %d. "
"This driver only works with USB "
"cameras.\n"), camera->port->type);
return (GP_ERROR);
break;
}
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
return (GP_ERROR_NO_MEMORY);
memset (camera->pl, 0, sizeof (CameraPrivateLibrary));
camera->pl->gpdev = camera->port;
camera->pl->dirty = 1;
/* What bridge chip is inside the camera? The Gsmart mini is spca500
* based, while the others have a spca504a */
gp_camera_get_abilities (camera, &abilities);
model = models[x].model;
while (model) {
if (!strcmp (model, abilities.model)) {
camera->pl->bridge = models[x].bridge;
break;
}
model = models[++x].model;
}
ret = gsmart_reset (camera->pl);
if (ret < 0) {
gp_context_error (context, _("Could not reset camera.\n"));
free (camera->pl);
camera->pl = NULL;
return (ret);
}
/* Set up the CameraFilesystem */
CHECK (gp_filesystem_set_list_funcs
(camera->fs, file_list_func, NULL, camera));
CHECK (gp_filesystem_set_file_funcs
(camera->fs, get_file_func, delete_file_func, camera));
CHECK (gp_filesystem_set_info_funcs
(camera->fs, get_info_func, NULL, camera));
CHECK (gp_filesystem_set_folder_funcs
(camera->fs, NULL, delete_all_func, NULL, NULL, camera));
return (GP_OK);
}
static int
file_list_func (CameraFilesystem *fs, const char *folder,
CameraList *list, void *data, GPContext *context)
{
Camera *camera = data;
int i;
char temp_file[14];
if (camera->pl->dirty)
CHECK (gsmart_get_info (camera->pl));
for (i = 0; i < camera->pl->num_files; i++) {
strncpy (temp_file, camera->pl->files[i].name, 12);
temp_file[12] = 0;
gp_list_append (list, temp_file, NULL);
}
return GP_OK;
}
static int
get_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileType type,
CameraFile *file, void *user_data, GPContext *context)
{
Camera *camera = user_data;
unsigned char *data = NULL;
int size, number, filetype;
CHECK (number =
gp_filesystem_number (camera->fs, folder, filename, context));
switch (type) {
case GP_FILE_TYPE_NORMAL:
CHECK (gsmart_request_file
(camera->pl, &data, &size, number, &filetype));
if (filetype == GSMART_FILE_TYPE_IMAGE) {
CHECK (gp_file_set_mime_type
(file, GP_MIME_JPEG));
} else if (filetype == GSMART_FILE_TYPE_AVI) {
CHECK (gp_file_set_mime_type
(file, GP_MIME_AVI));
}
break;
case GP_FILE_TYPE_PREVIEW:
CHECK (gsmart_request_thumbnail
(camera->pl, &data, &size, number, &filetype));
if (filetype == GSMART_FILE_TYPE_IMAGE) {
CHECK (gp_file_set_mime_type
(file, GP_MIME_BMP));
} else if (filetype == GSMART_FILE_TYPE_AVI) {
CHECK (gp_file_set_mime_type
(file, GP_MIME_JPEG));
}
break;
default:
return GP_ERROR_NOT_SUPPORTED;
}
if (!data)
return GP_ERROR;
CHECK (gp_file_set_data_and_size (file, data, size));
CHECK (gp_file_set_name (file, filename));
return GP_OK;
}
static int
get_info_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileInfo *info, void *data,
GPContext *context)
{
Camera *camera = data;
int n;
struct GsmartFile *file;
/* Get the file number from the CameraFileSystem */
CHECK (n =
gp_filesystem_number (camera->fs, folder, filename, context));
CHECK (gsmart_get_file_info (camera->pl, n, &file));
info->file.fields =
GP_FILE_INFO_NAME | GP_FILE_INFO_TYPE | GP_FILE_INFO_WIDTH |
GP_FILE_INFO_HEIGHT;
strncpy (info->file.name, filename, sizeof (info->file.name));
if (file->mime_type == GSMART_FILE_TYPE_IMAGE) {
strcpy (info->file.type, GP_MIME_JPEG);
info->preview.width = 160;
info->preview.height = 120;
} else if (file->mime_type == GSMART_FILE_TYPE_AVI) {
strcpy (info->file.type, GP_MIME_AVI);
info->preview.width = 320;
info->preview.height = 240;
}
info->file.width = file->width;
info->file.height = file->height;
info->preview.fields =
GP_FILE_INFO_TYPE | GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT;
strcpy (info->preview.type, GP_MIME_BMP);
return (GP_OK);
}
static int
delete_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, void *data, GPContext *context)
{
Camera *camera = data;
int n, c;
/* Get the file number from the CameraFileSystem */
CHECK (n =
gp_filesystem_number (camera->fs, folder, filename, context));
CHECK (c = gp_filesystem_count (camera->fs, folder, context));
if (n + 1 != c) {
const char *name;
gp_filesystem_name (fs, "/", c - 1, &name, context);
gp_context_error (context,
_
("Your camera does only support deleting the "
"last file on the camera. In this case, this "
"is file '%s'."), name);
return (GP_ERROR);
}
CHECK (gsmart_delete_file (camera->pl, n));
return GP_OK;
}
static int
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
GPContext *context)
{
Camera *camera = data;
CHECK (gsmart_delete_all (camera->pl));
return GP_OK;
}

View File

@@ -1,10 +0,0 @@
*~ .*~
*.lo
*.la
.libs
.deps
Makefile
Makefile.in
*.patch
protocol.xml
crw

View File

@@ -1,20 +0,0 @@
Fre Jan 24 11:47:04 2003 Till Adam <till@adam-lilienthal.de>
* apply patch by Mark Zimmermann <mark@foresthaven.com>
fixing thumbnails for low res images
Fri Jan 24 08:15:59 2003 Till Adam <till@adam-lilienthal.de>
* apply patch by Mark Zimmermann <mark@foresthaven.com>
fixing reporting of preview height
2002-11-26 Colin Marquardt <colin@marquardt-home.de>
* library.c (camera_about): Make sure author names are 7bit ASCII only.
Son Nov 10 21:19:16 2002 Till Adam <till@adam-lilienthal.de>
* import into gphoto cvs
Sam Nov 02 20:09:06 2002 Till Adam <till@adam-lilienthal.de>
* implement -n, -L and -P
Fri Oct 25 17:32:26 2002 Till Adam <till@adam-lilienthal.de>
* start of camlib

View File

@@ -1,12 +0,0 @@
camlib_LTLIBRARIES = libgphoto2_spca504_flash.la
INCLUDES = \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/libgphoto2_port/libgphoto2_port \
-I$(top_srcdir)/libgphoto2 \
-I$(top_builddir)/libgphoto2
libgphoto2_spca504_flash_la_SOURCES = spca504_flash.c \
spca504_flash.h library.c
libgphoto2_spca504_flash_la_LDFLAGS = -module -avoid-version
libgphoto2_spca504_flash_la_LIBADD = $(top_builddir)/libgphoto2/libgphoto2.la

View File

@@ -1,24 +0,0 @@
This camlib supports the following cameras:
Aiptek Pencam
Medion MD 5319 (Aldi-Cam)
nisis Quickpix Qp3
There are probably others with this chip and flash storage which we dont know
about. They should also work.
It owes everything to the work of Mark Zimmermann <mark@foresthaven.com> whose
pencamread tool I have simply ported to a gphoto2 camlib. The macam driver by
Matthias Krauß was also helpfull. All features are theirs, all bugs are mine.
I dont own a camera of this type, so I had to rely on Armin Janssen
<unclebenz@foni.net> to tirelessly produce usb snoops, test and give feedback.
Without Armin this would not have been possible, so if you own a camera that
is supported by this driver consider sending him an email and thanking him for
risking his cam so yours works on linux ;).
Thanks also to Martyn Ranyard <ranyardm@lineone.net> for testing and reporting
success with the nisis Quickpix Qp3. He also helped debug the beginnings of
avi support.
Till Adam <till@adam-lilienthal.de>

View File

@@ -1,264 +0,0 @@
/****************************************************************/
/* library.c - Gphoto2 library for cameras with a sunplus */
/* spca504 chip and flash memory */
/* */
/* */
/* Authors: Till Adam <till@adam-lilienthal.de> */
/* */
/* based on work done by: */
/* Mark A. Zimmerman <mark@foresthaven.com> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#include "config.h"
#include "spca504_flash.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gphoto2.h>
#include <gphoto2-port.h>
#define GP_MODULE "spca504_flash"
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (GETTEXT_PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define _(String) (String)
# define N_(String) (String)
#endif
struct models
{
char *name;
unsigned short idVendor;
unsigned short idProduct;
char serial;
}
models[] =
{
{"Aiptek:Pencam", 0x04fc, 0x504a, 0},
{"Medion:MD 5319", 0x04fc, 0x504a, 0},
{"nisis:Quickpix Qp3", 0x04fc, 0x504a, 0},
{"Trust:Spyc@m 500F FLASH", 0x04fc, 0x504a, 0}
, {
NULL, 0, 0, 0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "spca504_flash");
return (GP_OK);
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof (CameraAbilities));
strcpy (a.model, models[i].name);
a.status = GP_DRIVER_STATUS_EXPERIMENTAL;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product = models[i].idProduct;
a.operations = GP_OPERATION_NONE;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW;
gp_abilities_list_append (list, a);
}
return GP_OK;
}
static int
camera_exit (Camera *camera, GPContext *context)
{
int ret;
ret = spca504_flash_close (camera->port, context);
return ret;
}
static int
file_list_func (CameraFilesystem *fs, const char *folder,
CameraList *list, void *data, GPContext *context)
{
Camera *camera = data;
int i = 0, filecount = 0;
char temp_file[14];
CHECK (spca504_flash_get_TOC(camera->pl, &filecount));
for (i=0; i<filecount; i++)
{
CHECK(spca504_flash_get_file_name (camera->pl, i, temp_file));
gp_list_append (list, temp_file, NULL);
}
return GP_OK;
}
static int
get_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileType type,
CameraFile *file, void *user_data, GPContext *context)
{
Camera *camera = user_data;
unsigned char *data = NULL;
int size, number;
CHECK (number =
gp_filesystem_number (camera->fs, folder, filename, context));
switch (type) {
case GP_FILE_TYPE_NORMAL:
CHECK (spca504_flash_get_file (camera->pl, context,
&data, &size, number, 0));
break;
case GP_FILE_TYPE_PREVIEW:
CHECK (spca504_flash_get_file (camera->pl, context,
&data, &size, number, 1));
CHECK (gp_file_set_mime_type (file, GP_MIME_BMP));
break;
default:
return GP_ERROR_NOT_SUPPORTED;
}
if (!data)
return GP_ERROR;
CHECK (gp_file_set_data_and_size (file, data, size));
CHECK (gp_file_set_name (file, filename));
return GP_OK;
}
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
return GP_ERROR_NOT_SUPPORTED;
}
static int
camera_manual (Camera *camera, CameraText *manual, GPContext *context)
{
strcpy (manual->text, _("Manual Not Implemented Yet"));
return GP_OK;
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
/* Translators: please translate "Krauss" to "Krauß" if possible. */
strcpy (about->text,
_
("spca504_flash camlib\n Authors: Till Adam\n <till@adam-lilienthal.de>\nbased on work by Matthias Krauss\nand Mark A. Zimmerman <mark@foresthaven.com>"));
return GP_OK;
}
static int
get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileInfo *info, void *data, GPContext *context)
{
Camera *camera = data;
int n, filecount;
int w, h;
char name[14];
/* Get the file number from the CameraFileSystem */
CHECK (n =
gp_filesystem_number (camera->fs, folder, filename, context));
CHECK (spca504_flash_get_TOC(camera->pl, &filecount));
CHECK (spca504_flash_get_file_name(camera->pl, n, name));
CHECK (spca504_flash_get_file_dimensions(camera->pl, n, &w, &h));
info->file.fields =
GP_FILE_INFO_NAME | GP_FILE_INFO_TYPE | GP_FILE_INFO_WIDTH |
GP_FILE_INFO_HEIGHT;
strncpy (info->file.name, name, sizeof (info->file.name));
strcpy (info->file.type, GP_MIME_JPEG);
info->file.width = w;
info->file.height = h;
info->preview.fields =
GP_FILE_INFO_TYPE | GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT;
info->preview.width = w/8;
info->preview.height = h/8;
strcpy (info->preview.type, GP_MIME_BMP);
return GP_OK;
}
int
camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
int ret = 0;
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
switch (camera->port->type) {
case GP_PORT_USB:
ret = gp_port_get_settings (camera->port, &settings);
if (ret < 0)
return ret;
settings.usb.inep = 0x82;
settings.usb.outep = 0x03;
settings.usb.config = 1;
settings.usb.interface = 1;
settings.usb.altsetting = 0;
ret = gp_port_set_settings (camera->port, settings);
if (ret < 0)
return ret;
break;
case GP_PORT_SERIAL:
return GP_ERROR_IO_SUPPORTED_SERIAL;
default:
return GP_ERROR_NOT_SUPPORTED;
}
CHECK (spca504_flash_init (camera->port, context));
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
return (GP_ERROR_NO_MEMORY);
memset (camera->pl, 0, sizeof (CameraPrivateLibrary));
camera->pl->gpdev = camera->port;
camera->pl->dirty = 1;
gp_filesystem_set_info_funcs (camera->fs, get_info_func, NULL, camera);
gp_filesystem_set_list_funcs (camera->fs, file_list_func, NULL, camera);
gp_filesystem_set_file_funcs (camera->fs, get_file_func, NULL, camera);
return GP_OK;
}

View File

@@ -1,407 +0,0 @@
/****************************************************************/
/* spca504_flash.c - Gphoto2 library for cameras with a sunplus */
/* spca504 chip and flash memory */
/* */
/* */
/* Authors: Till Adam <till@adam-lilienthal.de> */
/* */
/* based on work done by: */
/* Mark A. Zimmerman <mark@foresthaven.com> */
/* */
/* This library is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU Library General */
/* Public License as published by the Free Software Foundation; */
/* either version 2 of the License, or (at your option) any */
/* later version. */
/* */
/* This library is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU Library General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU Library General */
/* Public License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/****************************************************************/
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <_stdint.h>
#include "spca504_flash.h"
#include <gphoto2.h>
#include <gphoto2-port.h>
#include <gphoto2-port-log.h>
#define GP_MODULE "spca504_flash"
static int yuv2rgb (int y, int u, int v, int *_r, int *_g, int *_b);
static int
spca504_flash_wait_for_ready(GPPort *port)
{
/* FIXME tweak this. What is reasonable? 30 s seems a bit long */
int timeout = 30;
uint8_t ready = 0;
while (timeout--) {
sleep(1);
CHECK (gp_port_usb_msg_read (port, 0x0b, 0x0000, 0x0004,
(char*)&ready, 0x01));
if (ready)
return GP_OK;
}
return GP_ERROR;
}
int
spca504_flash_get_TOC(CameraPrivateLibrary *pl, int *filecount)
{
uint16_t n_toc_entries;
int toc_size = 0;
if (!pl->dirty)
return GP_OK;
CHECK (gp_port_usb_msg_read (pl->gpdev, 0x0b, 0x0000, 0x0000,
(char*)&n_toc_entries, 0x02));
/* Each file gets two toc entries, one for the image, one for the
* thumbnail */
*filecount = n_toc_entries/2;
/* If empty, return now */
if (n_toc_entries == 0)
return GP_OK;
/* Request the TOC */
CHECK (gp_port_usb_msg_read (pl->gpdev, 0x0a, n_toc_entries, 0x000c,
NULL, 0x00));
/* slurp it in. Supposedly there's 32 bytes in each entry. */
toc_size = n_toc_entries * 32;
/* align */
if (toc_size % 512 != 0)
toc_size = ((toc_size / 512) + 1) * 512;
if (pl->toc)
free (pl->toc);
pl->toc = malloc(toc_size);
if (!pl->toc)
return GP_ERROR_NO_MEMORY;
CHECK (spca504_flash_wait_for_ready(pl->gpdev));
CHECK (gp_port_read (pl->gpdev, pl->toc, toc_size));
pl->dirty = 0;
return GP_OK;
}
int
spca504_flash_get_filecount (GPPort *port, int *filecount)
{
uint16_t response = 0;
CHECK (gp_port_usb_msg_read (port, 0x0b, 0x0000, 0x0000,
(char*)&response, 0x02));
/* Each file gets two toc entries, one for the image, one for the
* thumbnail */
*filecount = response/2;
return GP_OK;
}
int
spca504_flash_get_file_name (CameraPrivateLibrary *lib, int index, char *name)
{
uint8_t *p;
p = lib->toc + index*2*32;
memcpy (name, p, 8);
name[8] = '.';
memcpy (name+9, p+8, 3);
name[12] = '\0';
return GP_OK;
}
int
spca504_flash_get_file_dimensions (CameraPrivateLibrary *lib, int index, int *w, int *h)
{
uint8_t *p;
p = lib->toc + index*2*32;
*w = (p[0x0c] & 0xff) + (p[0x0d] & 0xff) * 0x100;
*h = (p[0x0e] & 0xff) + (p[0x0f] & 0xff) * 0x100;
return GP_OK;
}
int
spca504_flash_get_file_size (CameraPrivateLibrary *lib, int index, int *size)
{
uint8_t *p;
p = lib->toc + index*2*32;
*size = (p[0x1c] & 0xff)
+ (p[0x1d] & 0xff) * 0x100
+ (p[0x1e] & 0xff) * 0x10000
+ (p[0x1f] & 0xff) * 0x1000000;
return GP_OK;
}
int
spca504_flash_get_file (CameraPrivateLibrary *lib, GPContext *context,
uint8_t ** data, unsigned int *len, int index, int thumbnail)
{
uint32_t file_size = 0, aligned_size = 0;
uint32_t addr = 0;
uint8_t *p, *buf;
uint8_t *tmp, *rgb_p, *yuv_p;
if (thumbnail) {
p = lib->toc + (index*2+1) * 32;
} else {
p = lib->toc + index*2*32;
}
aligned_size = file_size =
(p[0x1c] & 0xff)
+ (p[0x1d] & 0xff) * 0x100
+ (p[0x1e] & 0xff) * 0x10000;
addr = (p[0x18] & 0xff)
+ (p[0x19] & 0xff) * 0x100
+ (p[0x1a] & 0xff) * 0x10000
+ (p[0x1b] & 0xff) * 0x1000000;
/* Trigger download of image data */
if (thumbnail) {
CHECK (gp_port_usb_msg_write (lib->gpdev,
0x0c, index+1, 0x0006, NULL, 0x00));
} else {
CHECK (gp_port_usb_msg_write (lib->gpdev,
0x0a, index+1, 0x000d, NULL, 0x00));
}
/* align */
if (file_size % 16384 != 0)
aligned_size = ((file_size / 16384) + 1) * 16384;
buf = malloc (aligned_size);
if (!buf)
return GP_ERROR_NO_MEMORY;
CHECK (spca504_flash_wait_for_ready(lib->gpdev));
CHECK (gp_port_read (lib->gpdev, buf, aligned_size));
/* For images, we are done now, thumbnails need to be converted from
* yuv to rgb and a pbm header added. */
if (thumbnail) {
int alloc_size, true_size, w, h, hdrlen;
uint8_t *p2 = lib->toc + index*2*32;
/* thumbnails are generated from dc coefficients and are
* therefor w/8 x h/8
* Since the dimensions of the thumbnail in the TOC are
* always [0,0], Use the TOC entry for the full image.
*/
w = ((p2[0x0c] & 0xff) + (p2[0x0d] & 0xff) * 0x100) / 8;
h = ((p2[0x0e] & 0xff) + (p2[0x0f] & 0xff) * 0x100) / 8;
/* Allow for a long header; get the true length later.
*/
hdrlen = 15;
alloc_size = w * h * 3 + hdrlen;
tmp = malloc (alloc_size);
if (!tmp)
return GP_ERROR_NO_MEMORY;
/* Write the header and get its length. Then, verify that
* we allocated enough memory.
* This should never fail; it would be nice to have an error
* code like GP_ERROR_CAMLIB_INTERNAL for cases like this.
*/
hdrlen = snprintf(tmp, alloc_size, "P6 %d %d 255\n", w, h);
true_size = w * h * 3 + hdrlen;
if ( true_size > alloc_size )
return GP_ERROR;
yuv_p = buf;
rgb_p = tmp + hdrlen;
while (yuv_p < buf + file_size) {
unsigned int u, v, y, y2;
unsigned int r, g, b;
y = yuv_p[0];
y2 = yuv_p[1];
u = yuv_p[2];
v = yuv_p[3];
CHECK (yuv2rgb (y, u, v, &r, &g, &b));
*rgb_p++ = r;
*rgb_p++ = g;
*rgb_p++ = b;
CHECK (yuv2rgb (y2, u, v, &r, &g, &b));
*rgb_p++ = r;
*rgb_p++ = g;
*rgb_p++ = b;
yuv_p += 4;
}
free (buf);
*data = tmp;
*len = true_size;
} else {
*data = buf;
*len = file_size;
}
return GP_OK;
}
/*
* Deinit camera
*/
int
spca504_flash_close (GPPort *port, GPContext *context)
{
CHECK (gp_port_usb_msg_write (port, 0x00, 0x01, 0x2306, NULL, 0x00));
CHECK (gp_port_usb_msg_write (port, 0x00, 0x00, 0x0d04, NULL, 0x00));
return GP_OK;
}
/*
* Initialize the camera and write the jpeg registers. Read them back in to
* check whether the values are set correctly (wtf?)
*/
int
spca504_flash_init (GPPort *port, GPContext *context)
{
struct JPREG {
int reg;
int val;
};
struct JPREG jpReg[] = {
{ 0x2800, 0x0005 }, { 0x2840, 0x0005 },
{ 0x2801, 0x0003 }, { 0x2841, 0x0005 },
{ 0x2802, 0x0003 }, { 0x2842, 0x0007 },
{ 0x2803, 0x0005 }, { 0x2843, 0x000e },
{ 0x2804, 0x0007 }, { 0x2844, 0x001e },
{ 0x2805, 0x000c }, { 0x2845, 0x001e },
{ 0x2806, 0x000f }, { 0x2846, 0x001e },
{ 0x2807, 0x0012 }, { 0x2847, 0x001e },
{ 0x2808, 0x0004 }, { 0x2848, 0x0005 },
{ 0x2809, 0x0004 }, { 0x2849, 0x0006 },
{ 0x280a, 0x0004 }, { 0x284a, 0x0008 },
{ 0x280b, 0x0006 }, { 0x284b, 0x0014 },
{ 0x280c, 0x0008 }, { 0x284c, 0x001e },
{ 0x280d, 0x0011 }, { 0x284d, 0x001e },
{ 0x280e, 0x0012 }, { 0x284e, 0x001e },
{ 0x280f, 0x0011 }, { 0x284f, 0x001e },
{ 0x2810, 0x0004 }, { 0x2850, 0x0007 },
{ 0x2811, 0x0004 }, { 0x2851, 0x0008 },
{ 0x2812, 0x0005 }, { 0x2852, 0x0011 },
{ 0x2813, 0x0007 }, { 0x2853, 0x001e },
{ 0x2814, 0x000c }, { 0x2854, 0x001e },
{ 0x2815, 0x0011 }, { 0x2855, 0x001e },
{ 0x2816, 0x0015 }, { 0x2856, 0x001e },
{ 0x2817, 0x0011 }, { 0x2857, 0x001e },
{ 0x2818, 0x0004 }, { 0x2858, 0x000e },
{ 0x2819, 0x0005 }, { 0x2859, 0x0014 },
{ 0x281a, 0x0007 }, { 0x285a, 0x001e },
{ 0x281b, 0x0009 }, { 0x285b, 0x001e },
{ 0x281c, 0x000f }, { 0x285c, 0x001e },
{ 0x281d, 0x001a }, { 0x285d, 0x001e },
{ 0x281e, 0x0018 }, { 0x285e, 0x001e },
{ 0x281f, 0x0013 }, { 0x285f, 0x001e },
{ 0x2820, 0x0005 }, { 0x2860, 0x001e },
{ 0x2821, 0x0007 }, { 0x2861, 0x001e },
{ 0x2822, 0x000b }, { 0x2862, 0x001e },
{ 0x2823, 0x0011 }, { 0x2863, 0x001e },
{ 0x2824, 0x0014 }, { 0x2864, 0x001e },
{ 0x2825, 0x0021 }, { 0x2865, 0x001e },
{ 0x2826, 0x001f }, { 0x2866, 0x001e },
{ 0x2827, 0x0017 }, { 0x2867, 0x001e },
{ 0x2828, 0x0007 }, { 0x2868, 0x001e },
{ 0x2829, 0x000b }, { 0x2869, 0x001e },
{ 0x282a, 0x0011 }, { 0x286a, 0x001e },
{ 0x282b, 0x0013 }, { 0x286b, 0x001e },
{ 0x282c, 0x0018 }, { 0x286c, 0x001e },
{ 0x282d, 0x001f }, { 0x286d, 0x001e },
{ 0x282e, 0x0022 }, { 0x286e, 0x001e },
{ 0x282f, 0x001c }, { 0x286f, 0x001e },
{ 0x2830, 0x000f }, { 0x2870, 0x001e },
{ 0x2831, 0x0013 }, { 0x2871, 0x001e },
{ 0x2832, 0x0017 }, { 0x2872, 0x001e },
{ 0x2833, 0x001a }, { 0x2873, 0x001e },
{ 0x2834, 0x001f }, { 0x2874, 0x001e },
{ 0x2835, 0x0024 }, { 0x2875, 0x001e },
{ 0x2836, 0x0024 }, { 0x2876, 0x001e },
{ 0x2837, 0x001e }, { 0x2877, 0x001e },
{ 0x2838, 0x0016 }, { 0x2878, 0x001e },
{ 0x2839, 0x001c }, { 0x2879, 0x001e },
{ 0x283a, 0x001d }, { 0x287a, 0x001e },
{ 0x283b, 0x001d }, { 0x287b, 0x001e },
{ 0x283c, 0x0022 }, { 0x287c, 0x001e },
{ 0x283d, 0x001e }, { 0x287d, 0x001e },
{ 0x283e, 0x001f }, { 0x287e, 0x001e },
{ 0x283f, 0x001e }, { 0x287f, 0x001e }
};
int len = sizeof (jpReg) / sizeof (jpReg[0]);
uint8_t bytes[4];
int i;
CHECK (gp_port_usb_msg_write (port, 0x00, 0x0000, 0x2000, NULL, 0x00));
CHECK (gp_port_usb_msg_write (port, 0x00, 0x0013, 0x2301, NULL, 0x00));
CHECK (gp_port_usb_msg_write (port, 0x00, 0x0001, 0x2883, NULL, 0x00));
for (i=0 ; i<len ; i++) {
CHECK (gp_port_usb_msg_write (port, 0x00, jpReg[i].val,
jpReg[i].reg, NULL, 0x00));
CHECK (gp_port_usb_msg_read (port, 0x00, 0x0000,
jpReg[i].reg, bytes, 0x01));
}
CHECK (gp_port_usb_msg_write (port, 0x00, 0x0001, 0x2501, NULL, 0x00));
CHECK (gp_port_usb_msg_write (port, 0x00, 0x0000, 0x2306, NULL, 0x00));
CHECK (gp_port_usb_msg_write (port, 0x08, 0x0000, 0x0006, NULL, 0x00));
/* Read the same thing thrice, for whatever reason.
* From working on getting iso traffic working with this chip, I've found
* out, that 0x01, 0x0000, 0x0001 polls the chip for completion of a
* command. Unfortunately it is of yet unclear, what the exact procedure
* is. Until we know, let's keep this here. */
CHECK (gp_port_usb_msg_read (port, 0x01, 0x0000, 0x0001, bytes, 0x01));
CHECK (gp_port_usb_msg_read (port, 0x01, 0x0000, 0x0001, bytes, 0x01));
CHECK (gp_port_usb_msg_read (port, 0x01, 0x0000, 0x0001, bytes, 0x01));
/* Set to idle? */
CHECK (gp_port_usb_msg_read (port, 0x01, 0x0000, 0x000f, NULL, 0x00));
return GP_OK;
}
static int
yuv2rgb (int y, int u, int v, int *_r, int *_g, int *_b)
{
double r, g, b;
r = (char) y + 128 + 1.402 * (char) v;
g = (char) y + 128 - 0.34414 * (char) u - 0.71414 * (char) v;
b = (char) y + 128 + 1.772 * (char) u;
if (r > 255)
r = 255;
if (g > 255)
g = 255;
if (b > 255)
b = 255;
if (r < 0)
r = 0;
if (g < 0)
g = 0;
if (b < 0)
b = 0;
*_r = r;
*_g = g;
*_b = b;
return GP_OK;
}

View File

@@ -1,47 +0,0 @@
/* spca504_flash.h
*
* This library is free software; you can redistribute and/or
* modify it inder the terms of the GNU Lesser Genreral Public
* License as publiced by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warrenty of
* MERCHANTABULITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* lesser General Public License for more details.
*
* Author: Till Adam <till@adam-lilienthal.de>
* based on work by: Mark A. Zimmerman <mark@foresthaven.com>
*/
#ifndef __SPCA504_FLASH_H__
#define __SPCA504_FLASH_H__
#include <_stdint.h>
#include <gphoto2.h>
#include <gphoto2-port.h>
#define CHECK(result) {int res; res = result; if (res < 0) return (res);}
struct _CameraPrivateLibrary
{
GPPort *gpdev;
uint8_t *toc;
int dirty :1;
};
int spca504_flash_init(GPPort *port, GPContext *context);
int spca504_flash_close(GPPort *port, GPContext *context);
int spca504_flash_get_TOC(CameraPrivateLibrary *pl, int *filecount);
int spca504_flash_get_file_name(CameraPrivateLibrary *pl, int index, char *name);
int spca504_flash_get_file_dimensions(CameraPrivateLibrary *pl, int index,
int *w, int *h);
int spca504_flash_get_file (CameraPrivateLibrary *lib, GPContext *context,
uint8_t **buf, unsigned int *len, int index, int thumbnail);
int spca504_flash_get_file_size(CameraPrivateLibrary *pl, int index, int *size);
int spca504_flash_get_filecount(GPPort *port, int *filecount);
#endif