[libdc] Changes to libdc1394 internals
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: David M. <dcm@MIT.EDU> - 2007-11-19 06:19:04
|
I'm currently working on rewriting some of the libdc1394 internals to work better with our new API for camera enumeration. These changes have very little effect on the external API, but there a few proposals I have for improving some of the code internals of the library: 1. Add the compile option -std=gnu99 to the build. This will use the C99 standard for compilation. The most significant benefit of this change is that it would allow variable declarations inline with code, such as: int foo (int * bar) { *bar = 3; int i; for (i = 0; i < 3; i++) *bar -= 1; return i; } Style-wise, I think that provides a lot of advantages for better readability and less clutter. Are there any drawbacks to enabling C99? 2. Change the default indenting style of the libdc1394 code from 2 spaces to 4 spaces. I find the 2 space style very hard to read, and it's inconsistent with the coding styles of just about every other project I've encountered before. For starters, I would just code any new files I create with 4 spaces, and eventually we would go through and batch convert the old files. What do folks think of this change? Is anyone really attached to 2 space indenting? 3. I'd like to reserve the prefix "dc1394_" for only functions that are publicly exported from the library. Right now, many internal-only functions start with "dc1394_" and this sometimes makes it confusing as to what is external and what is internal. Also, for the API used by platform-specific code (code in the juju/, linux/, macosx/ directories), I would like to use the prefix "platform_". Those are my 3 proposed changes for now. I will also give a brief status update on my changes to the internals: The primary change is how the platform-specific API interacts with the rest of the library. I am simplifying it to try and make as much code shared between platforms as possible. The new technique for enumeration is that each platform provides a list of all firewire devices (camera or not) with a copy of each device's config ROM. The common library will then parse these config ROMs and determine which devices are cameras. This will eliminate a lot of the platform-specific complexity. I am partially finished with these changes, but there is a lot of code to convert, so it will take me a few days. I am planning to update the library itself, as well as the platform-specific code for juju, linux, and macosx. My plan is to have it all finished by the end of the week. You may want to hold off on any major changes to the library since my commit will touch so much of the existing code. Let me know if you have any questions. Regards, David |