Friday, September 28, 2007

So over the last few weeks i've been working on improving the C# binding for libgphoto2.. Thankfully, the backend C wrapper was in fairly good shape with thanks to the guy who originally developed it, and trickv, who became the maintainer of it and is the guy responsible for implementing MTP support in banshee.

For me looking at the code as a newcomer to the libgphoto-sharp 'team', the first thing i realised was that the c# api was a direct copy/paste of the C api. There was no proper frontend which simplified the use of the libghoto2 library. For example, to get a list of connected devices and then connect to a specific one required detailed knowledge of the libgphoto2 API and over 100 lines of code and also required you to be very careful about disposing of objects correctly.

So, my first task in getting full MTP support in banshee was to write up a new API for libgphoto2-sharp which hid all that nastiness from the end-user. The new API is, i suppose, 80% complete. Quite a few of the methods in the API are blocking, and so asynchronous equivalents will have to be added. One of the more immediate benefits is that detecting and connecting to a camera takes 3 lines of code now ;)

So, if anyone out there wants to use the new simpler API (fspot and banshee devs, i'm talking to you) you can check the code out with this command:

svn co gphoto

The binding should be considered API unstable until (probably) the release of libgphoto3.x.


Lluis said...

The SVN url is wrong. It should be:

Alan said...

Good catch. Fixed it in the post

Hit Counter