Libdc1394 has grown in complexity with time and has been patched and repatched numerous time, making it difficult to maintain. It also starts to be difficult to use it which means it's time for a little cleanup! ;-) I have worked for almost a year on the 2.0 branch which solves many issues with 1.0, but also brings new problems to the light. It's also a beta version at this stage: you have been warned. Nevertheless, the API is more or less stable at this point and following a suggestion from a user I am proposing below a guide on how to migrate your application from the 1.0 branch to the new 2.0 branch. For now the guide is limited to a few guidelines followed by an equivalence table for every function of the library. Enjoy! And don't forget to report omissions, errors or propose enhancement to this guide. ;-)
This is one of the areas that needed a cleanup and as you will see it's much simpler now. The general guideline is that everything concerning a camera is now in a single struct called 'dc1394camera_t'. No more handles. And the dc1394capture_t is in there too (it will be removed from the API soon when access functions will be defined). For those who looked at the guts of libdc, we used to access some hidden struct in the raw1394handle, which was quite ugly IMHO. It's much cleaner now.
This big change will be apparent in the API later so I won't comment too much on it now. The next thing is that several structs have been introduced. These are dc1394colormodes_t, dc1394video_modes_t and dc1394framerates_t. It was necessary because the functions for these features are now sending back lists of items instead of ugly binary masks.
Almost all functions have been changed to return a new type of value: dc1394error_t. This is an enum type defined in dc1394/log.h.
The error code is sent to the successive parent functions and you will thus have several errors printed one after each other, giving you a nice trace of what happened. The use of these macros is not limited to libdc internals: you can also include them in your programs (and you're even encouraged to do so). The macros are built to allow you to add values inside the user-supplied error message (i.e. the number of arguments is variable). Example:
This is obvious when you know that you are playing with macros but it's worth repeating anyway. Note also that the error function doesn't do anything if the error code is negative (which denotes a warning only). In that case you have to handle it.
Libdc1394 does not print anything to stdout or stderr anymore, or at least you can ask it to do so. A new error logging mechanism has been written, in which three types of error handlers can be assigned by the user (error, warning, debug)
This is the real thing. Let's go through it.
Function name in v2 | Function name in v1 | Comments
|
General system and camera functions (camera.h)
|
dc1394_t* dc1394_new (void) |
- |
Initialises a context in which the library can be used |
void dc1394_free (dc1394_t *dc1394) |
- |
Frees the context in which the library was used |
void dc1394_free_camera (dc1394camera_t *camera) |
- |
free a camera structure. You should not simply use free() to do that because handles must be removed as well as several other internal things. |
dc1394error_t dc1394_camera_enumerate (dc1394_t *dc1394, dc1394camera_list_t **list) |
- |
locates the cameras. This used to be performed by dc1394_get_camera_misc_info, dc1394_create_handle, dc1394_get_camera_nodes, dc1394_get_sw_version, dc1394_get_camera_info and dc1394_is_camera. As you can see it's much simpler now! The new function also loops on all the available ports and has a few extras that were move from coriander to libdc1394 (duplicate removal, among others). This function does not provide the camera structs themselves; it mearly tell you which GUIDs on the bus are IIDC cameras. |
void dc1394_camera_free_list (dc1394camera_list_t *list) |
- |
Frees a list of cameras provided by dc1394_camera_enumerate |
dc1394camera_t* dc1394_camera_new (dc1394_t *dc1394, uint64_t guid) |
- |
Initialise a camera structure for the camera whos GUID is specified. |
dc1394camera_t* dc1394_camera_new_unit (dc1394_t *dc1394, uint64_t guid) |
- |
Initialise a camera structure for the camera whos GUID and unit number are specified. |
void dc1394_camera_free (dc1394camera_t* camera) |
- |
Frees a camera structure. |
dc1394error_t dc1394_reset_bus (dc1394camera_t *camera) |
- |
Resets the IEEE1394 bus which camera is attached to. Calling this function is
"rude" to other devices because it causes them to re-enumerate on the bus and
may cause a temporary disruption in their current activities. Thus, use it
sparingly. Its primary use is if a program shuts down uncleanly and needs to
free leftover ISO channels or bandwidth. A bus reset will free those things
as a side effect. |
dc1394error_t dc1394_read_cycle_timer (dc1394camera_t * camera, uint32_t * cycle_timer, uint64_t * local_time) |
- |
? |
- |
int dc1394_get_camera_info (raw1394handle_t handle, nodeid_t node, dc1394_camerainfo *info) |
removed from tha API. This piece of code is integrated in dc1394_camera_new() and dc1394_camera_new_unit(). |
dc1394error_t dc1394_camera_print_info (dc1394camera_t *camera, FILE*fd) |
void dc1394_print_camera_info (dc1394_camerainfo *info) |
the output has been improved but the function is basically the same as in v1. You can also print to any file you want (including stdout) |
dc1394error_t dc1394_camera_set_broadcast (dc1394camera_t *camera, dc1394bool_t pwr); |
- |
New. Sets and resets the broadcast flag of a camera. If the broadcast flag is set,
all devices on the bus will execute the command. Useful to sync ISO start
commands or setting a bunch of cameras at the same time. Broadcast only works
with identical devices (brand/model). If the devices are not identical your
mileage may vary. Some cameras may not answer broadcast commands at all. Also,
this only works with cameras on the SAME bus (IOW, the same port). |
dc1394error_t dc1394_camera_get_broadcast (dc1394camera_t *camera, dc1394bool_t *pwr); |
- |
Tells whether a camera is in broadcast mode or not. |
Control functions (control.h)
|
dc1394error_t dc1394_camera_reset (dc1394camera_t *camera) |
int dc1394_init_camera (raw1394handle_t handle, nodeid_t node) |
same functionality |
dc1394error_t dc1394_camera_set_power (dc1394camera_t *camera, dc1394switch_t pwr) |
int dc1394_camera_on (raw1394handle_t handle, nodeid_t node)
int dc1394_camera_off (raw1394handle_t handle, nodeid_t node) |
sets the camera ON or OFF. Two functions of v1 are combined into one in v2. |
dc1394error_t dc1394_memory_get_load_ch (dc1394camera_t *camera, uint_t *channel) |
- |
Removed from the API |
dc1394error_t dc1394_memory_get_save_ch (dc1394camera_t *camera, uint_t *channel) |
- |
Removed from the API |
dc1394error_t dc1394_memory_busy (dc1394camera_t *camera, dc1394bool_t *value) |
int dc1394_is_memory_save_in_operation (raw1394handle_t handle, nodeid_t node, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_memory_save (dc1394camera_t *camera, uint_t channel) |
int dc1394_set_memory_save_ch (raw1394handle_t handle, nodeid_t node, unsigned int channel),
int dc1394_memory_save (raw1394handle_t handle, nodeid_t node) |
saves the setup to the specified channel. This combines two functions of v1. |
dc1394error_t dc1394_memory_load (dc1394camera_t *camera, uint_t channel) |
int dc1394_memory_load (raw1394handle_t handle, nodeid_t node, unsigned int channel) |
same functionality |
- |
int dc1394_query_revision (raw1394handle_t handle, nodeid_t node, int mode, quadlet_t *value) |
obsolete; removed from the API |
- |
int dc1394_query_basic_functionality (raw1394handle_t handle, nodeid_t node, quadlet_t *value) |
obsolete; removed from the API |
- |
int dc1394_query_feature_characteristics (raw1394handle_t handle, nodeid_t node, unsigned int feature, quadlet_t *value); |
obsolete; removed from the API |
dc1394error_t dc1394_external_trigger_set_polarity (dc1394camera_t *camera, dc1394trigger_polarity_t polarity) |
int dc1394_set_trigger_polarity (raw1394handle_t handle, nodeid_t node, dc1394bool_t polarity) |
same functionality |
dc1394error_t dc1394_external_trigger_get_polarity (dc1394camera_t *camera, dc1394trigger_polarity_t *polarity) |
int dc1394_get_trigger_polarity (raw1394handle_t handle, nodeid_t node, dc1394bool_t *polarity) |
same functionality |
dc1394error_t dc1394_external_trigger_has_polarity (dc1394camera_t *camera, dc1394bool_t *polarity_capable) |
int dc1394_trigger_has_polarity (raw1394handle_t handle, nodeid_t node, dc1394bool_t *polarity) |
same functionality |
dc1394error_t dc1394_external_trigger_set_power (dc1394camera_t *camera, dc1394switch_t pwr) |
int dc1394_set_trigger_on_off (raw1394handle_t handle, nodeid_t node, dc1394bool_t on_off) |
same functionality |
dc1394error_t dc1394_external_trigger_get_power (dc1394camera_t *camera, dc1394switch_t *pwr) |
int dc1394_get_trigger_on_off (raw1394handle_t handle, nodeid_t node, dc1394bool_t *on_off) |
same functionality |
dc1394error_t dc1394_external_trigger_set_mode (dc1394camera_t *camera, dc1394trigger_mode_t mode) |
int dc1394_set_trigger_mode (raw1394handle_t handle, nodeid_t node, unsigned int mode) |
same functionality |
dc1394error_t dc1394_external_trigger_get_mode (dc1394camera_t *camera, dc1394trigger_mode_t *mode) |
int dc1394_get_trigger_mode (raw1394handle_t handle, nodeid_t node, unsigned int *mode) |
same functionality |
dc1394error_t dc1394_external_trigger_set_source (dc1394camera_t *camera, dc1394trigger_source_t source) |
- |
Sets the trigger source |
dc1394error_t dc1394_external_trigger_get_source (dc1394camera_t *camera, dc1394trigger_source_t *source) |
- |
Gets the current trigger source |
dc1394error_t dc1394_software_trigger_set_power (dc1394camera_t *camera, dc1394switch_t pwr) |
int dc1394_set_soft_trigger (raw1394handle_t handle, nodeid_t node)
int dc1394_unset_soft_trigger (raw1394handle_t handle, nodeid_t node) |
two functions of v1 combined into one |
dc1394error_t dc1394_software_trigger_get_power (dc1394camera_t *camera, dc1394switch_t *pwr) |
int dc1394_get_soft_trigger (raw1394handle_t handle, nodeid_t node, dc1394bool_t *is_on) |
same functionality |
dc1394error_t dc1394_external_trigger_get_supported_sources (dc1394camera_t *camera, dc1394trigger_sources_t *sources) |
- |
Lists the available external trigger sources |
dc1394error_t dc1394_feature_get_all (dc1394camera_t *camera, dc1394featureset_t *features) |
int dc1394_get_camera_feature_set (raw1394handle_t handle, nodeid_t node, dc1394_feature_set *features) |
same functionality |
dc1394error_t dc1394_feature_get (dc1394camera_t *camera, dc1394feature_info_t *feature) |
int dc1394_get_camera_feature (raw1394handle_t handle, nodeid_t node, dc1394_feature_info *feature) |
same functionality |
dc1394error_t dc1394_feature_print (dc1394feature_info_t *feature) |
void dc1394_print_feature (dc1394_feature_info *feature) |
same functionality |
dc1394error_t dc1394_feature_print_all (dc1394featureset_t *features) |
void dc1394_print_feature_set (dc1394_feature_set *features) |
same functionality |
dc1394error_t dc1394_feature_whitebalance_get_value (dc1394camera_t *camera, uint_t *u_b_value, uint_t *v_r_value) |
int dc1394_get_white_balance (raw1394handle_t handle, nodeid_t node, unsigned int *u_b_value, unsigned int *v_r_value) |
same functionality |
dc1394error_t dc1394_feature_whitebalance_set_value (dc1394camera_t *camera, uint_t u_b_value, uint_t v_r_value) |
int dc1394_set_white_balance (raw1394handle_t handle, nodeid_t node, unsigned int u_b_value, unsigned int v_r_value) |
same functionality |
dc1394error_t dc1394_feature_temperature_get_value (dc1394camera_t *camera, uint_t *target_temperature, uint_t *temperature) |
int dc1394_get_temperature (raw1394handle_t handle, nodeid_t node, unsigned int *target_temperature, unsigned int *temperature) |
same functionality |
dc1394error_t dc1394_feature_temperature_set_value (dc1394camera_t *camera, uint_t target_temperature) |
int dc1394_set_temperature (raw1394handle_t handle, nodeid_t node, unsigned int target_temperature) |
same functionality |
dc1394error_t dc1394_feature_whiteshading_get_value (dc1394camera_t *camera, uint_t *r_value, uint_t *g_value, uint_t *b_value) |
int dc1394_get_white_shading (raw1394handle_t handle, nodeid_t node, unsigned int *r_value, unsigned int *g_value, unsigned int *b_value) |
same functionality |
dc1394error_t dc1394_feature_whiteshading_set_value (dc1394camera_t *camera, uint_t r_value, uint_t g_value, uint_t b_value) |
int dc1394_set_white_shading (raw1394handle_t handle, nodeid_t node, unsigned int r_value, unsigned int g_value, unsigned int b_value) |
same functionality |
dc1394error_t dc1394_feature_get_value (dc1394camera_t *camera, dc1394feature_t feature, uint_t *value) |
int dc1394_get_feature_value (raw1394handle_t handle, nodeid_t node, unsigned int feature, unsigned int *value)
dc1394_get_brightness, dc1394_get_exposure, dc1394_get_sharpness, dc1394_get_hue, dc1394_get_saturation, dc1394_get_gamma, dc1394_get_shutter, dc1394_get_gain, dc1394_get_iris, dc1394_get_focus, dc1394_get_trigger_delay, dc1394_get_frame_rate, dc1394_get_zoom, dc1394_get_pan, dc1394_get_tilt, dc1394_get_optical_filter, dc1394_get_capture_size, dc1394_get_capture_quality |
same functionality. All individual feature functions have been removed from v2. |
dc1394error_t dc1394_feature_set_value (dc1394camera_t *camera, dc1394feature_t feature, uint_t value) |
int dc1394_set_feature_value (raw1394handle_t handle, nodeid_t node, unsigned int feature, unsigned int value)
dc1394_set_brightness, dc1394_set_exposure, dc1394_set_sharpness, dc1394_set_hue, dc1394_set_saturation, dc1394_set_gamma, dc1394_set_shutter, dc1394_set_gain, dc1394_set_iris, dc1394_set_focus, dc1394_set_trigger_delay, dc1394_set_frame_rate, dc1394_set_zoom, dc1394_set_pan, dc1394_set_tilt, dc1394_set_optical_filter, dc1394_set_capture_size, dc1394_set_capture_quality |
same functionality. All individual feature functions have been removed from v2. |
dc1394error_t dc1394_feature_is_present (dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value) |
int dc1394_is_feature_present (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_feature_is_readable (dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value) |
int dc1394_can_read_out (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_feature_get_boundaries (dc1394camera_t *camera, dc1394feature_t feature, uint_t *min, uint_t *max) |
int dc1394_get_min_value (raw1394handle_t handle, nodeid_t node, unsigned int feature, unsigned int *value)
int dc1394_get_max_value (raw1394handle_t handle, nodeid_t node, unsigned int feature, unsigned int *value) |
two v1 functions merged in one v2 function |
dc1394error_t dc1394_feature_is_switchable (dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value) |
int dc1394_can_turn_on_off (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_feature_get_power (dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr) |
int dc1394_is_feature_on (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_feature_set_power (dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr) |
int dc1394_feature_on_off (raw1394handle_t handle, nodeid_t node, unsigned int feature, unsigned int value) |
same functionality |
dc1394error_t dc1394_feature_get_modes (dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_modes_t *modes) |
int dc1394_has_manual_mode (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value)
int dc1394_has_one_push_auto (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value)
int dc1394_has_auto_mode (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
three functions in one |
dc1394error_t dc1394_feature_get_mode (dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t *mode) |
int dc1394_is_one_push_in_operation (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value)
int dc1394_is_feature_auto (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
two v1 functions merged in one v2 function |
dc1394error_t dc1394_feature_set_mode (dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t mode) |
int dc1394_auto_on_off (raw1394handle_t handle, nodeid_t node, unsigned int feature, unsigned int value)
int dc1394_start_one_push_operation (raw1394handle_t handle, nodeid_t node, unsigned int feature) |
two v1 functions merged in one v2 function |
dc1394error_t dc1394_feature_has_absolute_control (dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value) |
int dc1394_has_absolute_control (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_feature_get_absolute_boundaries (dc1394camera_t *camera, dc1394feature_t feature, float *min, float *max) |
int dc1394_query_absolute_feature_min_max (raw1394handle_t handle, nodeid_t node, unsigned int feature, float *min, float *max) |
same functionality |
dc1394error_t dc1394_feature_get_absolute_value (dc1394camera_t *camera, dc1394feature_t feature, float *value) |
int dc1394_query_absolute_feature_value (raw1394handle_t handle, nodeid_t node, int feature, float *value) |
same functionality |
dc1394error_t dc1394_feature_set_absolute_value (dc1394camera_t *camera, dc1394feature_t feature, float value) |
int dc1394_set_absolute_feature_value (raw1394handle_t handle, nodeid_t node, int feature, float value) |
same functionality |
dc1394error_t dc1394_feature_get_absolute_control (dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr) |
int dc1394_query_absolute_control (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_feature_set_absolute_control (dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr) |
int dc1394_has_absolute_control (raw1394handle_t handle, nodeid_t node, unsigned int feature, dc1394bool_t *value) |
same functionality |
dc1394error_t dc1394_pio_set (dc1394camera_t *camera, uint32_t value) |
- |
Sets the parallel interface register |
dc1394error_t dc1394_pio_get (dc1394camera_t *camera, uint32_t *value) |
- |
Gets the parallel interface register |
Video (video.h)
|
dc1394error_t dc1394_video_get_supported_modes (dc1394camera_t *camera, dc1394video_modes_t *modes) |
int dc1394_query_supported_formats (raw1394handle_t handle, nodeid_t node, quadlet_t *value)
int dc1394_query_supported_modes (raw1394handle_t handle, nodeid_t node, unsigned int format, quadlet_t *value) |
same functionality, but as stated above the video modes do not refer to formats anymore. Moreover, a list of modes is now returned instead of a bit mask. |
dc1394error_t dc1394_video_get_supported_framerates (dc1394camera_t *camera, dc1394video_mode_t mode, dc1394framerates_t *framerates) |
int dc1394_query_supported_framerates (raw1394handle_t handle, nodeid_t node, unsigned int format, unsigned int mode, quadlet_t *value) |
same functionality, but the framerates are now returned as a list instead of a bit mask. |
dc1394error_t dc1394_video_get_framerate (dc1394camera_t *camera, dc1394framerate_t *framerate) |
int dc1394_get_video_framerate (raw1394handle_t handle, nodeid_t node, unsigned int *framerate) |
same functionality |
dc1394error_t dc1394_video_set_framerate (dc1394camera_t *camera, dc1394framerate_t framerate) |
int dc1394_set_video_framerate (raw1394handle_t handle, nodeid_t node, unsigned int framerate) |
same functionality |
dc1394error_t dc1394_video_get_mode (dc1394camera_t *camera, dc1394video_mode_t *mode) |
int dc1394_get_video_mode (raw1394handle_t handle, nodeid_t node, unsigned int *mode)
int dc1394_get_video_format (raw1394handle_t handle, nodeid_t node, unsigned int *format) |
same functionality |
dc1394error_t dc1394_video_set_mode (dc1394camera_t *camera, dc1394video_mode_t mode) |
int dc1394_set_video_mode (raw1394handle_t handle, nodeid_t node, unsigned int mode)
int dc1394_set_video_format (raw1394handle_t handle, nodeid_t node, unsigned int format) |
same functionality |
dc1394error_t dc1394_video_get_operation_mode (dc1394camera_t *camera, dc1394operation_mode_t *mode) |
int dc1394_get_operation_mode (raw1394handle_t handle, nodeid_t node, unsigned int *mode) |
same functionality |
dc1394error_t dc1394_video_set_operation_mode (dc1394camera_t *camera, dc1394operation_mode_t mode) |
int dc1394_set_operation_mode (raw1394handle_t handle, nodeid_t node, unsigned int mode) |
same functionality |
dc1394error_t dc1394_video_get_iso_speed (dc1394camera_t *camera, dc1394speed_t *speed) |
int dc1394_get_iso_channel_and_speed (raw1394handle_t handle, nodeid_t node, unsigned int *channel, unsigned int *speed) |
ISO channel allocation is now automatic |
dc1394error_t dc1394_video_set_iso_speed (dc1394camera_t *camera, dc1394speed_t speed) |
int dc1394_set_iso_channel_and_speed (raw1394handle_t handle, nodeid_t node, unsigned int channel, unsigned int speed) |
ISO channel allocation is now automatic |
dc1394error_t dc1394_video_set_transmission (dc1394camera_t *camera, dc1394switch_t pwr) |
int dc1394_start_iso_transmission (raw1394handle_t handle, nodeid_t node)
int dc1394_stop_iso_transmission (raw1394handle_t handle, nodeid_t node) |
same functionality, two functions in v1 become a single one in v2. |
dc1394error_t dc1394_video_get_transmission (dc1394camera_t *camera, dc1394switch_t *pwr) |
int dc1394_get_iso_status (raw1394handle_t handle, nodeid_t node, dc1394bool_t *is_on) |
same functionality |
dc1394error_t dc1394_video_set_one_shot (dc1394camera_t *camera, dc1394switch_t pwr) |
int dc1394_set_one_shot (raw1394handle_t handle, nodeid_t node)
int dc1394_unset_one_shot (raw1394handle_t handle, nodeid_t node) |
same functionality, two functions in v1 become a single one in v2. |
dc1394error_t dc1394_video_get_one_shot (dc1394camera_t *camera, dc1394bool_t *is_on) |
int dc1394_get_one_shot (raw1394handle_t handle, nodeid_t node, dc1394bool_t *is_on) |
same functionality |
dc1394error_t dc1394_video_set_multi_shot (dc1394camera_t *camera, uint_t numFrames, dc1394switch_t pwr) |
int dc1394_set_multi_shot (raw1394handle_t handle, nodeid_t node, unsigned int numFrames)
int dc1394_unset_multi_shot (raw1394handle_t handle, nodeid_t node) |
same functionality, two functions in v1 become a single one in v2. |
dc1394error_t dc1394_video_get_multi_shot (dc1394camera_t *camera, dc1394bool_t *is_on, uint_t *numFrames) |
int dc1394_get_multi_shot (raw1394handle_t handle, nodeid_t node, dc1394bool_t *is_on, unsigned int *numFrames) |
same functionality |
dc1394error_t dc1394_video_get_bandwidth_usage (dc1394camera_t *camera, uint_t *bandwidth) |
int dc1394_get_bandwidth_usage (raw1394handle_t handle, nodeid_t node, unsigned int *bandwidth) |
same functionality |
dc1394error_t dc1394_video_get_data_depth (dc1394camera_t *camera, uint_t *depth) |
- |
Read the data depth from the camera. This is interesting only for 16 bit modes, although I can imagine that it would be interesting that if is a camera out there that outputs less than 8 effective bits on an 8 bit. For example, if you read 10 there it means that only the 10 first bits out of the 16 sent by the camera are valid (the others are usually zero). If the value returned by this function is 0 (ZERO) you should not use it, obviously. |
Capture (capture.h)
|
dc1394error_t dc1394_capture_setup (dc1394camera_t *camera, uint_t num_dma_buffers, uint32_t flags) |
int dc1394_dma_setup_capture (raw1394handle_t handle, nodeid_t node, int channel, int format, int mode, int speed, int frame_rate, int num_dma_buffers, int drop_frames, const char *dma_device_file, dc1394_cameracapture *camera)
int dc1394_dma_setup_format7_capture (raw1394handle_t handle, nodeid_t node, int channel, int mode, int speed, int bytes_per_packet, unsigned int left, unsigned int top, unsigned int width, unsigned int height, int num_dma_buffers, int drop_frames, const char *dma_device_file, dc1394_cameracapture *camera) |
The format/fps/image/size/position/... must now be set before separately. As a result, this function is used both for fixed image formats and for Format_7. Note that the DMA device file is not an argument anymore: it is probed automatically. If you have exotic device filenames you will have to use a specific function (dc1394_set_dma_device_filename) before calling this setup function. Also, the camera capture struct is gone (it is now hidden in the dc1394camera_t struct). At last, ISO channels are allocated automatically so that the argument is gone too (you can still do manual allocation if necessary). |
- |
int dc1394_setup_capture (raw1394handle_t handle, nodeid_t node, int format, int mode, int speed, int frame_rate, dc1394_cameracapture * camera)
int dc1394_setup_format7_capture (raw1394handle_t handle, nodeid_t node, int channel, int mode, int speed, int bytes_per_packet, unsigned int left, unsigned int top, unsigned int width, unsigned int height, dc1394_cameracapture * camera) |
RAW1394 capture is obsolete |
dc1394error_t dc1394_capture_set_dma_device_filename (dc1394camera_t* camera, char *filename) |
- |
used to set the DMA device filename in case you have strange device files. Currently the following names are probed automatically: /dev/video1394 and /dev/video1394/x. If you don't use that you have to call this function before a DMA setup function. LINUX only (not for juju!) |
dc1394error_t dc1394_dequeue (dc1394camera_t *camera, dc1394capture_policy_t policy, dc1394video_frame_t **frame) |
int dc1394_dma_single_capture (dc1394_cameracapture *camera)
int dc1394_dma_single_capture_poll (dc1394_cameracapture *camera)
int dc1394_dma_multi_capture (dc1394_cameracapture *camera, int num)
int dc1394_dma_multi_capture_poll (dc1394_cameracapture *camera, int num) |
same functionality, but four functions collapsed into a single one. |
- |
int dc1394_single_capture (raw1394handle_t handle, dc1394_cameracapture *camera)
int dc1394_multi_capture (raw1394handle_t handle, dc1394_cameracapture *cams, int num) |
RAW1394 capture is obsolete |
dc1394error_t dc1394_capture_enqueue (dc1394camera_t *camera, dc1394video_frame_t *frame) |
int dc1394_dma_done_with_buffer (dc1394_cameracapture * camera) |
same functionality BUT the new enqueue/dequeue API allows several buffers to be used at the same time. Buffers must still be released reguarly with the enqueue function. |
dc1394error_t dc1394_capture_stop (dc1394camera_t *camera) |
int dc1394_dma_unlisten (raw1394handle_t handle, dc1394_cameracapture *camera)
int dc1394_dma_release_camera (raw1394handle_t handle, dc1394_cameracapture *camera) |
These two functions have collapsed into a single one. |
- |
int dc1394_release_camera (raw1394handle_t handle, dc1394_cameracapture *camera) |
RAW1394 capture is obsolete |
int dc1394_capture_get_fileno (dc1394camera_t * camera) |
- |
Get a file descriptor to be used for select(). Must be called after dc1394_capture_setup(). |
Format7
|
dc1394error_t dc1394_format7_get_max_image_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *h_size,uint_t *v_size) |
int dc1394_query_format7_max_image_size (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *horizontal_size, unsigned int *vertical_size) |
same functionality |
dc1394error_t dc1394_format7_get_unit_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *h_unit, uint_t *v_unit) |
int dc1394_query_format7_unit_size (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *horizontal_unit, unsigned int *vertical_unit) |
same functionality |
dc1394error_t dc1394_format7_get_image_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *width, uint_t *height) |
int dc1394_query_format7_image_size (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *width, unsigned int *height) |
same functionality |
dc1394error_t dc1394_format7_set_image_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t width, uint_t height) |
int dc1394_set_format7_image_size (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int width, unsigned int height) |
same functionality |
dc1394error_t dc1394_format7_get_image_position (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *left, uint_t *top) |
int dc1394_query_format7_image_position (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *left_position, unsigned int *top_position) |
same functionality |
dc1394error_t dc1394_format7_set_image_position (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t left, uint_t top) |
int dc1394_set_format7_image_position (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int left, unsigned int top) |
same functionality |
dc1394error_t dc1394_format7_get_unit_position (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *h_unit_pos, uint_t *v_unit_pos) |
int dc1394_query_format7_unit_position (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *horizontal_pos, unsigned int *vertical_pos) |
same functionality |
dc1394error_t dc1394_format7_get_color_coding (dc1394camera_t *camera, dc1394video_mode_t mode, dc1394color_coding_t *color_coding) |
int dc1394_query_format7_color_coding_id (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *color_id) |
same functionality |
dc1394error_t dc1394_format7_get_color_codings (dc1394camera_t *camera, dc1394video_mode_t mode, dc1394colormodes_t *codings) |
int dc1394_query_format7_color_coding (raw1394handle_t handle, nodeid_t node, unsigned int mode, quadlet_t *value) |
same functionality, but returns a list of codings instead of a bit mask. |
dc1394error_t dc1394_format7_set_color_coding (dc1394camera_t *camera, dc1394video_mode_t mode, dc1394color_coding_t color) |
int dc1394_set_format7_color_coding_id (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int color_id) |
same functionality |
- |
int dc1394_set_format7_color_filter_id (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int color_id) |
Useless, the register is read-only |
dc1394error_t dc1394_format7_get_color_filter (dc1394camera_t *camera, dc1394video_mode_t mode, dc1394color_filter_t *filter) |
int dc1394_query_format7_color_filter_id (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *color_id) |
same functionality |
dc1394error_t dc1394_format7_get_packet_parameters (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *unit_bytes, uint_t *max_bytes) |
int dc1394_query_format7_packet_para (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *min_bytes, unsigned int *max_bytes) |
same functionality |
dc1394error_t dc1394_format7_get_packet_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *packet_size) |
int dc1394_query_format7_byte_per_packet (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *packet_bytes) |
same functionality |
dc1394error_t dc1394_format7_set_packet_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t packet_size) |
int dc1394_set_format7_byte_per_packet (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int packet_bytes) |
same functionality |
dc1394error_t dc1394_format7_get_recommended_packet_size (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *packet_size) |
int dc1394_query_format7_recommended_byte_per_packet (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *bpp) |
same functionality |
dc1394error_t dc1394_format7_get_packets_per_frame (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *ppf) |
int dc1394_query_format7_packet_per_frame (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *ppf) |
same functionality |
dc1394error_t dc1394_format7_get_data_depth (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *data_depth) |
int dc1394_query_format7_data_depth (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *data_depth) |
same functionality |
dc1394error_t dc1394_format7_get_frame_interval (dc1394camera_t *camera, dc1394video_mode_t mode, float *interval) |
int dc1394_query_format7_frame_interval (raw1394handle_t handle, nodeid_t node, unsigned int mode, float *interval) |
same functionality |
dc1394error_t dc1394_format7_get_pixel_number (dc1394camera_t *camera, dc1394video_mode_t mode, uint_t *pixnum) |
int dc1394_query_format7_pixel_number (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned int *pixnum) |
same functionality |
dc1394error_t dc1394_format7_get_total_bytes (dc1394camera_t *camera, dc1394video_mode_t mode, uint64_t *total_bytes) |
int dc1394_query_format7_total_bytes (raw1394handle_t handle, nodeid_t node, unsigned int mode, unsigned long long int *total_bytes) |
same functionality |
dc1394error_t dc1394_format7_get_modeset (dc1394camera_t *camera, dc1394format7modeset_t *info) |
- |
Get the list of supported Format_7 modes and their properties |
dc1394error_t dc1394_format7_get_mode_info (dc1394camera_t *camera, dc1394video_mode_t mode_id, dc1394format7mode_t *mode) |
- |
Get the properties of a single Format_7 mode |
dc1394error_t dc1394_format7_set_roi (dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t color_coding, int bytes_per_packet, int left, int top, int width, int height) |
- |
Joint function that fully sets a certain ROI taking all parameters into account, checking their compatibility. Note that this function does not SWITCH to the video mode passed as argument, it mearly sets its properties. This functions contains the code that was used in the functions that used to set the format7 capture. |
dc1394error_t dc1394_format7_get_roi (dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding, int *bytes_per_packet, int *left, int *top, int *width, *int height) |
- |
Joint function that fully gets a certain ROI taking all parameters into account. |
Conversions
|
dc1394error_t dc1394_convert_to_YUV422 (uint8_t src, uint8_t dest, uint32_t width, uint32_t height, uint32_t byte_order, dc1394color_coding_t source_coding, uint_t bits) |
all conversion functions to YUV422 |
image color space conversion. Not available in version 1. The code was transfered from Coriander and enhanced/extended. It is recommended to use the frame-based conversion below. |
dc1394error_t dc1394_convert_to_MONO8 (uint8_t src, uint8_t dest, uint32_t width, uint32_t height, uint32_t byte_order, dc1394color_coding_t source_coding, uint_t bits) |
all conversion functions to MONO8 |
image color space conversion. Not available in version 1. The code was transfered from Coriander and enhanced/extended. It is recommended to use the frame-based conversion below. |
dc1394error_t dc1394_convert_to_RGB8 (uint8_t src, uint8_t dest, uint32_t width, uint32_t height, uint32_t byte_order, dc1394color_coding_t source_coding, uint_t bits) |
all conversion functions to RGB8 |
image color space conversion. Not available in version 1. The code was transfered from Coriander and enhanced/extended. It is recommended to use the frame-based conversion below. |
void dc1394_deinterlace_stereo (uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height) |
- |
Stereo de-interlace for some stereo cameras. Not available in version 1. The code was transfered from Coriander. It is recommended to use the frame-based conversion below. |
dc1394error_t dc1394_bayer_decoding_8bit (const uint8_t *bayer, uint8_t *rgb, uint32_t width, uint32_t height, dc1394color_filter_t tile, dc1394bayer_method_t method) |
- |
Bayer de-mosaicing. Also from Coriander. The code was significantly enhanced/extended and offers no less than 8 different methods: nearest neighbor, bilinear, HQ linear, edge sense 2, downsampling, 'simple', VNG (Variable Number of Gradients) and AHD. It is recommended to use the frame-based conversion below. |
dc1394error_t dc1394_bayer_decoding_16bit (const uint8_t *bayer, uint8_t *rgb, uint32_t width, uint32_t height, dc1394color_filter_t tile, dc1394bayer_method_t, uint_t bits) |
- |
Bayer de-mosaicing, 16bit. Also from Coriander. The code was significantly enhanced/extended. The same methods as the 8-bit counterpart can be used. It is recommended to use the frame-based conversion below. |
dc1394error_t dc1394_convert_frames (dc1394video_frame_t *in, dc1394video_frame_t *out) |
- |
Convert frames from one format to another, if possible (not every conversion is supported) |
dc1394error_t dc1394_debayer_frames (dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394bayer_method_t method) |
- |
Convert frames from a raw Bayer format to an RGB format using the speficied conversion method |
dc1394error_t dc1394_deinterlace_stereo_frames (dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394stereo_method_t method) |
- |
Deinterlaces stereo frames using the specified method |
Utilities (utils.h)
|
dc1394error_t dc1394_get_image_size_from_video_mode (dc1394camera_t *camera, uint_t video_mode, uint_t *width, uint_t *height) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394error_t dc1394_framerate_as_float (dc1394framerate_t framerate_enum, float *framerate) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394error_t dc1394_get_bits_per_pixel (dc1394color_coding_t color_coding, float* bpp) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394error_t dc1394_get_color_coding_from_video_mode (dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394error_t dc1394_is_color (dc1394color_coding_t color_mode, dc1394bool_t *is_color) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394bool_t dc1394_is_video_mode_scalable (dc1394video_mode_t video_mode) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394bool_t dc1394_is_video_mode_still_image (dc1394video_mode_t video_mode) |
- |
New functions to help you manage video modes and other things. Some are from Coriander. |
dc1394error_t dc1394_get_color_coding_depth (dc1394color_coding_t color_coding, uint32_t * bits) |
- |
Extracts the number of bits per value (e.g. 8bit, 16bit, etc...). This is not the number of bits per pixel (24bits for RGB8). |
dc1394bool_t dc1394_is_same_camera (dc1394camera_id_t id1, dc1394camera_id_t id2) |
- |
tells you whether two camera structs refer to the same physical camera |
const char * dc1394_feature_get_string (dc1394feature_t feature) |
- |
get a feature name string from the feature ID |
const char * dc1394_error_get_string (dc1394error_t error) |
- |
get an error string from an error code |
uint16_t dc1394_checksum_crc16 (const uint8_t* buffer, uint32_t buffer_size) |
- |
calculates the CRC of an (image) buffer |
Manual ISO ressource management (iso.h)
|
dc1394error_t dc1394_iso_set_persist (dc1394camera_t * camera) |
- |
Calling this function will cause isochronous channel and bandwidth allocations to persist beyond the lifetime of this dc1394camera_t instance. Normally (when this function is not called), any allocations would be automatically released upon freeing this camera or a premature shutdown of the application (if possible). For this function to be used, it must be called prior to any allocations or an error will be returned. |
dc1394error_t dc1394_iso_allocate_channel (dc1394camera_t * camera, uint64_t channels_allowed, int * channel) |
- |
Allocates an isochronous channel. This function may be called multiple times, each time allocating an additional channel. The channel is automatically re-allocated if there is a bus reset. The channel is automatically released when this dc1394camera_t is freed or if the application shuts down prematurely. If the channel needs to persist beyond the lifetime of this application, call dc1394_iso_set_persist() first. Note that this function does _not_ automatically program @camera to use the allocated channel for isochronous streaming. You must do that manually using dc1394_video_set_iso_channel().
|
dc1394error_t dc1394_iso_release_channel (dc1394camera_t * camera, int channel) |
- |
Releases a previously allocated channel. It is acceptable to release channels that were allocated by a different process or host. If attempting to release a channel that is already released, the function will succeed. |
dc1394error_t dc1394_iso_allocate_bandwidth (dc1394camera_t * camera, int bandwidth_units) |
- |
Allocates isochronous bandwidth. This functions allocates bandwidth _in addition_ to any previous allocations. It may be called multiple times. The bandwidth is automatically re-allocated if there is a bus reset. The bandwidth is automatically released if this camera is freed or the application shuts down prematurely. If the bandwidth needs to persist beyond the lifetime of this application, call dc1394_iso_set_persist() first.
* |
dc1394error_t dc1394_iso_release_bandwidth (dc1394camera_t * camera, int bandwidth_units) |
- |
Releases previously allocated isochronous bandwidth. Each dc1394camera_t keeps track of a running total of bandwidth that has been allocated. Released bandwidth is subtracted from this total for the sake of automatic re-allocation and automatic release on shutdown. It is also acceptable for a camera to release more bandwidth than it has allocated (to clean up for another process for example). In this case, the running total of bandwidth is not affected. It is acceptable to release more bandwidth than is allocated in total for the bus. In this case, all bandwidth is released and the function succeeds.
|
dc1394error_t dc1394_iso_release_all (dc1394camera_t * camera) |
- |
Releases all channels and bandwidth that have been previously allocated for this dc1394camera_t. Note that this information can only be tracked per process, and there is no knowledge of allocations for this camera by previous processes. To release resources in such a case, the manual release functions dc1394_iso_release_channel() and dc1394_iso_release_bandwidth() must be used. |
Error/debug logging (log.h)
|
dc1394error_t dc1394_log_register_handler (dc1394log_t type, void(*log_handler)(dc1394log_t type, const char *message, void* user), void* user) |
- |
register log handler for reporting error, warning or debug statements |
dc1394error_t dc1394_log_set_default_handler (dc1394log_t type) |
- |
set the log handler to the default handler |
void dc1394_log_error (const char *format,...) |
- |
logs a fatal error condition to the registered facility |
void dc1394_log_warning (const char *format,...) |
- |
logs a nonfatal error condition to the registered facility |
void dc1394_log_debug (const char *format,...) |
- |
logs a debug statement to the registered facility |
DC1394_WRN (err,message) |
- |
MACRO, conditionally logs a warning message |
DC1394_ERR (err,message) |
- |
MACRO, conditionally logs an error message and returns a void. |
DC1394_ERR_RTN (err,message) |
- |
MACRO, conditionally logs an error message and returns the error code |
DC1394_ERR_CLN (err,cleanup,message) |
- |
MACRO, conditionally logs an error message, execute a cleanup function and returns a void. |
DC1394_ERR_CLN_RTN (err,cleanup,message) |
- |
MACRO, conditionally logs an error message, execute a cleanup function and returns the error code |
Direct register access (register.h)
|
dc1394error_t dc1394_get_registers (dc1394camera_t *camera, uint64_t offset, uint32_t *value, uint32_t num_regs) |
- |
Gets a range of registers from the camera ROM |
dc1394error_t dc1394_set_registers (dc1394camera_t *camera, uint64_t offset, uint32_t value, uint32_t num_regs) |
- |
Sets a range of registers in the camera ROM |
dc1394error_t dc1394_get_register (dc1394camera_t *camera, uint64_t offset, uint32_t *value) |
- |
Gets a register from the camera ROM |
dc1394error_t dc1394_set_register (dc1394camera_t *camera, uint64_t offset, uint32_t value) |
- |
Sets a register in the camera ROM |
dc1394error_t dc1394_get_control_registers (dc1394camera_t *camera, uint64_t offset, uint32_t *value, uint32_t num_regs) |
- |
Gets a range of control registers from the camera ROM |
dc1394error_t dc1394_set_control_registers (dc1394camera_t *camera, uint64_t offset, uint32_t value, uint32_t num_regs) |
- |
Sets a range of control registers in the camera ROM |
static inline dc1394error_t dc1394_get_control_register (dc1394camera_t *camera, uint64_t offset, uint32_t *value) |
- |
Gets a control register from the camera ROM |
static inline dc1394error_t dc1394_set_control_register (dc1394camera_t *camera, uint64_t offset, uint32_t value) |
- |
Sets a control register in the camera ROM |
dc1394error_t dc1394_get_adv_control_registers (dc1394camera_t *camera, uint64_t offset, uint32_t *value, uint32_t num_regs) |
- |
Gets a range of advanced control registers from the camera ROM |
dc1394error_t dc1394_set_adv_control_registers (dc1394camera_t *camera, uint64_t offset, uint32_t value, uint32_t num_regs) |
- |
Sets a range of advanced control registers in the camera ROM |
dc1394error_t dc1394_get_adv_control_register (dc1394camera_t *camera, uint64_t offset, uint32_t *value) |
- |
Gets an advanced control register from the camera ROM |
dc1394error_t dc1394_set_adv_control_register (dc1394camera_t *camera, uint64_t offset, uint32_t value) |
- |
Sets an advanced control register in the camera ROM |
dc1394error_t dc1394_get_format7_register (dc1394camera_t *camera, unsigned int mode, uint64_t offset, uint32_t *value) |
- |
Gets a Format_7 register from the camera ROM |
dc1394error_t dc1394_set_format7_register (dc1394camera_t *camera, unsigned int mode, uint64_t offset, uint32_t value) |
- |
Sets a Format_7 register in the camera ROM |
dc1394error_t dc1394_get_absolute_register (dc1394camera_t *camera, unsigned int feature, uint64_t offset, uint32_t *value) |
- |
Gets an absolute control register from the camera ROM |
dc1394error_t dc1394_set_absolute_register (dc1394camera_t *camera, unsigned int feature, uint64_t offset, uint32_t value) |
- |
Sets an absolute control register in the camera ROM |
dc1394error_t dc1394_get_PIO_register (dc1394camera_t *camera, uint64_t offset, uint32_t *value) |
- |
Gets a control register from the camera ROM |
dc1394error_t dc1394_set_PIO_register (dc1394camera_t *camera, uint64_t offset, uint32_t value) |
- |
Sets a PIO control register in the camera ROM |
dc1394error_t dc1394_get_SIO_register (dc1394camera_t *camera, uint64_t offset, uint32_t *value) |
- |
Gets a PIO control register from the camera ROM |
dc1394error_t dc1394_set_SIO_register (dc1394camera_t *camera, uint64_t offset, uint32_t value) |
- |
Sets an SIO control register in the camera ROM |
dc1394error_t dc1394_get_strobe_register (dc1394camera_t *camera, uint64_t offset, uint32_t *value) |
- |
Gets an SIO control register from the camera ROM |
dc1394error_t dc1394_set_strobe_register (dc1394camera_t *camera, uint64_t offset, uint32_t value) |
- |
Sets a strobe control register in the camera ROM |