Good ideas... I will review that this WE and make the necessary changes.
Another thing I would like to do is to change the name of the trigger
functions to "..._external_trigger_...".
On Wed, 2005-07-27 at 09:37 +0200, Tim Lapawa wrote:
> Hello list,
> after building a Java Native Interface for the libdc1394V2 I've
> seen some inconsistencies int the API. The library is still
> in the "pre" phase an we could change some behaviour easily.
> The API defines functions like
> dc1394_set_trigger_polarity(dc1394camera_t*, dc1394bool_t);
> dc1394_set_trigger_on_off(dc1394camera_t*, dc1394bool_t);
> to switch the external trigger feature of som DCAM cameras with the boolean
> The software trigger on the other hand is switch on an off by two
> different function:
> dc1394_set_soft_trigger(dc1394camera_t *);
> dc1394_unset_soft_trigger(dc1394camera_t *);
> I suggest to change the software trigger functions into one with the boolean parameter.
> This point is about the memory management in the library. I think the library should follow the same concept.
> Either it handles the allocation an freeing of the camera, capture and feature structs for the user
> , and provides some free and create functions, or it will accept pointers from the application
> with already allocates stuctures.
> The dc1394_find_cameras function for example allocates dc1394camera_t structures for each camera it finds.
> The application should use the dc1394_free_camera function to free this memory again.
> The dc1394_dma_setup_capture expects an allocated structure from the application.
> I think it would be a better way to allocate all structures within the library.
> The dma_set_capture function would return the pointer just like the find_cameras function.
> The corresponding relase_capture function would free it again.
> The attached patch changes the return values of two functions.
> a) set_trigger_mode return DC1394_INVALID_TRIGGER_MODE instead of DC1394_FAILURE if the parameter is invalid.
> b) set_video_mode returns DC1394_INVALID_MODE instead of DC1394_FAILURE if the parameter is invalid.
> The function dc1394_get_camera_feature failed to identify the actual trigger mode correctly.
> The attached patch corrects this.
> And that's all from me for today. I hope I could start a discussion on the Version2 API.
> Best regards Tim Lapawa
> $ cvs -z3 diff libdc1394/dc1394_control.c
> Index: libdc1394/dc1394_control.c
> RCS file: /cvsroot/libdc1394/libdc1394/libdc1394/dc1394_control.c,v
> retrieving revision 188.8.131.52
> diff -r184.108.40.206 dc1394_control.c
> < feature->trigger_mode= (uint_t)((value >> 14) & 0xF);
> > feature->trigger_mode= (uint_t)( ((value >> 16) & 0xFUL) ) + DC1394_TRIGGER_MODE_MIN;
> > /*feature->trigger_mode= (uint_t)((value >> 14) & 0xF);*/
> < printf("\n\tcurrent mode: %d\n", f->trigger_mode);
> > printf("\n\tcurrent mode: %d\n", f->trigger_mode-DC1394_TRIGGER_MODE_MIN);
> < return DC1394_FAILURE;
> > return DC1394_INVALID_MODE;
> < return DC1394_FAILURE;
> > return DC1394_INVALID_TRIGGER_MODE;
_ Damien 'Takahara' Douxchamps, PhD
('- Post-doctoral investigator
//\ Image Processing Group, NAIST