On Monday 12 November 2007 21:48, Duncan Webb wrote: > [EMAIL PROTECTED] wrote: > > On Sunday 11 November 2007 18:53, Duncan Webb wrote: > >> Thorsten Pferdekämper wrote: > >>> I have found a plugin called "image.gphoto" which seems to be created > >>> exactly for that purpose. However, there is a not that it does not work > > The source for the pygphoto is in the testing/Thomas/pygphoto directory > it is a swig file and looks easy enough. >
Hi Duncan (and whoever is interested in gphoto),
indeed, I have used the files from that directory to create a somewhat running
version of the whole thing.
The problem...
> Inconsistency detected by ld.so: ../sysdeps/i386/dl-machine.h: 657:
> elf_machine_rel_relative: Assertion `((reloc->r_info) & 0xff) == 8' failed!
...went away after just recompiling it.
Then I encountered some problems with faulty memory accesses (seg faults, null
pointer exceptions etc.). I've made a small change in pygphoto.i to get rid
of that. (See function gp_camera in the attached version.)
I know that I have created a memory leak with that... This is still to be
changed.
I have also changed the gphoto.py. Basically, I made the CameraFile a subclass
of ImageItem and the CameraFolder a subclass of Playlist. Before, the menu
was broken after closing a picture and I could not browse through the
pictures.
Support for videos stored on the digicam is still missing. There's also no
thumbnail picture shown when looking at the picture "directory", the sorting
is missing etc.
Maybe I am going to work on it a little bit more...
Regards,
Thorsten
/* pygphoto.i */
%module pygphoto
%include "typemaps.i"
%{
/* Put header files here (optional) */
#include <gphoto2/gphoto2-abilities-list.h>
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-list.h>
%}
extern int gp_list_count( CameraList * );
%inline %{
CameraList * gp_detectcameras( )
{
CameraList * pList = NULL ;
gp_list_new( &pList ) ;
CameraAbilitiesList *al;
GPPortInfoList *il;
gp_abilities_list_new (&al);
gp_abilities_list_load (al, NULL);
gp_port_info_list_new (&il);
gp_port_info_list_load (il);
gp_abilities_list_detect (al, il, pList, NULL);
gp_abilities_list_free (al);
gp_port_info_list_free (il);
return pList ;
}
const char* gp_name( CameraList * pList, int index )
{
const char * name ;
gp_list_get_name( pList, index, &name ) ;
return name ;
}
const char * gp_value( CameraList * pList, int index )
{
const char * value ;
gp_list_get_value( pList, index, &value ) ;
return value ;
}
Camera * gp_camera( const char * name, const char * port )
{
Camera * pCamera ;
int x, count ;
CameraAbilitiesList *al ;
CameraAbilities a ;
GPPortInfoList *il ;
GPPortInfo info ;
gp_abilities_list_new(&al) ;
gp_abilities_list_load(al, NULL) ;
gp_port_info_list_new(&il) ;
gp_port_info_list_load(il) ;
x = gp_abilities_list_lookup_model (al, name);
gp_abilities_list_get_abilities (al, x, &a);
gp_port_info_list_get_info( il, x, &info ) ;
x = gp_port_info_list_lookup_path (il, port);
gp_port_info_list_get_info (il, x, &info);
gp_port_info_list_free (il);
gp_camera_new( &pCamera ) ;
gp_camera_set_abilities( pCamera, a ) ;
gp_camera_set_port_info( pCamera, info ) ;
/*
TODO: Oben wirds immer wieder neu angelegt...
gp_abilities_list_free(al) ;
gp_port_info_list_free(il) ; */
return pCamera ;
}
CameraList * gp_newlist( )
{
CameraList * pList ;
gp_list_new( &pList ) ;
return pList ;
}
CameraList * gp_getsubfolders( Camera * pCamera, const char * pFolder )
{
CameraList * pList ;
gp_list_new( &pList ) ;
gp_camera_folder_list_folders( pCamera, pFolder, pList, NULL ) ;
return pList ;
}
CameraList * gp_getfiles( Camera * pCamera, const char * pFolder )
{
CameraList * pList ;
gp_list_new( &pList ) ;
gp_camera_folder_list_files( pCamera, pFolder, pList, NULL ) ;
return pList ;
}
CameraFile * gp_getfile( Camera * pCamera, const char * pFolder, const char * pFilename )
{
CameraFile * file ;
gp_file_new(&file) ;
gp_camera_file_get (pCamera, pFolder, pFilename, GP_FILE_TYPE_NORMAL,
file, NULL);
return file;
}
PyObject * gp_readfile( CameraFile * pFile )
{
const char * data ;
unsigned long length ;
gp_file_get_data_and_size( pFile, &data, &length ) ;
return PyString_FromStringAndSize( data, length ) ;
}
%}
gphoto.py
Description: application/python
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Freevo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freevo-users
