Batch commit from weekend work:
- removed "type" from CameraFile handling: - all put_file functions and hooks get "type" as argument now - added type to the set_file_info_noop call - started removal of "name" from CameraFile - generate new filename from original filename + camerafile type + mimetype - new gp_camera_autodetect() helper function - adapted all drivers. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@11818 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
24
NEWS
24
NEWS
@@ -1,12 +1,28 @@
|
||||
libgphoto2 2.4.99.1 development state
|
||||
libgphoto2 2.4.99.2 development state
|
||||
|
||||
libgphoto2 API:
|
||||
* CameraFileInfoFile: removed "name" structmember and GP_FILE_INFO_NAME
|
||||
flags.
|
||||
Use direct passing in of the filename to the API functions.
|
||||
|
||||
* gp_file_set_name() passing in is no longer needed and the API will
|
||||
go away.
|
||||
* New: gp_camera_autodetect(CameraList *list, GPContext*);
|
||||
|
||||
Simple autodetection function returning all current detected cameras.
|
||||
|
||||
* (not yet New: gp_camera_open (Camera *camera, const char *name, const char *port, GPContext *context);
|
||||
|
||||
Simple open function without needing to involve libgphoto2_port.
|
||||
)
|
||||
* gp_file_set_name() and _get_name() passing in is no longer needed
|
||||
and the API will go away.
|
||||
|
||||
* New gp_file_get_name_by_type() will convert a regular filename ("normal")
|
||||
into one depending on type (e.g. "raw_" prefix) and adjusted suffix
|
||||
(like ".ppm" turning into ".pgm" for grayscale previews).
|
||||
|
||||
* gp_file_set_type() and gp_file_get_type() are gone, these functions
|
||||
are now implicit passed via arguments to the the put_file and
|
||||
set_file_noop() functions.
|
||||
|
||||
* gp_filesystem_set_info_noop(), gp_filesystem_set_file_noop(),
|
||||
gp_filesystem_put_file(), gp_camera_folder_put_file():
|
||||
@@ -14,6 +30,8 @@ libgphoto2 API:
|
||||
Added "filename" argument to pass in the filename. The one
|
||||
from CameraFileInfoFile and CameraFile are no longer used.
|
||||
|
||||
Added "type" argument to pass in the filetype (GP_FILE_TYPE_*).
|
||||
|
||||
* Adjusted to new GPPortInfo handling.
|
||||
|
||||
* Rewrote gphoto2-filesys.c to be directory based (in a tree structure).
|
||||
|
||||
@@ -557,9 +557,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
}
|
||||
gp_file_set_data_and_size ( file, (char *)data, size );
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG); /* always */
|
||||
/* Add an arbitrary file name so caller won't crash */
|
||||
gp_file_set_name (file, "canon_preview.jpg");
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -875,7 +872,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
}
|
||||
|
||||
/* do different things with the data fetched above */
|
||||
/* FIXME: For which file type(s) should we gp_file_set_name(file,filename) ? */
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
/* Either this camera model does not support EXIF,
|
||||
@@ -904,19 +900,16 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
gp_file_set_data_and_size (file, (char *)data, datalen);
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG); /* always */
|
||||
gp_file_set_name (file, filename);
|
||||
break;
|
||||
|
||||
case GP_FILE_TYPE_AUDIO:
|
||||
gp_file_set_mime_type (file, GP_MIME_WAV);
|
||||
gp_file_set_data_and_size (file, (char *)data, datalen);
|
||||
gp_file_set_name (file, filename);
|
||||
break;
|
||||
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
gp_file_set_mime_type (file, filename2mimetype (filename));
|
||||
gp_file_set_data_and_size (file, (char *)data, datalen);
|
||||
gp_file_set_name (file, filename);
|
||||
break;
|
||||
#ifdef HAVE_LIBEXIF
|
||||
case GP_FILE_TYPE_EXIF:
|
||||
@@ -1285,7 +1278,8 @@ convert_filename_to_8_3(const char* filename, char* dest)
|
||||
|
||||
/* XXX This function should be merged with the other one of the same name */
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFile *file, void *data,
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -1296,6 +1290,9 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, C
|
||||
|
||||
GP_DEBUG ("camera_folder_put_file()");
|
||||
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
|
||||
if (!check_readiness (camera, context))
|
||||
return GP_ERROR;
|
||||
|
||||
@@ -1408,7 +1405,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, C
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder, const char *filename,
|
||||
CameraFile *file, void *data,
|
||||
CameraFileType type, CameraFile *file, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -1419,6 +1416,8 @@ put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder, c
|
||||
CameraAbilities a;
|
||||
|
||||
GP_DEBUG ("camera_folder_put_file()");
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
|
||||
if (camera->port->type == GP_PORT_USB) {
|
||||
gp_context_error (context,
|
||||
|
||||
@@ -251,7 +251,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (GP_FILE_TYPE_RAW == type) { /* type is GP_FILE_TYPE_RAW */
|
||||
size = b;
|
||||
gp_file_set_mime_type (file, GP_MIME_RAW);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_append(file, (char *)data, size);
|
||||
/* Save photo's catalog entry as a footer for the raw file */
|
||||
gp_file_append(file, (char *)camera->pl->catalog + k*0x10, 0x10);
|
||||
@@ -301,7 +300,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
} else
|
||||
white_balance (ptr, w*h, 1.1);
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
/* Reset camera when done, for more graceful exit. */
|
||||
if (k +1 == camera->pl->nb_entries) {
|
||||
@@ -380,7 +378,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
} else
|
||||
white_balance (ptr, w*h, 1.1);
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
digi_reset(camera->port);
|
||||
return (GP_OK);
|
||||
|
||||
@@ -340,8 +340,6 @@ static int get_file_func(CameraFilesystem *fs, const char *folder,
|
||||
if (!data)
|
||||
return GP_ERROR;
|
||||
|
||||
gp_file_set_name(file, filename);
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
gp_file_set_data_and_size(file, (char*)data, buflen);
|
||||
|
||||
@@ -279,7 +279,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (num < 0)
|
||||
return num;
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
data = Dimera_Get_Full_Image (num, &size,
|
||||
@@ -391,7 +390,6 @@ static int camera_capture_preview(Camera *camera, CameraFile *file, GPContext *c
|
||||
long size;
|
||||
uint8_t *data;
|
||||
|
||||
gp_file_set_name (file, RAM_IMAGE_TEMPLATE);
|
||||
gp_file_set_mime_type (file, GP_MIME_PGM);
|
||||
|
||||
data = Dimera_Preview( &size, camera, context);
|
||||
|
||||
@@ -637,7 +637,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
char path[2048];
|
||||
int result;
|
||||
|
||||
@@ -344,19 +344,12 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
Camera *camera = data;
|
||||
int image_no, result;
|
||||
//int i, ret, numpics;
|
||||
|
||||
|
||||
char* img_data=NULL;
|
||||
int img_size=-1;
|
||||
|
||||
image_no = gp_filesystem_number(fs, folder, filename, context);
|
||||
gp_file_set_name (file, filename);
|
||||
|
||||
gp_log(GP_LOG_DEBUG, "enigma13","Index of image %d is %s",image_no, filename);
|
||||
|
||||
|
||||
switch (type) {
|
||||
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
{
|
||||
gp_log(GP_LOG_DEBUG, "enigma13","Downloading raw image");
|
||||
@@ -366,13 +359,10 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
result = GP_ERROR_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result < 0)
|
||||
return result;
|
||||
return (GP_OK);
|
||||
|
||||
@@ -225,12 +225,14 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
const char *d;
|
||||
unsigned long int d_len;
|
||||
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
CR (gp_file_get_data_and_size (file, &d, &d_len));
|
||||
CR (fuji_upload_init (camera, name, context));
|
||||
return fuji_upload (camera, d, d_len, context);
|
||||
|
||||
@@ -276,7 +276,6 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
default:
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
CHECK (gp_file_set_name (file, filename));
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
/* Unsupported format, fallthrough to raw */
|
||||
case GP_FILE_TYPE_RAW:
|
||||
gp_file_set_mime_type (file, GP_MIME_RAW);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_adjust_name_for_mime_type (file);
|
||||
gp_file_set_data_and_size (file, (char *)frame_data, datasize);
|
||||
return (GP_OK);
|
||||
@@ -296,11 +295,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
ptr += w*h*3;
|
||||
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, ppmsize);
|
||||
|
||||
free (frame_data);
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
char *raw, *ppm;
|
||||
char tmp_filename[128];
|
||||
unsigned char gtable[256];
|
||||
char *ptr;
|
||||
int size = 0, n = 0;
|
||||
@@ -224,7 +223,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
gp_gamma_correct_single( gtable, ptr, height * width );
|
||||
|
||||
CHECK_free (gp_file_set_mime_type (file, GP_MIME_PPM));
|
||||
CHECK_free (gp_file_set_name (file, filename));
|
||||
CHECK_free (gp_file_append (file, ppm, size));
|
||||
break;
|
||||
|
||||
@@ -249,18 +247,12 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
gp_gamma_correct_single( gtable, ptr, jc_file->width * jc_file->height );
|
||||
|
||||
CHECK_free (gp_file_set_mime_type (file, GP_MIME_PPM));
|
||||
CHECK_free (gp_file_set_name (file, filename));
|
||||
CHECK_free (gp_file_append (file, ppm, size));
|
||||
break;
|
||||
|
||||
case GP_FILE_TYPE_RAW:
|
||||
CHECK_free (jamcam_request_image (camera, file, raw, &size, n, context));
|
||||
CHECK_free (gp_file_set_mime_type (file, GP_MIME_RAW));
|
||||
strcpy( tmp_filename, filename );
|
||||
tmp_filename[strlen(tmp_filename)-3] = 'r';
|
||||
tmp_filename[strlen(tmp_filename)-2] = 'a';
|
||||
tmp_filename[strlen(tmp_filename)-1] = 'w';
|
||||
CHECK_free (gp_file_set_name (file, tmp_filename));
|
||||
CHECK_free (gp_file_append (file, raw, size));
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -99,7 +99,7 @@ build_huffmann_tree(struct compstate *cs) {
|
||||
#define F4 0.0
|
||||
|
||||
void
|
||||
picture_decomp_v1(char *compressed,char *uncompressed,int width,int height) {
|
||||
picture_decomp_v1(unsigned char *compressed,unsigned char *uncompressed,int width,int height) {
|
||||
struct compstate cs;
|
||||
unsigned char xbyte;
|
||||
int i=0,curbyte=0,diff,lastval;
|
||||
@@ -152,7 +152,7 @@ picture_decomp_v1(char *compressed,char *uncompressed,int width,int height) {
|
||||
|
||||
/* Just blow up the picture from 6 bit uncompressed to 8 bit uncompressed */
|
||||
void
|
||||
picture_decomp_v2(char *compressed,char *uncompressed,int width,int height) {
|
||||
picture_decomp_v2(unsigned char *compressed,unsigned char *uncompressed,int width,int height) {
|
||||
struct compstate cs;
|
||||
int i,j;
|
||||
unsigned char xbyte;
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
|
||||
#ifndef _JD11_DECOMP_H
|
||||
#define _JD11_DECOMP_H
|
||||
extern void picture_decomp_v1(char *compressed,char *uncompressed,int width,int height);
|
||||
extern void picture_decomp_v2(char *compressed,char *uncompressed,int width,int height);
|
||||
extern void picture_decomp_v1(unsigned char *compressed,unsigned char *uncompressed,int width,int height);
|
||||
extern void picture_decomp_v2(unsigned char *compressed,unsigned char *uncompressed,int width,int height);
|
||||
#endif
|
||||
|
||||
@@ -124,7 +124,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if(image_no < 0)
|
||||
return image_no;
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, GP_MIME_PNM);
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_RAW:
|
||||
|
||||
@@ -83,8 +83,8 @@ dwrite(GPPort*port, caddr_t buf, int xsize) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#define READ gp_port_read
|
||||
#define WRITE gp_port_write
|
||||
#define READ(port,buf,len) gp_port_read(port,(char*)(buf),len)
|
||||
#define WRITE(port,buf,len) gp_port_write(port,(char*)(buf),len)
|
||||
|
||||
static int _send_cmd(GPPort *port,unsigned short cmd) {
|
||||
unsigned char buf[2];
|
||||
@@ -358,7 +358,7 @@ jd11_erase_all(GPPort *port) {
|
||||
int
|
||||
jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
int i, id, count, xsize, curread=0, ret=0;
|
||||
char *indexbuf;
|
||||
unsigned char *indexbuf;
|
||||
|
||||
ret = jd11_select_index(port);
|
||||
if (ret != GP_OK)
|
||||
@@ -394,7 +394,8 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
gp_context_progress_stop (context, id);
|
||||
for (i=0;i<count;i++) {
|
||||
CameraFile *file;
|
||||
char *src, fn[20];
|
||||
char fn[20];
|
||||
unsigned char *src;
|
||||
unsigned char thumb[64*48];
|
||||
int y;
|
||||
CameraFileInfo info;
|
||||
@@ -405,8 +406,6 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
return ret;
|
||||
}
|
||||
sprintf(fn,"image%02i.pgm",i);
|
||||
gp_file_set_type (file, GP_FILE_TYPE_PREVIEW);
|
||||
gp_file_set_name(file, fn);
|
||||
gp_file_set_mime_type(file, GP_MIME_PGM);
|
||||
gp_file_append(file, THUMBHEADER, strlen(THUMBHEADER));
|
||||
src = indexbuf+(i*64*48);
|
||||
@@ -415,7 +414,7 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
for (x=0;x<64;x++)
|
||||
thumb[47*64-off+(63-x)] = src[off+x];
|
||||
}
|
||||
ret = gp_file_append(file,thumb,sizeof(thumb));
|
||||
ret = gp_file_append(file,(char*)thumb,sizeof(thumb));
|
||||
if (ret != GP_OK) {
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
@@ -426,7 +425,7 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
}
|
||||
ret = gp_filesystem_set_file_noop(fs, "/", fn, file, context);
|
||||
ret = gp_filesystem_set_file_noop(fs, "/", fn, GP_FILE_TYPE_PREVIEW, file, context);
|
||||
if (ret != GP_OK) return ret;
|
||||
|
||||
/* we also get the fs info for free, so just set it */
|
||||
@@ -497,7 +496,7 @@ jd11_get_image_full(
|
||||
) {
|
||||
unsigned char *s,*uncomp[3],**imagebufs;
|
||||
int ret,sizes[3];
|
||||
char *data;
|
||||
unsigned char *data;
|
||||
int h;
|
||||
|
||||
ret = serial_image_reader(camera,file,nr,&imagebufs,sizes, context);
|
||||
@@ -551,7 +550,7 @@ jd11_get_image_full(
|
||||
}
|
||||
free(uncomp[0]);free(uncomp[1]);free(uncomp[2]);
|
||||
free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs);
|
||||
gp_file_append(file, data, 640*480*3);
|
||||
gp_file_append(file, (char*)data, 640*480*3);
|
||||
free(data);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
if (GP_FILE_TYPE_RAW == type) {
|
||||
gp_file_set_mime_type(file, GP_MIME_RAW);
|
||||
gp_file_set_name(file, filename);
|
||||
gp_file_set_data_and_size(file, (char *)data , b+14 );
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -258,7 +257,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_gamma_fill_table (gtable, .65);
|
||||
gp_gamma_correct_single (gtable, ptr, w * h);
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
end:
|
||||
free(data);
|
||||
|
||||
@@ -312,12 +312,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
if (GP_FILE_TYPE_RAW == type) {
|
||||
gp_file_set_mime_type(file, GP_MIME_RAW);
|
||||
gp_file_set_name(file, filename);
|
||||
gp_file_set_data_and_size(file, (char *)pic_buffer , b+16 );
|
||||
return GP_OK;
|
||||
} else return GP_ERROR_NOT_SUPPORTED;
|
||||
|
||||
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -125,11 +125,9 @@ get_info (Camera *camera, unsigned int n, CameraFileInfo *info,
|
||||
strcpy (info->file.type, GP_MIME_JPEG);
|
||||
sprintf (fn, "%06i.jpeg", (int) image_id);
|
||||
|
||||
if (file) {
|
||||
gp_file_set_type (file, GP_FILE_TYPE_EXIF);
|
||||
gp_file_set_name (file, fn);
|
||||
if (file)
|
||||
gp_file_set_data_and_size (file, buffer, buffer_size);
|
||||
} else
|
||||
else
|
||||
free (buffer);
|
||||
|
||||
return (GP_OK);
|
||||
@@ -171,7 +169,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
*/
|
||||
gp_filesystem_append (camera->fs, folder, fn, context);
|
||||
gp_filesystem_set_info_noop (camera->fs, folder, fn, info, context);
|
||||
gp_filesystem_set_file_noop (camera->fs, folder, fn, file, context);
|
||||
gp_filesystem_set_file_noop (camera->fs, folder, fn, GP_FILE_TYPE_PREVIEW, file, context);
|
||||
gp_file_unref (file);
|
||||
|
||||
gp_context_idle (context);
|
||||
@@ -389,7 +387,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_file_unref (file);
|
||||
return (result);
|
||||
}
|
||||
gp_filesystem_set_file_noop (fs, folder, filename, file, context);
|
||||
gp_filesystem_set_file_noop (fs, folder, filename, GP_FILE_TYPE_PREVIEW, file, context);
|
||||
gp_file_unref (file);
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -596,11 +594,9 @@ camera_capture (Camera* camera, CameraCaptureType type, CameraFilePath* path,
|
||||
gp_filesystem_set_info_noop (camera->fs, path->folder, fn, info, context);
|
||||
|
||||
gp_file_new (&file);
|
||||
gp_file_set_name (file, fn);
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
gp_file_set_type (file, GP_FILE_TYPE_EXIF);
|
||||
gp_file_set_data_and_size (file, buffer, buffer_size);
|
||||
gp_filesystem_set_file_noop (camera->fs, path->folder, fn, file, context);
|
||||
gp_filesystem_set_file_noop (camera->fs, path->folder, fn, GP_FILE_TYPE_EXIF, file, context);
|
||||
gp_file_unref (file);
|
||||
|
||||
return (GP_OK);
|
||||
|
||||
@@ -177,9 +177,9 @@ k_info_img (unsigned int image_no, void *data, CameraFileInfo* info,
|
||||
cmd[3] = 0x30 + ((image_no/100 )%10);
|
||||
cmd[4] = 0x30 + ((image_no/10 )%10);
|
||||
cmd[5] = 0x30 + ( image_no %10);
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (camera->port, buf, INFO_BUFFER);
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
if (ret<GP_OK) return ret;
|
||||
|
||||
/* Search the image data number into the memory */
|
||||
@@ -240,9 +240,9 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
cmd[5] = 0x30 + ((image_no/10 )%10);
|
||||
cmd[6] = 0x30 + ( image_no %10);
|
||||
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret < GP_OK) return ret;
|
||||
if (ack == NACK) {
|
||||
gp_context_error(context, _("This preview doesn't exist."));
|
||||
@@ -257,13 +257,13 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
unsigned char csum;
|
||||
int xret;
|
||||
|
||||
xret = gp_port_read (camera->port, buf, DATA_BUFFER);
|
||||
xret = gp_port_read (camera->port, (char*)buf, DATA_BUFFER);
|
||||
if (xret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
gp_context_progress_stop (context, id);
|
||||
return xret;
|
||||
}
|
||||
ret = gp_port_read (camera->port, &csum, CSUM_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&csum, CSUM_LEN);
|
||||
if (ret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
gp_context_progress_stop (context, id);
|
||||
@@ -274,7 +274,7 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
gp_context_progress_stop (context, id);
|
||||
/* acknowledge the packet */
|
||||
ack = NACK;
|
||||
ret = gp_port_write (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret < GP_OK)
|
||||
return ret;
|
||||
gp_context_error(context, _("Data has been corrupted."));
|
||||
@@ -290,13 +290,13 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
|
||||
/* acknowledge the packet */
|
||||
ack = ACK;
|
||||
ret = gp_port_write (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
}
|
||||
ret = gp_port_read (camera->port, &state, STATE_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&state, STATE_LEN);
|
||||
if (ret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
gp_context_progress_stop (context, id);
|
||||
@@ -310,7 +310,7 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
}
|
||||
/* acknowledge the packet */
|
||||
ack = ACK;
|
||||
ret = gp_port_write (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
gp_context_progress_stop (context, id);
|
||||
@@ -333,7 +333,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
GPContext *context)
|
||||
{
|
||||
unsigned char *d,*thumbnail;
|
||||
int image_no, len, ret, image_number;
|
||||
unsigned int image_number;
|
||||
int image_no, len, ret;
|
||||
long long_len;
|
||||
CameraFileInfo file_info;
|
||||
exifparser exifdat;
|
||||
@@ -396,11 +397,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
_("Image type %d is not supported by this camera !"), type);
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
if (type == GP_FILE_TYPE_EXIF)
|
||||
gp_file_set_type (file, GP_FILE_TYPE_EXIF);
|
||||
ret = gp_file_append(file, d, len);
|
||||
ret = gp_file_append(file, (char*)d, len);
|
||||
free(d);
|
||||
return (ret);
|
||||
}
|
||||
@@ -416,7 +414,8 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
Camera *camera = data;
|
||||
CameraFileInfo file_info;
|
||||
unsigned char cmd[7], ack;
|
||||
int image_no, ret;
|
||||
unsigned int image_no;
|
||||
int ret;
|
||||
|
||||
GP_DEBUG ("*** ENTER: delete_file_func ***");
|
||||
|
||||
@@ -444,9 +443,9 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
cmd[4] = 0x30 + ((image_no/100 )%10);
|
||||
cmd[5] = 0x30 + ((image_no/10 )%10);
|
||||
cmd[6] = 0x30 + ( image_no %10);
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret<GP_OK) return ret;
|
||||
if (ack != ACK) {
|
||||
gp_context_error(context, _("Can't delete image %s."),filename);
|
||||
@@ -475,9 +474,9 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
cmd[4] = 0x30;
|
||||
cmd[5] = 0x30;
|
||||
cmd[6] = 0x30;
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret<GP_OK) return ret;
|
||||
if (ack != ACK) {
|
||||
gp_context_error(context, _("Can't delete all images."));
|
||||
@@ -493,7 +492,8 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
* Upload an image to the camera
|
||||
*/
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name, CameraFile *file,
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFileType type, CameraFile *file,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -508,13 +508,13 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name, Camer
|
||||
/* Send function */
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = UPLOADDATA;
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
gp_file_get_data_and_size(file, &d, &len);
|
||||
id = gp_context_progress_start (context, len, _("Uploading image..."));
|
||||
for (i=0; i < ((len+DATA_BUFFER-1) / DATA_BUFFER); i++) {
|
||||
ret = gp_port_read (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
@@ -527,14 +527,14 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name, Camer
|
||||
return (GP_ERROR);
|
||||
}
|
||||
state = NEXTFRAME;
|
||||
ret = gp_port_write (camera->port, &state, STATE_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&state, STATE_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
}
|
||||
if ((len - len_sent) <= DATA_BUFFER) {
|
||||
/* Send the last datas */
|
||||
ret = gp_port_write (camera->port, &d[i*DATA_BUFFER],
|
||||
ret = gp_port_write (camera->port, (char*)&d[i*DATA_BUFFER],
|
||||
(len - len_sent));
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
@@ -542,7 +542,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name, Camer
|
||||
}
|
||||
/* and complete with zeros */
|
||||
bzero(buf,DATA_BUFFER);
|
||||
ret = gp_port_write (camera->port, buf, (DATA_BUFFER -
|
||||
ret = gp_port_write (camera->port, (char*)buf, (DATA_BUFFER -
|
||||
(len - len_sent)));
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
@@ -567,7 +567,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name, Camer
|
||||
(unsigned char *)&d[i*DATA_BUFFER],
|
||||
DATA_BUFFER);
|
||||
}
|
||||
ret = gp_port_write (camera->port, &sum, CSUM_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&sum, CSUM_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
@@ -575,12 +575,12 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name, Camer
|
||||
gp_context_progress_update (context, id, len_sent);
|
||||
}
|
||||
state = EOT;
|
||||
ret = gp_port_write (camera->port, &state, STATE_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&state, STATE_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
}
|
||||
ret = gp_port_read (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
@@ -610,10 +610,10 @@ camera_capture (Camera* camera, CameraCaptureType type, CameraFilePath* path,
|
||||
/* Just check if there is space available yet */
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = GETCAMINFO;
|
||||
ret = gp_port_write (camera->port, cmd, 2);
|
||||
ret = gp_port_write (camera->port, (char*)cmd, 2);
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
ret = gp_port_read (camera->port, buf, INFO_BUFFER);
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
nbr_images = (buf[FREE_IMAGE_PTR] << 8) | (buf[FREE_IMAGE_PTR+1]);
|
||||
images_taken = (buf[TAKEN_IMAGE_PTR] << 8) | (buf[TAKEN_IMAGE_PTR+1]);
|
||||
|
||||
@@ -621,10 +621,10 @@ camera_capture (Camera* camera, CameraCaptureType type, CameraFilePath* path,
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = CAPTUREIMAGE_CMD1;
|
||||
cmd[2] = CAPTUREIMAGE_CMD2;
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
ret = gp_port_read (camera->port, &ack, ACK_LEN);
|
||||
ret = gp_port_read (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
if (ack == NACK) {
|
||||
@@ -695,10 +695,10 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = GETCAMINFO;
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
ret = gp_port_read (camera->port, buf, INFO_BUFFER);
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
num = (buf[TAKEN_IMAGE_PTR] << 8) | (buf[TAKEN_IMAGE_PTR+1]);
|
||||
@@ -726,10 +726,10 @@ camera_get_config (Camera* camera, CameraWidget** window, GPContext *context)
|
||||
/* get informations about camera */
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = GETCAMINFO;
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
ret = gp_port_read (camera->port, buf, INFO_BUFFER);
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
|
||||
@@ -1111,7 +1111,8 @@ static int
|
||||
camera_summary (Camera *camera, CameraText *text, GPContext *context)
|
||||
{
|
||||
unsigned char cmd[2], buf[INFO_BUFFER];
|
||||
unsigned char power[20],mode[20],date_disp[20],date[50];
|
||||
char date_disp[20],date[50];
|
||||
char power[20],mode[20];
|
||||
int ret,capacity=0,autopoweroff=0,image_taken=0,image_remained=0;
|
||||
time_t timestamp=0;
|
||||
struct tm tmp;
|
||||
@@ -1121,10 +1122,10 @@ camera_summary (Camera *camera, CameraText *text, GPContext *context)
|
||||
/* get informations about camera */
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = GETCAMINFO;
|
||||
ret = gp_port_write (camera->port, cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
ret = gp_port_read (camera->port, buf, INFO_BUFFER);
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -156,11 +156,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
ret = largan_get_pict (camera, pict_type, (uint8_t)index, pict);
|
||||
if (ret == GP_OK) {
|
||||
gp_file_append (file, pict->data , pict->data_size);
|
||||
gp_file_set_name (file, filename);
|
||||
if (pict->type == LARGAN_THUMBNAIL) {
|
||||
gp_file_set_mime_type (file, GP_MIME_BMP);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
p_data[43] = ((raw_size)>>24)&0xff;
|
||||
memcpy (p_data+44, data, raw_size);
|
||||
gp_file_set_mime_type(file, GP_MIME_WAV);
|
||||
gp_file_set_name(file, filename);
|
||||
gp_file_set_data_and_size(file, (char *)p_data , raw_size+44);
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -286,7 +285,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (!audio)
|
||||
data[6] = (data[6] | res_code);
|
||||
gp_file_set_mime_type(file, GP_MIME_RAW);
|
||||
gp_file_set_name(file, filename);
|
||||
gp_file_set_data_and_size(file, (char *)data , raw_size );
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -322,7 +320,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_gamma_correct_single (gtable, ptr, w * h);
|
||||
mars_white_balance (ptr, w*h, 1.4, gamma_factor);
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
free (p_data);
|
||||
|
||||
|
||||
@@ -47,11 +47,11 @@ int dimagev_get_camera_data(dimagev_t *dimagev) {
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
if ( gp_port_write(dimagev->dev, p->buffer, p->length) < GP_OK ) {
|
||||
if ( gp_port_write(dimagev->dev, (char*)p->buffer, p->length) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_get_camera_data::unable to write packet");
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
} else if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
} else if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_get_camera_data::no response from camera");
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
@@ -79,13 +79,13 @@ int dimagev_get_camera_data(dimagev_t *dimagev) {
|
||||
}
|
||||
|
||||
char_buffer = DIMAGEV_EOT;
|
||||
if ( gp_port_write(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
if ( gp_port_write(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_get_camera_data::unable to send EOT");
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_get_camera_data::no response from camera");
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
@@ -155,12 +155,12 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
if ( gp_port_write(dimagev->dev, p->buffer, p->length) < GP_OK ) {
|
||||
if ( gp_port_write(dimagev->dev, (char*)p->buffer, p->length) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::unable to send set_data packet");
|
||||
free(p);
|
||||
free(export_data);
|
||||
return GP_ERROR_IO;
|
||||
} else if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
} else if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::no response from camera - trying to send NAK");
|
||||
free(p);
|
||||
free(export_data);
|
||||
@@ -194,7 +194,7 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
|
||||
free(export_data);
|
||||
|
||||
if ( gp_port_write(dimagev->dev, p->buffer, p->length) < GP_OK ) {
|
||||
if ( gp_port_write(dimagev->dev, (char*)p->buffer, p->length) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::unable to send data packet");
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
@@ -202,7 +202,7 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
|
||||
free(p);
|
||||
|
||||
if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
@@ -223,12 +223,12 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
|
||||
|
||||
char_buffer = DIMAGEV_EOT;
|
||||
if ( gp_port_write(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
if ( gp_port_write(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::unable to send EOT");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
if ( gp_port_read(dimagev->dev, &char_buffer, 1) < GP_OK ) {
|
||||
if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = data;
|
||||
int file_number=0, result;
|
||||
char buffer[128];
|
||||
|
||||
file_number = gp_filesystem_number(fs, folder, filename, context);
|
||||
if (file_number < 0)
|
||||
@@ -144,17 +143,10 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
gp_file_set_name (file, filename);
|
||||
result = dimagev_get_picture (camera->pl, file_number + 1, file);
|
||||
break;
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
#if defined HAVE_SNPRINTF
|
||||
snprintf(buffer, sizeof(buffer), DIMAGEV_THUMBNAIL_FMT, ( file_number + 1) );
|
||||
#else
|
||||
sprintf(buffer, DIMAGEV_THUMBNAIL_FMT, ( file_number + 1) );
|
||||
#endif
|
||||
gp_file_set_name (file, buffer);
|
||||
result = dimagev_get_thumbnail (camera->pl, file_number + 1, file);
|
||||
break;
|
||||
default:
|
||||
@@ -215,7 +207,7 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
|
||||
}
|
||||
|
||||
static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
|
||||
@@ -113,8 +113,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
gp_file_set_name(file,filename);
|
||||
gp_file_set_mime_type (file, "image/jpeg");
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
gp_file_set_data_and_size(file, data, size);
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -413,8 +413,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if ((size = dsc1_selectimage(camera, index + 1)) < 0)
|
||||
return (GP_ERROR);
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, "image/jpeg");
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
|
||||
id = gp_context_progress_start (context, size, _("Getting data..."));
|
||||
for (i = 0, s = 0; s < size; i++) {
|
||||
@@ -432,14 +431,14 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
|
||||
static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *user_data,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
int blocks, blocksize, i;
|
||||
int result;
|
||||
const char *data;
|
||||
long int size;
|
||||
unsigned long int size;
|
||||
unsigned int id;
|
||||
|
||||
gp_context_status(context, _("Uploading image: %s."), name);
|
||||
|
||||
@@ -535,7 +535,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if (size < 0)
|
||||
return (size);
|
||||
|
||||
CHECK (gp_file_set_name(file, filename));
|
||||
CHECK (gp_file_set_mime_type(file, GP_MIME_JPEG));
|
||||
|
||||
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
|
||||
@@ -554,7 +553,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
|
||||
static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *user_data,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
GPContext *context) {
|
||||
|
||||
Camera *camera = user_data;
|
||||
@@ -565,7 +564,7 @@ static int put_file_func (CameraFilesystem *fs, const char *folder, const char *
|
||||
|
||||
gp_context_status(context, _("Uploading image: %s."), name);
|
||||
|
||||
/* We can not figure out file type, at least by now.
|
||||
/* We can not figure out file type, at least by now. (? curious, mime type -Marcus)
|
||||
|
||||
if (strcmp(file->type, "image/jpg") != 0) {
|
||||
dsc_print_message(camera, "JPEG image format allowed only.");
|
||||
|
||||
@@ -523,11 +523,8 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
}
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
|
||||
GP_DEBUG ("Camera Get File Done");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,11 +150,9 @@ file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
break;
|
||||
}
|
||||
|
||||
if (file) {
|
||||
gp_file_set_type (file, GP_FILE_TYPE_NORMAL);
|
||||
gp_file_set_name (file, fn);
|
||||
if (file)
|
||||
gp_file_set_data_and_size (file, buffer, size);
|
||||
} else
|
||||
else
|
||||
free (buffer);
|
||||
|
||||
/*
|
||||
@@ -163,16 +161,8 @@ file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
* */
|
||||
gp_filesystem_append (camera->fs, folder, fn, context);
|
||||
gp_filesystem_set_info_noop (camera->fs, folder, fn, info, context);
|
||||
/* FIXME: This is disabled for now, due to it seeming to
|
||||
* cause corruption within libgphoto itself.
|
||||
* A side effect of this is that file caching does
|
||||
* not happen, so files must be downloaded twice if
|
||||
* they are to be saved to disk.
|
||||
* NWG: Sun 19th January 2003.
|
||||
*
|
||||
* gp_filesystem_set_file_noop (camera->fs, folder, file,
|
||||
* context);
|
||||
*/
|
||||
gp_filesystem_set_file_noop (camera->fs, folder, fn, GP_FILE_TYPE_NORMAL,
|
||||
file, context);
|
||||
gp_file_unref (file);
|
||||
|
||||
gp_context_idle (context);
|
||||
@@ -206,9 +196,7 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
default:
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
gp_file_set_data_and_size (file, data, size);
|
||||
gp_file_set_name (file, filename);
|
||||
return GP_OK;
|
||||
return gp_file_set_data_and_size (file, data, size);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -228,9 +228,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
default:
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
gp_file_set_data_and_size(file, data, size);
|
||||
gp_file_set_name (file, filename);
|
||||
return GP_OK;
|
||||
return gp_file_set_data_and_size(file, data, size);
|
||||
}
|
||||
|
||||
static int camera_summary(Camera *camera, CameraText *summary, GPContext *context)
|
||||
|
||||
@@ -61,16 +61,16 @@ static void pccam600_wait_for_status(GPPort *port){
|
||||
unsigned char status = 1;
|
||||
while(status != 0x00){
|
||||
gp_port_set_timeout(port,3000);
|
||||
ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,&status,1);
|
||||
ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,(char*)&status,1);
|
||||
if (status == 0 || status == 8)
|
||||
return;
|
||||
if (status == 0xb0){
|
||||
gp_port_set_timeout(port,200000);
|
||||
ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,&status,1);
|
||||
ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,(char*)&status,1);
|
||||
}
|
||||
if (status == 0x40){
|
||||
gp_port_set_timeout(port,400000);
|
||||
ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,&status,1);
|
||||
ret = gp_port_usb_msg_read(port,0x06,0x00,0x00,(char*)&status,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,9 +86,9 @@ int pccam600_delete_file(GPPort *port, GPContext *context, int index){
|
||||
ret = gp_port_usb_msg_write(port,0x09,index,0x1001,NULL,0x00);
|
||||
pccam600_wait_for_status(port);
|
||||
gp_port_set_timeout(port, 400000);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,(char*)response,0x04);
|
||||
pccam600_wait_for_status(port);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,(char*)response,0x04);
|
||||
pccam600_wait_for_status(port);
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -99,10 +99,10 @@ int pccam600_get_mem_info(GPPort *port, GPContext *context, int *totalmem,
|
||||
unsigned char response[4];
|
||||
int ret;
|
||||
gp_port_set_timeout(port, 400000);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x03,(char*)response,0x04);
|
||||
*totalmem = response[2]*65536+response[1]*256+response[0];
|
||||
pccam600_wait_for_status(port);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x60,0x00,0x04,(char*)response,0x04);
|
||||
*freemem = response[2]*65536+response[1]*256+response[0];
|
||||
pccam600_wait_for_status(port);
|
||||
return GP_OK;
|
||||
@@ -120,7 +120,7 @@ int pccam600_get_file_list(GPPort *port, GPContext *context){
|
||||
gp_port_set_timeout(port, 200000);
|
||||
ret = gp_port_usb_msg_write(port,0x08,0x00,0x1021,NULL,0x00);
|
||||
pccam600_wait_for_status(port);
|
||||
ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,(char*)response,0x04);
|
||||
nr_of_blocks = response[2]*256+response[1];
|
||||
if (nr_of_blocks == 0){
|
||||
gp_log(GP_LOG_DEBUG,"pccam600 library: pccam600_get_file_list",
|
||||
@@ -143,13 +143,13 @@ int pccam600_get_file(GPPort *port, GPContext *context, int index){
|
||||
return GP_ERROR;
|
||||
}
|
||||
gp_port_set_timeout(port,200000);
|
||||
ret = gp_port_usb_msg_read(port,0x08,index,0x1001,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x08,index,0x1001,(char*)response,0x04);
|
||||
gp_port_set_timeout(port,3000);
|
||||
ret = gp_port_usb_msg_write(port,0x04,0x00,0x00,NULL,0x00);
|
||||
pccam600_wait_for_status(port);
|
||||
gp_port_set_timeout(port,200000);
|
||||
ret = gp_port_usb_msg_read(port,0x08,index,0x1002,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x08,index,0x1001,response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x08,index,0x1002,(char*)response,0x04);
|
||||
ret = gp_port_usb_msg_read(port,0x08,index,0x1001,(char*)response,0x04);
|
||||
nr_of_blocks = response[2]*256+response[1];
|
||||
if (nr_of_blocks == 0){
|
||||
gp_log(GP_LOG_DEBUG,
|
||||
@@ -167,7 +167,7 @@ int pccam600_get_file(GPPort *port, GPContext *context, int index){
|
||||
int pccam600_read_data(GPPort *port, unsigned char *buffer){
|
||||
int ret;
|
||||
gp_port_set_timeout(port,500);
|
||||
ret = gp_port_read(port,buffer,512);
|
||||
ret = gp_port_read(port,(char*)buffer,512);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -204,12 +204,12 @@ int pccam600_init(GPPort *port, GPContext *context){
|
||||
pccam600_wait_for_status(port);
|
||||
if (ret <0) return ret;
|
||||
gp_port_set_timeout(port,100000);
|
||||
ret = gp_port_usb_msg_read(port,0x08,0x00,0xff,response,0x1);
|
||||
ret = gp_port_usb_msg_read(port,0x08,0x00,0xff,(char*)response,0x1);
|
||||
gp_port_set_timeout(port,500);
|
||||
ret = gp_port_usb_msg_write(port,0x08,0x00,0x1020,NULL,0x0);
|
||||
pccam600_wait_for_status(port);
|
||||
gp_port_set_timeout(port,200000);
|
||||
ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,response,0x4);
|
||||
ret = gp_port_usb_msg_read(port,0x08,0x00,0x1000,(char*)response,0x4);
|
||||
nr_of_blocks = response[2]*256+response[1];
|
||||
nr_of_blocks = 512 / nr_of_blocks;
|
||||
gp_log(GP_LOG_DEBUG,"pccam600 library: init","nr_of_blocks %d",nr_of_blocks);
|
||||
@@ -220,7 +220,7 @@ int pccam600_init(GPPort *port, GPContext *context){
|
||||
}
|
||||
gp_port_set_timeout(port,500);
|
||||
for (i = 0; i<nr_of_blocks; i++){
|
||||
ret = gp_port_read(port, buffer,512);
|
||||
ret = gp_port_read(port, (char*)buffer,512);
|
||||
if (ret < 0){
|
||||
gp_log(GP_LOG_DEBUG,
|
||||
"pccam600 library: init"," gp_port_read returned %d:",
|
||||
|
||||
@@ -413,7 +413,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_RAW:
|
||||
CR (gp_file_set_data_and_size (file, data, size));
|
||||
CR (gp_file_set_name (file, filename));
|
||||
CR (gp_file_set_mime_type (file, GP_MIME_RAW));
|
||||
break;
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
|
||||
@@ -208,7 +208,7 @@ static struct {
|
||||
};
|
||||
|
||||
static int
|
||||
pdc640_read_packet (GPPort *port, char *buf, int buf_size)
|
||||
pdc640_read_packet (GPPort *port, unsigned char *buf, int buf_size)
|
||||
{
|
||||
int i;
|
||||
char checksum, c;
|
||||
@@ -218,7 +218,7 @@ pdc640_read_packet (GPPort *port, char *buf, int buf_size)
|
||||
buf[i] = 0;
|
||||
|
||||
/* Read the packet */
|
||||
CHECK_RESULT (gp_port_read (port, buf, buf_size));
|
||||
CHECK_RESULT (gp_port_read (port, (char*)buf, buf_size));
|
||||
|
||||
/* Calculate the checksum */
|
||||
for (i = 0, checksum = 0; i < buf_size; i++)
|
||||
@@ -234,8 +234,8 @@ pdc640_read_packet (GPPort *port, char *buf, int buf_size)
|
||||
}
|
||||
|
||||
static int
|
||||
pdc640_transmit (GPPort *port, char *cmd, int cmd_size,
|
||||
char *buf, int buf_size)
|
||||
pdc640_transmit (GPPort *port, unsigned char *cmd, int cmd_size,
|
||||
unsigned char *buf, int buf_size)
|
||||
{
|
||||
int r, tries;
|
||||
|
||||
@@ -250,7 +250,7 @@ pdc640_transmit (GPPort *port, char *cmd, int cmd_size,
|
||||
xcmd[3] = checksum & 0xff;
|
||||
|
||||
/* Wait until we get back the echo of the command. */
|
||||
r = gp_port_usb_msg_read( port, 0x10, xcmd[0]|(xcmd[1]<<8),xcmd[2]|(xcmd[3]<<8),xbuf,sizeof(xbuf));
|
||||
r = gp_port_usb_msg_read( port, 0x10, xcmd[0]|(xcmd[1]<<8),xcmd[2]|(xcmd[3]<<8),(char*)xbuf,sizeof(xbuf));
|
||||
/* Sometimes we want to read here, sometimes not.
|
||||
if (r < GP_OK)
|
||||
return r;
|
||||
@@ -261,7 +261,7 @@ pdc640_transmit (GPPort *port, char *cmd, int cmd_size,
|
||||
*/
|
||||
int curr = 0, readsize = (buf_size + 63) & ~63;
|
||||
while (curr < readsize) {
|
||||
r = gp_port_read( port, buf + curr, readsize - curr);
|
||||
r = gp_port_read( port, (char*)buf + curr, readsize - curr);
|
||||
if (r < GP_OK) break;
|
||||
curr += r;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ pdc640_transmit (GPPort *port, char *cmd, int cmd_size,
|
||||
* The first byte returned is always the same as the first byte
|
||||
* of the command.
|
||||
*/
|
||||
CHECK_RESULT (gp_port_write (port, cmd, cmd_size));
|
||||
CHECK_RESULT (gp_port_write (port, (char*)cmd, cmd_size));
|
||||
r = gp_port_read (port, &c, 1);
|
||||
if ((r < 0) || (c != cmd[0]))
|
||||
continue;
|
||||
@@ -296,10 +296,10 @@ pdc640_transmit (GPPort *port, char *cmd, int cmd_size,
|
||||
|
||||
static int
|
||||
pdc640_transmit_pic (GPPort *port, char cmd, int width, int thumbnail,
|
||||
char *buf, int buf_size)
|
||||
unsigned char *buf, int buf_size)
|
||||
{
|
||||
char cmd1[] = {0x61, 0x00};
|
||||
char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x00};
|
||||
unsigned char cmd1[] = {0x61, 0x00};
|
||||
unsigned char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
/* First send the command ... */
|
||||
cmd1[1] = cmd;
|
||||
@@ -311,7 +311,7 @@ pdc640_transmit_pic (GPPort *port, char cmd, int width, int thumbnail,
|
||||
return pdc640_transmit (port, cmd2, 4, buf, buf_size);
|
||||
} else {
|
||||
int i, packet_size, result, size, ofs;
|
||||
char *data;
|
||||
unsigned char *data;
|
||||
|
||||
/* Set how many scanlines worth of data to get at once */
|
||||
cmd2[4] = 0x06;
|
||||
@@ -351,20 +351,20 @@ pdc640_transmit_pic (GPPort *port, char cmd, int width, int thumbnail,
|
||||
}
|
||||
|
||||
static int
|
||||
pdc640_transmit_packet (GPPort *port, char cmd, char *buf, int buf_size) {
|
||||
char cmd1[] = {0x61, 0x00};
|
||||
pdc640_transmit_packet (GPPort *port, char cmd, unsigned char *buf, int buf_size) {
|
||||
unsigned char cmd1[] = {0x61, 0x00};
|
||||
/* Send the command and get the packet */
|
||||
cmd1[1] = cmd;
|
||||
CHECK_RESULT (pdc640_transmit (port, cmd1, 2, NULL, 0));
|
||||
|
||||
if (port->type == GP_PORT_USB) {
|
||||
char cmd2[] = {0x15, 0x00, 0x00, 0x00};
|
||||
unsigned char cmd2[] = {0x15, 0x00, 0x00, 0x00};
|
||||
|
||||
cmd2[1] = ((buf_size+63)/64) & 0xff;
|
||||
cmd2[2] = (((buf_size+63)/64) >> 8) & 0xff;
|
||||
return pdc640_transmit (port, cmd2, 4, buf, buf_size);
|
||||
} else {
|
||||
char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x01};
|
||||
unsigned char cmd2[] = {0x15, 0x00, 0x00, 0x00, 0x01};
|
||||
|
||||
return pdc640_transmit (port, cmd2, 5, buf, buf_size);
|
||||
}
|
||||
@@ -374,7 +374,7 @@ pdc640_transmit_packet (GPPort *port, char cmd, char *buf, int buf_size) {
|
||||
static int
|
||||
pdc640_ping_low (GPPort *port)
|
||||
{
|
||||
char cmd[] = {0x01};
|
||||
unsigned char cmd[] = {0x01};
|
||||
|
||||
CHECK_RESULT (pdc640_transmit (port, cmd, 1, NULL, 0));
|
||||
|
||||
@@ -396,7 +396,7 @@ pdc640_push_button (GPPort *port)
|
||||
static int
|
||||
pdc640_ping_high (GPPort *port)
|
||||
{
|
||||
char cmd[] = {0x41};
|
||||
unsigned char cmd[] = {0x41};
|
||||
|
||||
CHECK_RESULT (pdc640_transmit (port, cmd, 1, NULL, 0));
|
||||
|
||||
@@ -406,7 +406,7 @@ pdc640_ping_high (GPPort *port)
|
||||
static int
|
||||
pdc640_speed (GPPort *port, int speed)
|
||||
{
|
||||
char cmd[] = {0x69, 0x00};
|
||||
unsigned char cmd[] = {0x69, 0x00};
|
||||
|
||||
cmd[1] = (speed / 9600) - 1;
|
||||
CHECK_RESULT (pdc640_transmit (port, cmd, 2, NULL, 0));
|
||||
@@ -435,7 +435,7 @@ pdc640_unknown5 (GPPort *port)
|
||||
static int
|
||||
pdc640_unknown20 (GPPort* port)
|
||||
{
|
||||
char buf[128];
|
||||
unsigned char buf[128];
|
||||
|
||||
CHECK_RESULT (pdc640_transmit_packet (port, 0x20, buf, 128));
|
||||
|
||||
@@ -446,7 +446,7 @@ pdc640_unknown20 (GPPort* port)
|
||||
static int
|
||||
pdc640_caminfo (GPPort *port, int *numpic)
|
||||
{
|
||||
char buf[1280];
|
||||
unsigned char buf[1280];
|
||||
|
||||
CHECK_RESULT (pdc640_transmit_packet (port, 0x40, buf, 1280));
|
||||
*numpic = buf[2]; /* thats the only useful info :( */
|
||||
@@ -456,14 +456,14 @@ pdc640_caminfo (GPPort *port, int *numpic)
|
||||
static int
|
||||
pdc640_setpic (GPPort *port, char n)
|
||||
{
|
||||
char cmd[2] = {0xf6, 0x00};
|
||||
unsigned char cmd[2] = {0xf6, 0x00};
|
||||
|
||||
cmd[1] = n;
|
||||
if (port->type == GP_PORT_USB) {
|
||||
/* USB does not like a bulkread afterwards */
|
||||
return pdc640_transmit (port, cmd, 2, NULL, 0);
|
||||
} else {
|
||||
char buf[8];
|
||||
unsigned char buf[8];
|
||||
|
||||
return pdc640_transmit (port, cmd, 2, buf, 7);
|
||||
}
|
||||
@@ -506,8 +506,8 @@ pdc640_picinfo (GPPort *port, char n,
|
||||
}
|
||||
|
||||
static int
|
||||
pdc640_processtn (int width, int height, char **data, int size) {
|
||||
char *newdata;
|
||||
pdc640_processtn (int width, int height, unsigned char **data, int size) {
|
||||
unsigned char *newdata;
|
||||
int y;
|
||||
|
||||
/* Sanity checks */
|
||||
@@ -533,7 +533,7 @@ pdc640_processtn (int width, int height, char **data, int size) {
|
||||
}
|
||||
|
||||
static int
|
||||
pdc640_getbit (char *data, int *ofs, int size, int *bit) {
|
||||
pdc640_getbit (unsigned char *data, int *ofs, int size, int *bit) {
|
||||
static char c;
|
||||
int b;
|
||||
|
||||
@@ -558,10 +558,10 @@ pdc640_getbit (char *data, int *ofs, int size, int *bit) {
|
||||
}
|
||||
|
||||
static int
|
||||
pdc640_deltadecode (int width, int height, char **rawdata, int *rawsize)
|
||||
pdc640_deltadecode (int width, int height, unsigned char **rawdata, int *rawsize)
|
||||
{
|
||||
char col1, col2;
|
||||
char *data;
|
||||
unsigned char *data;
|
||||
int rawofs, x, y, ofs, bit, ones;
|
||||
int size;
|
||||
int e, d, o, val;
|
||||
@@ -636,14 +636,14 @@ pdc640_deltadecode (int width, int height, char **rawdata, int *rawsize)
|
||||
|
||||
static int
|
||||
pdc640_getpic (Camera *camera, int n, int thumbnail, int justraw,
|
||||
char **data, int *size)
|
||||
unsigned char **data, int *size)
|
||||
{
|
||||
char cmd, ppmheader[100];
|
||||
int size_pic, width_pic, height_pic;
|
||||
int size_thumb, width_thumb, height_thumb;
|
||||
int height, width, outsize, result, pmmhdr_len;
|
||||
int compression_type;
|
||||
char *outdata;
|
||||
unsigned char *outdata;
|
||||
|
||||
/* Get the size of the picture */
|
||||
CHECK_RESULT (pdc640_picinfo (camera->port, n,
|
||||
@@ -755,7 +755,7 @@ pdc640_getpic (Camera *camera, int n, int thumbnail, int justraw,
|
||||
static int
|
||||
pdc640_delpic (GPPort *port)
|
||||
{
|
||||
char cmd[2] = {0x59, 0x01};
|
||||
unsigned char cmd[2] = {0x59, 0x01};
|
||||
|
||||
CHECK_RESULT (pdc640_transmit (port, cmd, 2, NULL, 0));
|
||||
|
||||
@@ -765,7 +765,7 @@ pdc640_delpic (GPPort *port)
|
||||
static int
|
||||
pdc640_takepic (GPPort *port)
|
||||
{
|
||||
char cmd[2] = {0x2D, 0x00};
|
||||
unsigned char cmd[2] = {0x2D, 0x00};
|
||||
|
||||
CHECK_RESULT (pdc640_transmit (port, cmd, 2, NULL, 0));
|
||||
|
||||
@@ -817,7 +817,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
int n, size;
|
||||
char *data, *p;
|
||||
unsigned char *data;
|
||||
|
||||
/*
|
||||
* Get the number of the picture from the filesystem and increment
|
||||
@@ -827,8 +827,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
context));
|
||||
n++;
|
||||
|
||||
CHECK_RESULT (gp_file_set_name (file, filename));
|
||||
|
||||
/* Get the picture */
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
@@ -838,18 +836,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
case GP_FILE_TYPE_RAW:
|
||||
CHECK_RESULT (pdc640_getpic (camera, n, 0, 1, &data, &size));
|
||||
CHECK_RESULT (gp_file_set_mime_type (file, GP_MIME_RAW));
|
||||
|
||||
/* Change extension to raw */
|
||||
n = strlen(filename);
|
||||
p = malloc (n + 1);
|
||||
if (p) {
|
||||
strcpy (p, filename);
|
||||
p[n-3] = 'r';
|
||||
p[n-2] = 'a';
|
||||
p[n-1] = 'w';
|
||||
CHECK_RESULT (gp_file_set_name (file, p));
|
||||
free (p);
|
||||
}
|
||||
break;
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
CHECK_RESULT (pdc640_getpic (camera, n, 1, 0, &data, &size));
|
||||
@@ -859,7 +845,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
CHECK_RESULT (gp_file_set_data_and_size (file, data, size));
|
||||
CHECK_RESULT (gp_file_set_data_and_size (file, (char*)data, size));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -869,7 +855,7 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
char cmd[2] = {0x59, 0x00};
|
||||
unsigned char cmd[2] = {0x59, 0x00};
|
||||
|
||||
CHECK_RESULT (pdc640_transmit (camera->port, cmd, 2, NULL, 0));
|
||||
|
||||
|
||||
@@ -1539,9 +1539,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
}
|
||||
gp_file_set_data_and_size ( file, (char*)data, size );
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG); /* always */
|
||||
/* Add an arbitrary file name so caller won't crash */
|
||||
gp_file_set_name (file, "canon_preview.jpg");
|
||||
|
||||
#if 0
|
||||
/* Leave out, otherwise we refocus all the time */
|
||||
ret = ptp_canon_viewfinderoff (params);
|
||||
@@ -1588,8 +1585,6 @@ add_objectid_and_upload (Camera *camera, CameraFilePath *path, GPContext *contex
|
||||
|
||||
ret = gp_file_new(&file);
|
||||
if (ret!=GP_OK) return ret;
|
||||
gp_file_set_type (file, GP_FILE_TYPE_NORMAL);
|
||||
gp_file_set_name(file, path->name);
|
||||
set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ObjectFormat);
|
||||
CPR (context, ptp_getobject(params, newobject, &ximage));
|
||||
|
||||
@@ -1606,7 +1601,7 @@ add_objectid_and_upload (Camera *camera, CameraFilePath *path, GPContext *contex
|
||||
return ret;
|
||||
}
|
||||
gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "adding filedata to fs");
|
||||
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context);
|
||||
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context);
|
||||
if (ret != GP_OK) {
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
@@ -1821,8 +1816,6 @@ camera_canon_eos_capture (Camera *camera, CameraCaptureType type, CameraFilePath
|
||||
|
||||
ret = gp_file_new(&file);
|
||||
if (ret!=GP_OK) return ret;
|
||||
gp_file_set_type (file, GP_FILE_TYPE_NORMAL);
|
||||
gp_file_set_name(file, path->name);
|
||||
|
||||
gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_capture", "trying to get object size=0x%x", oi.ObjectCompressedSize);
|
||||
CPR (context, ptp_canon_eos_getpartialobject (params, newobject, 0, oi.ObjectCompressedSize, &ximage));
|
||||
@@ -1837,7 +1830,7 @@ camera_canon_eos_capture (Camera *camera, CameraCaptureType type, CameraFilePath
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
}
|
||||
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context);
|
||||
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context);
|
||||
if (ret != GP_OK) {
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
@@ -2212,7 +2205,6 @@ camera_wait_for_event (Camera *camera, int timeout,
|
||||
strcpy (path->folder,"/");
|
||||
ret = gp_file_new(&file);
|
||||
if (ret!=GP_OK) return ret;
|
||||
gp_file_set_type (file, GP_FILE_TYPE_NORMAL);
|
||||
sprintf (path->name, "capt%04d.", capcnt++);
|
||||
if (entries[i].u.object.oi.ObjectFormat == PTP_OFC_CANON_CRW) {
|
||||
strcat(path->name, "cr2");
|
||||
@@ -2221,7 +2213,6 @@ camera_wait_for_event (Camera *camera, int timeout,
|
||||
strcat(path->name, "jpg");
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
}
|
||||
gp_file_set_name(file, path->name);
|
||||
|
||||
gp_log (GP_LOG_DEBUG, "ptp2/canon_eos_capture", "trying to get object size=0x%x", entries[i].u.object.oi.ObjectCompressedSize);
|
||||
CPR (context, ptp_canon_eos_getpartialobject (params, newobject, 0, entries[i].u.object.oi.ObjectCompressedSize, &ximage));
|
||||
@@ -2236,7 +2227,7 @@ camera_wait_for_event (Camera *camera, int timeout,
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
}
|
||||
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, file, context);
|
||||
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context);
|
||||
if (ret != GP_OK) {
|
||||
gp_file_free (file);
|
||||
return ret;
|
||||
@@ -3743,7 +3734,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
PTPObjectInfo oi;
|
||||
@@ -3752,13 +3743,11 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
uint32_t handle;
|
||||
unsigned long intsize;
|
||||
PTPParams* params=&camera->pl->params;
|
||||
CameraFileType type;
|
||||
|
||||
SET_CONTEXT_P(params, context);
|
||||
|
||||
init_ptp_fs (camera, context);
|
||||
|
||||
gp_file_get_type (file, &type);
|
||||
gp_log ( GP_LOG_DEBUG, "ptp2/put_file_func", "folder=%s, filename=%s", folder, filename);
|
||||
|
||||
if (!strcmp (folder, "/special")) {
|
||||
@@ -3798,6 +3787,8 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_context_error (context, _("Metadata only supported for MTP devices."));
|
||||
return GP_ERROR;
|
||||
}
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
/* compute storage ID value from folder patch */
|
||||
folder_to_storage(folder,storage);
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
gp_file_set_data_and_size (file, data, size);
|
||||
gp_file_set_data_and_size (file, (char*)data, size);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -278,12 +278,14 @@ camera_capture (Camera *camera, CameraCaptureType type,
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *user_data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *user_data, GPContext *context)
|
||||
{
|
||||
const char *data;
|
||||
unsigned long int size;
|
||||
Camera *camera = user_data;
|
||||
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
CR (gp_file_get_data_and_size (file, &data, &size));
|
||||
return ricoh_put_file (camera, context, name, data, size);
|
||||
}
|
||||
|
||||
@@ -728,7 +728,8 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
}
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem * fs, const char *folder, const char *filename, CameraFile * file, void *data, GPContext *context)
|
||||
put_file_func (CameraFilesystem * fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile * file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
char *picture_folder;
|
||||
@@ -740,6 +741,9 @@ put_file_func (CameraFilesystem * fs, const char *folder, const char *filename,
|
||||
GP_DEBUG ("*** put_file_func");
|
||||
GP_DEBUG ("*** folder: %s", folder);
|
||||
GP_DEBUG ("*** filename: %s", filename);
|
||||
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
|
||||
/* Check the size */
|
||||
CHECK (gp_file_get_data_and_size (file, &data_file, &data_size));
|
||||
|
||||
@@ -782,7 +782,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_file_append(file, xdata, picsize);
|
||||
free(xdata);
|
||||
gp_file_set_mime_type (file, GP_MIME_UNKNOWN);
|
||||
gp_file_set_name (file, filename);
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
free(addrs);
|
||||
return image_no;
|
||||
}
|
||||
gp_file_set_name (file, filename);
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
#ifdef HAVE_LIBJPEG
|
||||
|
||||
@@ -555,8 +555,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
fprintf(stderr,"\n");
|
||||
*/
|
||||
|
||||
gp_file_set_mime_type (file, "image/jpeg");
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
|
||||
@@ -111,8 +111,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (image_no < GP_OK)
|
||||
return image_no;
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
result = ultrapocket_getpicture(camera,context,&data,&size,filename);
|
||||
|
||||
@@ -202,7 +202,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
unsigned int CAM_OFFSET;
|
||||
unsigned char POST_CODE;
|
||||
unsigned char compressed=0;
|
||||
char name[16];
|
||||
int ret = 0;
|
||||
|
||||
GP_DEBUG ("Downloading pictures!\n");
|
||||
@@ -295,7 +294,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
GP_DEBUG("CAM_OFFSET=%i\n",CAM_OFFSET);
|
||||
frame_size = w*h;
|
||||
gp_file_set_mime_type (file, GP_MIME_AVI);
|
||||
gp_file_set_name (file, name);
|
||||
frame_data = malloc(frame_size);
|
||||
if (!frame_data) {
|
||||
free (frame_data);
|
||||
@@ -435,13 +433,11 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
white_balance(ptr, w * h, 1.2);
|
||||
GP_DEBUG("white_balance run on photo number %03d \n", k+1);
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
free (data);
|
||||
return GP_OK;
|
||||
case GP_FILE_TYPE_RAW:
|
||||
gp_file_set_mime_type(file, GP_MIME_RAW);
|
||||
gp_file_set_name(file, filename);
|
||||
gp_file_append( file, (char *)data, rawsize);
|
||||
free(data);
|
||||
GP_DEBUG("rawsize= 0x%x = %i\n", rawsize, rawsize);
|
||||
|
||||
@@ -499,8 +499,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if(!F1ok(camera->port))
|
||||
return (GP_ERROR);
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, "image/jpeg");
|
||||
gp_file_set_mime_type (file, GP_MIME_JPEG);
|
||||
|
||||
/* Retrieve the number of the photo on the camera */
|
||||
num = gp_filesystem_number(camera->fs, "/", filename, context);
|
||||
|
||||
@@ -223,12 +223,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
default:
|
||||
rc = GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
if (rc == GP_OK) {
|
||||
gp_file_set_name (file, filename);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -722,7 +722,6 @@ sony_file_get(Camera * camera, int imageid, int file_type,
|
||||
* overwrites it with the correct one.
|
||||
*/
|
||||
sprintf(buffer, SONY_FILE_NAME_FMT, imageid);
|
||||
gp_file_set_name (file, buffer);
|
||||
|
||||
sony_baud_set(camera, baud_rate);
|
||||
|
||||
|
||||
@@ -285,7 +285,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
gp_file_set_data_and_size (file, data, size);
|
||||
/* Maybe skip below if EXIF data present? */
|
||||
gp_file_set_name (file, filename);
|
||||
|
||||
/* As far as I know we only support JPG and MOV */
|
||||
/* Maybe some have MP3??? */
|
||||
@@ -387,7 +386,7 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
|
||||
static int put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFile *file, void *data, GPContext *context) {
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context) {
|
||||
|
||||
Camera *camera=data;
|
||||
const char *data_file;
|
||||
|
||||
@@ -406,14 +406,9 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
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;
|
||||
return gp_file_set_data_and_size (file, data, size);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -381,7 +381,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_gamma_correct_single (gtable, ptr, w * h);
|
||||
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
|
||||
} else { /* type is GP_FILE_TYPE_RAW */
|
||||
@@ -391,7 +390,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
memcpy (rawdata, frame_data, size);
|
||||
memcpy (rawdata+size,camera->pl->catalog+16*entry,16);
|
||||
gp_file_set_mime_type (file, GP_MIME_RAW);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)rawdata, size+16);
|
||||
}
|
||||
/* Reset camera when done, for more graceful exit. */
|
||||
@@ -422,7 +420,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
unsigned char *frame_data;
|
||||
unsigned char *ppm, *ptr;
|
||||
unsigned char gtable[256];
|
||||
char filename[12] = "sq_cap.ppm";
|
||||
int size;
|
||||
int w = 320;
|
||||
int h = 240;
|
||||
@@ -468,7 +465,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
gp_gamma_fill_table (gtable, .5);
|
||||
gp_gamma_correct_single (gtable, ptr, w * h);
|
||||
gp_file_set_mime_type (file, GP_MIME_PPM);
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_data_and_size (file, (char *)ppm, size);
|
||||
|
||||
sq_reset(camera->port);
|
||||
|
||||
@@ -197,7 +197,6 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if(image_no < 0)
|
||||
return image_no;
|
||||
|
||||
gp_file_set_name (file, filename);
|
||||
gp_file_set_mime_type (file, GP_MIME_PNM);
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
@@ -253,10 +252,8 @@ static int camera_capture_preview (Camera *camera, CameraFile *file, GPContext *
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
gp_file_set_name (file, "capture.pnm");
|
||||
gp_file_set_mime_type (file, GP_MIME_PNM);
|
||||
gp_file_set_data_and_size (file, data, size);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,10 +269,10 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
*/
|
||||
int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *data, GPContext *context);
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context);
|
||||
int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
/*Camera *camera = data;*/
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ dnl NOTE: Be version style _higher_ than the last release.
|
||||
dnl So lastversion.X.trunk for instance. Bump X if necessary.
|
||||
|
||||
dnl ******* THE NEXT RELEASE VERSION MUST BE 2.5.0 at least or higher!
|
||||
AC_INIT([libgphoto2 photo camera library], [2.4.99.1], [gphoto-devel@lists.sourceforge.net], [libgphoto2])
|
||||
AC_INIT([libgphoto2 photo camera library], [2.4.99.2], [gphoto-devel@lists.sourceforge.net], [libgphoto2])
|
||||
AC_CONFIG_SRCDIR([libgphoto2/gphoto2-version.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([auto-m4])
|
||||
|
||||
@@ -289,10 +289,12 @@ int gp_camera_get_port_speed (Camera *camera);
|
||||
/** \name Initialization
|
||||
* @{
|
||||
*/
|
||||
int gp_camera_autodetect (CameraList *list, GPContext *context);
|
||||
int gp_camera_init (Camera *camera, GPContext *context);
|
||||
int gp_camera_exit (Camera *camera, GPContext *context);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
|
||||
/** \name Operations on cameras
|
||||
@@ -337,6 +339,7 @@ int gp_camera_folder_delete_all (Camera *camera, const char *folder,
|
||||
GPContext *context);
|
||||
int gp_camera_folder_put_file (Camera *camera,
|
||||
const char *folder, const char *filename,
|
||||
CameraFileType type,
|
||||
CameraFile *file, GPContext *context);
|
||||
int gp_camera_folder_make_dir (Camera *camera, const char *folder,
|
||||
const char *name, GPContext *context);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* \brief Abstracted gphoto2 file operations.
|
||||
*
|
||||
* \author Copyright 2000 Scott Fritzinger
|
||||
* \author Copyright 2008-2009 Marcus Meissner
|
||||
*
|
||||
* \note
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -132,14 +133,12 @@ int gp_file_get_name (CameraFile *file, const char **name);
|
||||
int gp_file_set_mime_type (CameraFile *file, const char *mime_type);
|
||||
int gp_file_get_mime_type (CameraFile *file, const char **mime_type);
|
||||
|
||||
int gp_file_set_type (CameraFile *file, CameraFileType type);
|
||||
int gp_file_get_type (CameraFile *file, CameraFileType *type);
|
||||
|
||||
int gp_file_set_mtime (CameraFile *file, time_t mtime);
|
||||
int gp_file_get_mtime (CameraFile *file, time_t *mtime);
|
||||
|
||||
int gp_file_detect_mime_type (CameraFile *file);
|
||||
int gp_file_adjust_name_for_mime_type (CameraFile *file);
|
||||
int gp_file_get_name_by_type (CameraFile *file, const char *basename, CameraFileType type, char **newname);
|
||||
|
||||
int gp_file_append (CameraFile*, const char *data,
|
||||
unsigned long int size);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* \brief Filesystem related operations and declarations.
|
||||
*
|
||||
* \author Copyright 2000 Scott Fritzinger
|
||||
* \author Copyright 2008-2009 Marcus Meissner
|
||||
*
|
||||
* \note
|
||||
* Contributions:
|
||||
@@ -243,6 +244,7 @@ int gp_filesystem_set_info_noop (CameraFilesystem *fs,
|
||||
CameraFileInfo info, GPContext *context);
|
||||
int gp_filesystem_set_file_noop (CameraFilesystem *fs,
|
||||
const char *folder, const char *filename,
|
||||
CameraFileType type,
|
||||
CameraFile *file, GPContext *context);
|
||||
int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, GPContext *context);
|
||||
@@ -319,7 +321,9 @@ int gp_filesystem_delete_file (CameraFilesystem *fs, const char *folder,
|
||||
typedef int (*CameraFilesystemPutFileFunc) (CameraFilesystem *fs,
|
||||
const char *folder,
|
||||
const char *filename,
|
||||
CameraFile *file, void *data,
|
||||
CameraFileType type,
|
||||
CameraFile *file,
|
||||
void *data,
|
||||
GPContext *context);
|
||||
typedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs,
|
||||
const char *folder, void *data,
|
||||
@@ -357,7 +361,6 @@ struct _CameraFilesystemFuncs {
|
||||
CameraFilesystemDirFunc remove_dir_func;
|
||||
CameraFilesystemGetFileFunc get_file_func;
|
||||
CameraFilesystemDeleteFileFunc del_file_func;
|
||||
|
||||
CameraFilesystemStorageInfoFunc storage_info_func;
|
||||
|
||||
/* for later use. Remove one if you add a new function */
|
||||
@@ -367,7 +370,7 @@ int gp_filesystem_set_funcs (CameraFilesystem *fs,
|
||||
CameraFilesystemFuncs *funcs,
|
||||
void *data);
|
||||
int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFile *file, GPContext *context);
|
||||
CameraFileType type, CameraFile *file, GPContext *context);
|
||||
int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder,
|
||||
GPContext *context);
|
||||
int gp_filesystem_make_dir (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
@@ -625,6 +625,69 @@ gp_camera_free (Camera *camera)
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Autodetect all detectable camera
|
||||
*
|
||||
* @param list a #CameraList that receives the autodetected cameras
|
||||
* @param context a #GPContext
|
||||
* @return a gphoto2 error code
|
||||
*
|
||||
* This camera will autodetected all cameras that can be autodetected.
|
||||
* This will for instance detect all USB cameras.
|
||||
*
|
||||
* CameraList *list;
|
||||
* gp_list_new (&list);
|
||||
* gp_camera_autodetect (list, context);
|
||||
* ... done! ...
|
||||
*/
|
||||
int
|
||||
gp_camera_autodetect (CameraList *list, GPContext *context)
|
||||
{
|
||||
CameraAbilitiesList *al;
|
||||
GPPortInfoList *il;
|
||||
int ret, i;
|
||||
CameraList *xlist = NULL;
|
||||
|
||||
ret = gp_list_new (&xlist);
|
||||
if (ret < GP_OK) goto out;
|
||||
if (!il) {
|
||||
/* Load all the port drivers we have... */
|
||||
ret = gp_port_info_list_new (&il);
|
||||
if (ret < GP_OK) goto out;
|
||||
ret = gp_port_info_list_load (il);
|
||||
if (ret < 0) goto out;
|
||||
ret = gp_port_info_list_count (il);
|
||||
if (ret < 0) goto out;
|
||||
}
|
||||
/* Load all the camera drivers we have... */
|
||||
ret = gp_abilities_list_new (&al);
|
||||
if (ret < GP_OK) goto out;
|
||||
ret = gp_abilities_list_load (al, context);
|
||||
if (ret < GP_OK) goto out;
|
||||
|
||||
/* ... and autodetect the currently attached cameras. */
|
||||
ret = gp_abilities_list_detect (al, il, xlist, context);
|
||||
if (ret < GP_OK) goto out;
|
||||
|
||||
/* Filter out the "usb:" entry */
|
||||
ret = gp_list_count (xlist);
|
||||
if (ret < GP_OK) goto out;
|
||||
for (i=0;i<ret;i++) {
|
||||
const char *name, *value;
|
||||
|
||||
gp_list_get_name (xlist, i, &name);
|
||||
gp_list_get_value (xlist, i, &value);
|
||||
if (!strcmp ("usb:",value)) continue;
|
||||
gp_list_append (list, name, value);
|
||||
}
|
||||
out:
|
||||
if (il) gp_port_info_list_free (il);
|
||||
if (al) gp_abilities_list_free (al);
|
||||
gp_list_free (xlist);
|
||||
if (ret < GP_OK)
|
||||
return ret;
|
||||
return gp_list_count(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a connection to the \c camera.
|
||||
@@ -991,6 +1054,7 @@ gp_camera_capture (Camera *camera, CameraCaptureType type,
|
||||
int
|
||||
gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
{
|
||||
char *xname;
|
||||
CHECK_NULL (camera && file);
|
||||
CHECK_INIT (camera, context);
|
||||
|
||||
@@ -1005,6 +1069,10 @@ gp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
|
||||
CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->capture_preview (
|
||||
camera, file, context), context);
|
||||
gp_file_get_name_by_type (file, "capture_preview", GP_FILE_TYPE_NORMAL, &xname);
|
||||
/* FIXME: Marcus ... will go away, just keep compatible now. */
|
||||
gp_file_set_name (file, xname);
|
||||
free (xname);
|
||||
|
||||
CAMERA_UNUSED (camera, context);
|
||||
return (GP_OK);
|
||||
@@ -1147,6 +1215,7 @@ gp_camera_folder_delete_all (Camera *camera, const char *folder,
|
||||
int
|
||||
gp_camera_folder_put_file (Camera *camera,
|
||||
const char *folder, const char *filename,
|
||||
CameraFileType type,
|
||||
CameraFile *file, GPContext *context)
|
||||
{
|
||||
gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Uploading file into '%s'...",
|
||||
@@ -1156,7 +1225,7 @@ gp_camera_folder_put_file (Camera *camera,
|
||||
CHECK_INIT (camera, context);
|
||||
|
||||
CHECK_RESULT_OPEN_CLOSE (camera, gp_filesystem_put_file (camera->fs,
|
||||
folder, filename, file, context), context);
|
||||
folder, filename, type, file, context), context);
|
||||
|
||||
CAMERA_UNUSED (camera, context);
|
||||
return (GP_OK);
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
* \internal
|
||||
*/
|
||||
struct _CameraFile {
|
||||
CameraFileType type;
|
||||
char mime_type [64];
|
||||
char name [MAX_PATH];
|
||||
int ref_count;
|
||||
@@ -89,7 +88,6 @@ gp_file_new (CameraFile **file)
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
memset (*file, 0, sizeof (CameraFile));
|
||||
|
||||
(*file)->type = GP_FILE_TYPE_NORMAL;
|
||||
strcpy ((*file)->mime_type, "unknown/unknown");
|
||||
(*file)->ref_count = 1;
|
||||
(*file)->accesstype = GP_FILE_ACCESSTYPE_MEMORY;
|
||||
@@ -113,7 +111,6 @@ gp_file_new_from_fd (CameraFile **file, int fd)
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
memset (*file, 0, sizeof (CameraFile));
|
||||
|
||||
(*file)->type = GP_FILE_TYPE_NORMAL;
|
||||
strcpy ((*file)->mime_type, "unknown/unknown");
|
||||
(*file)->ref_count = 1;
|
||||
(*file)->accesstype = GP_FILE_ACCESSTYPE_FD;
|
||||
@@ -504,6 +501,29 @@ gp_file_save (CameraFile *file, const char *filename)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* mime types that cannot be determined by the filename
|
||||
* extension. Better hack would be to use library that examine
|
||||
* file content instead, like gnome-vfs mime handling, or
|
||||
* gnome-mime, whatever.
|
||||
* See also the GP_MIME_* definitions.
|
||||
*/
|
||||
static const char *mime_table[] = {
|
||||
"bmp", GP_MIME_BMP,
|
||||
"jpg", GP_MIME_JPEG,
|
||||
"tif", GP_MIME_TIFF,
|
||||
"ppm", GP_MIME_PPM,
|
||||
"pgm", GP_MIME_PGM,
|
||||
"pnm", GP_MIME_PNM,
|
||||
"png", GP_MIME_PNG,
|
||||
"wav", GP_MIME_WAV,
|
||||
"avi", GP_MIME_AVI,
|
||||
"mp3", GP_MIME_MP3,
|
||||
"wma", GP_MIME_WMA,
|
||||
"asf", GP_MIME_ASF,
|
||||
"ogg", GP_MIME_OGG,
|
||||
"mpg", GP_MIME_MPEG,
|
||||
NULL};
|
||||
/**
|
||||
* @param file a #CameraFile
|
||||
* @param filename
|
||||
@@ -519,29 +539,6 @@ gp_file_open (CameraFile *file, const char *filename)
|
||||
int i;
|
||||
struct stat s;
|
||||
|
||||
/*
|
||||
* mime types that cannot be determined by the filename
|
||||
* extension. Better hack would be to use library that examine
|
||||
* file content instead, like gnome-vfs mime handling, or
|
||||
* gnome-mime, whatever.
|
||||
* See also the GP_MIME_* definitions.
|
||||
*/
|
||||
static char *mime_table[] = {
|
||||
"bmp", GP_MIME_BMP,
|
||||
"jpg", GP_MIME_JPEG,
|
||||
"tif", GP_MIME_TIFF,
|
||||
"ppm", GP_MIME_PPM,
|
||||
"pgm", GP_MIME_PGM,
|
||||
"pnm", GP_MIME_PNM,
|
||||
"png", GP_MIME_PNG,
|
||||
"wav", GP_MIME_WAV,
|
||||
"avi", GP_MIME_AVI,
|
||||
"mp3", GP_MIME_MP3,
|
||||
"wma", GP_MIME_WMA,
|
||||
"asf", GP_MIME_ASF,
|
||||
"ogg", GP_MIME_OGG,
|
||||
"mpg", GP_MIME_MPEG,
|
||||
NULL};
|
||||
|
||||
CHECK_NULL (file && filename);
|
||||
|
||||
@@ -669,7 +666,6 @@ gp_file_copy (CameraFile *destination, CameraFile *source)
|
||||
/* struct members we can just copy. All generic ones, but not refcount. */
|
||||
memcpy (destination->name, source->name, sizeof (source->name));
|
||||
memcpy (destination->mime_type, source->mime_type, sizeof (source->mime_type));
|
||||
destination->type = source->type;
|
||||
destination->mtime = source->mtime;
|
||||
|
||||
if ((destination->accesstype == GP_FILE_ACCESSTYPE_MEMORY) &&
|
||||
@@ -800,6 +796,73 @@ gp_file_get_name (CameraFile *file, const char **name)
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param file a #CameraFile
|
||||
* @param basename the basename of the file
|
||||
* @param type the gphoto type of the file
|
||||
* @param newname the new name generated
|
||||
* @return a gphoto2 error code.
|
||||
*
|
||||
* This function takes the basename and generates a filename out of
|
||||
* it depending on the gphoto filetype and the mime type in the file.
|
||||
* The gphoto filetype will be converted to a prefix, like
|
||||
* thumb_ or raw_, the mimetype will replace the current suffix by
|
||||
* a different one (if necessary).
|
||||
*
|
||||
* This can be used so that saving thumbnails or metadata will not
|
||||
* overwrite the normal files.
|
||||
**/
|
||||
int
|
||||
gp_file_get_name_by_type (CameraFile *file, const char *basename, CameraFileType type, char **newname)
|
||||
{
|
||||
char *prefix = NULL, *s, *new;
|
||||
const char *suffix = NULL;
|
||||
int i;
|
||||
|
||||
CHECK_NULL (file && basename && newname);
|
||||
*newname = NULL;
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL: prefix = ""; break;
|
||||
case GP_FILE_TYPE_RAW: prefix = "raw_";break;
|
||||
case GP_FILE_TYPE_EXIF: prefix = "exif_";break;
|
||||
case GP_FILE_TYPE_PREVIEW: prefix = "thumb_";break;
|
||||
case GP_FILE_TYPE_METADATA: prefix = "meta_";break;
|
||||
case GP_FILE_TYPE_AUDIO: prefix = "audio_";break;
|
||||
default: prefix = ""; break;
|
||||
}
|
||||
for (i=0;mime_table[i];i+=2) {
|
||||
if (!strcmp (mime_table[i+1],file->mime_type)) {
|
||||
suffix = mime_table[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
s = strrchr(basename,'.');
|
||||
if (s) {
|
||||
if (!suffix)
|
||||
suffix = s+1;
|
||||
new = malloc (strlen(prefix) + (s-basename+1) + strlen (suffix) + 1);
|
||||
if (!new)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
strcpy (new, prefix);
|
||||
memcpy (new+strlen(new), basename, s-basename+1);
|
||||
strcat(new+strlen(new)+(s-basename+1),suffix);
|
||||
} else { /* no dot in basename? */
|
||||
if (!suffix) suffix = "";
|
||||
new = malloc (strlen(prefix) + strlen(basename) + 1 + strlen (suffix) + 1);
|
||||
if (!new)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
strcpy (new, prefix);
|
||||
strcat (new, basename);
|
||||
if (strlen(suffix)) {
|
||||
strcat (new, ".");
|
||||
strcat (new, suffix);
|
||||
}
|
||||
}
|
||||
*newname = new;
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param file a #CameraFile
|
||||
@@ -954,40 +1017,6 @@ gp_file_adjust_name_for_mime_type (CameraFile *file)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param file a #CameraFile
|
||||
* @param type a #CameraFileType
|
||||
* @return a gphoto2 error code.
|
||||
*
|
||||
**/
|
||||
int
|
||||
gp_file_set_type (CameraFile *file, CameraFileType type)
|
||||
{
|
||||
CHECK_NULL (file);
|
||||
|
||||
file->type = type;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param file a #CameraFile
|
||||
* @param type a #CameraFileType
|
||||
* @return a gphoto2 error code.
|
||||
*
|
||||
**/
|
||||
int
|
||||
gp_file_get_type (CameraFile *file, CameraFileType *type)
|
||||
{
|
||||
CHECK_NULL (file && type);
|
||||
|
||||
*type = file->type;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param file a #CameraFile
|
||||
* @param mtime
|
||||
|
||||
@@ -1228,6 +1228,7 @@ gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder,
|
||||
int
|
||||
gp_filesystem_put_file (CameraFilesystem *fs,
|
||||
const char *folder, const char *filename,
|
||||
CameraFileType type,
|
||||
CameraFile *file, GPContext *context)
|
||||
{
|
||||
CameraFilesystemFolder *f;
|
||||
@@ -1248,7 +1249,7 @@ gp_filesystem_put_file (CameraFilesystem *fs,
|
||||
if (!f) return (GP_ERROR_DIRECTORY_NOT_FOUND);
|
||||
|
||||
/* Upload the file */
|
||||
CR (fs->put_file_func (fs, folder, filename, file, fs->folder_data, context));
|
||||
CR (fs->put_file_func (fs, folder, filename, type, file, fs->folder_data, context));
|
||||
/* And upload it to internal structure too */
|
||||
return append_file (fs, f, filename, file, context);
|
||||
}
|
||||
@@ -1578,7 +1579,6 @@ gp_filesystem_get_file_impl (CameraFilesystem *fs, const char *folder,
|
||||
GP_DEBUG ("Getting file '%s' from folder '%s' (type %i)...",
|
||||
filename, folder, type);
|
||||
|
||||
CR (gp_file_set_type (file, type));
|
||||
CR (gp_file_set_name (file, filename));
|
||||
|
||||
if (!fs->get_file_func) {
|
||||
@@ -1626,11 +1626,10 @@ gp_filesystem_get_file_impl (CameraFilesystem *fs, const char *folder,
|
||||
fs->file_data, context));
|
||||
|
||||
/* We don't trust the camera drivers */
|
||||
CR (gp_file_set_type (file, type));
|
||||
CR (gp_file_set_name (file, filename));
|
||||
|
||||
/* Cache this file */
|
||||
CR (gp_filesystem_set_file_noop (fs, folder, filename, file, context));
|
||||
CR (gp_filesystem_set_file_noop (fs, folder, filename, type, file, context));
|
||||
|
||||
/*
|
||||
* Often, thumbnails are of a different mime type than the normal
|
||||
@@ -1715,10 +1714,9 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder,
|
||||
ed->data = NULL;
|
||||
ed->size = 0;
|
||||
exif_data_unref (ed);
|
||||
CR (gp_file_set_type (file, GP_FILE_TYPE_PREVIEW));
|
||||
CR (gp_file_set_name (file, filename));
|
||||
CR (gp_file_set_mime_type (file, GP_MIME_JPEG));
|
||||
CR (gp_filesystem_set_file_noop (fs, folder, filename, file, context));
|
||||
CR (gp_filesystem_set_file_noop (fs, folder, filename, GP_FILE_TYPE_PREVIEW, file, context));
|
||||
CR (gp_file_adjust_name_for_mime_type (file));
|
||||
#else
|
||||
GP_DEBUG ("Getting previews is not supported and "
|
||||
@@ -1754,10 +1752,9 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder,
|
||||
free (buf);
|
||||
return (r);
|
||||
}
|
||||
CR (gp_file_set_type (file, GP_FILE_TYPE_EXIF));
|
||||
CR (gp_file_set_name (file, filename));
|
||||
CR (gp_file_set_mime_type (file, GP_MIME_EXIF));
|
||||
CR (gp_filesystem_set_file_noop (fs, folder, filename, file, context));
|
||||
CR (gp_filesystem_set_file_noop (fs, folder, filename, GP_FILE_TYPE_EXIF, file, context));
|
||||
CR (gp_file_adjust_name_for_mime_type (file));
|
||||
#else
|
||||
GP_DEBUG ("Getting EXIF data is not supported and libgphoto2 "
|
||||
@@ -2040,11 +2037,11 @@ gp_filesystem_lru_count (CameraFilesystem *fs)
|
||||
static int
|
||||
gp_filesystem_lru_update (CameraFilesystem *fs,
|
||||
const char *folder, const char *filename,
|
||||
CameraFileType type,
|
||||
CameraFile *file, GPContext *context)
|
||||
{
|
||||
CameraFilesystemFolder *f;
|
||||
CameraFilesystemFile *xfile;
|
||||
CameraFileType type;
|
||||
CameraFile *oldfile = NULL;
|
||||
unsigned long int size;
|
||||
int x;
|
||||
@@ -2052,7 +2049,6 @@ gp_filesystem_lru_update (CameraFilesystem *fs,
|
||||
|
||||
CHECK_NULL (fs && folder && file);
|
||||
|
||||
CR (gp_file_get_type (file, &type));
|
||||
CR (gp_file_get_data_and_size (file, NULL, &size));
|
||||
|
||||
/*
|
||||
@@ -2199,9 +2195,9 @@ gp_filesystem_lru_check (CameraFilesystem *fs)
|
||||
int
|
||||
gp_filesystem_set_file_noop (CameraFilesystem *fs,
|
||||
const char *folder, const char *filename,
|
||||
CameraFileType type,
|
||||
CameraFile *file, GPContext *context)
|
||||
{
|
||||
CameraFileType type;
|
||||
CameraFileInfo info;
|
||||
CameraFilesystemFolder *f;
|
||||
CameraFilesystemFile *xfile;
|
||||
@@ -2212,7 +2208,6 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs,
|
||||
CC (context);
|
||||
CA (folder, context);
|
||||
|
||||
CR (gp_file_get_type (file, &type));
|
||||
GP_DEBUG ("Adding file '%s' to folder '%s' (type %i)...",
|
||||
filename, folder, type);
|
||||
|
||||
@@ -2227,7 +2222,7 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs,
|
||||
*/
|
||||
if ((type == GP_FILE_TYPE_RAW) || (type == GP_FILE_TYPE_NORMAL) ||
|
||||
(type == GP_FILE_TYPE_AUDIO))
|
||||
CR (gp_filesystem_lru_update (fs, folder, filename, file, context));
|
||||
CR (gp_filesystem_lru_update (fs, folder, filename, type, file, context));
|
||||
|
||||
/* Redundant sanity check. */
|
||||
CR (gp_filesystem_lru_check (fs));
|
||||
|
||||
@@ -12,6 +12,7 @@ gp_ahd_interpolate
|
||||
gp_bayer_decode
|
||||
gp_bayer_expand
|
||||
gp_bayer_interpolate
|
||||
gp_camera_autodetect
|
||||
gp_camera_capture
|
||||
gp_camera_capture_preview
|
||||
gp_camera_exit
|
||||
@@ -76,7 +77,7 @@ gp_file_get_data_and_size
|
||||
gp_file_get_mime_type
|
||||
gp_file_get_mtime
|
||||
gp_file_get_name
|
||||
gp_file_get_type
|
||||
gp_file_get_name_by_type
|
||||
gp_file_new
|
||||
gp_file_new_from_fd
|
||||
gp_file_open
|
||||
@@ -86,7 +87,6 @@ gp_file_set_data_and_size
|
||||
gp_file_set_mime_type
|
||||
gp_file_set_mtime
|
||||
gp_file_set_name
|
||||
gp_file_set_type
|
||||
gp_filesystem_append
|
||||
gp_filesystem_count
|
||||
gp_filesystem_delete_all
|
||||
|
||||
Reference in New Issue
Block a user