00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021
00022 #ifndef _DC1394_CAMERA_CONTROL_H
00023 #define _DC1394_CAMERA_CONTROL_H
00024
00025 #include <stddef.h>
00026 #include <sys/types.h>
00027 #include <libraw1394/raw1394.h>
00028 #include <stdio.h>
00029
00030
00031 enum
00032 {
00033 SPEED_100 = 0,
00034 SPEED_200,
00035 SPEED_400
00036 };
00037 #define SPEED_MIN SPEED_100
00038 #define SPEED_MAX SPEED_400
00039 #define NUM_SPEEDS (SPEED_MAX - SPEED_MIN + 1)
00040
00041
00042 enum
00043 {
00044 FRAMERATE_1_875 = 0,
00045 FRAMERATE_3_75,
00046 FRAMERATE_7_5,
00047 FRAMERATE_15,
00048 FRAMERATE_30,
00049 FRAMERATE_60
00050 };
00051 #define FRAMERATE_MIN FRAMERATE_1_875
00052 #define FRAMERATE_MAX FRAMERATE_60
00053 #define NUM_FRAMERATES (FRAMERATE_MAX - FRAMERATE_MIN + 1)
00054
00055
00056 enum
00057 {
00058 MODE_160x120_YUV444 = 0,
00059 MODE_320x240_YUV422,
00060 MODE_640x480_YUV411,
00061 MODE_640x480_YUV422,
00062 MODE_640x480_RGB,
00063 MODE_640x480_MONO
00064 };
00065 #define MODE_MIN MODE_160x120_YUV444
00066 #define MODE_MAX MODE_640x480_MONO
00067 #define NUM_MODES (MODE_MAX - MODE_MIN + 1)
00068
00069
00070 enum
00071 {
00072 FORMAT_VGA_NONCOMPRESSED = 0,
00073 FORMAT_SVGA_NONCOMPRESSED_1,
00074 FORMAT_SVGA_NONCOMPRESSED_2,
00075 FORMAT_RESERVED_1,
00076 FORMAT_RESERVED_2,
00077 FORMAT_RESERVED_3,
00078 FORMAT_STILL_IMAGE,
00079 FORMAT_SCALABLE_IMAGE_SIZE
00080 };
00081 #define FORMAT_MIN FORMAT_VGA_NONCOMPRESSED
00082 #define FORMAT_MAX FORMAT_SCALABLE_IMAGE_SIZE
00083 #define NUM_FORMATS (FORMAT_MAX - FORMAT_MIN + 1)
00084
00085
00086 enum
00087 {
00088 FEATURE_BRIGHTNESS= 0,
00089 FEATURE_EXPOSURE,
00090 FEATURE_SHARPNESS,
00091 FEATURE_WHITE_BALANCE,
00092 FEATURE_HUE,
00093 FEATURE_SATURATION,
00094 FEATURE_GAMMA,
00095 FEATURE_SHUTTER,
00096 FEATURE_GAIN,
00097 FEATURE_IRIS,
00098 FEATURE_FOCUS,
00099 FEATURE_TEMPERATURE,
00100 FEATURE_TRIGGER,
00101 FEATURE_ZOOM,
00102 FEATURE_PAN,
00103 FEATURE_TILT,
00104 FEATURE_OPTICAL_FILTER,
00105 FEATURE_CAPTURE_SIZE,
00106 FEATURE_CAPTURE_QUALITY
00107 };
00108 #define FEATURE_MIN FEATURE_BRIGHTNESS
00109 #define FEATURE_MAX FEATURE_CAPTURE_QUALITY
00110 #define NUM_FEATURES (FEATURE_MAX - FEATURE_MIN + 1)
00111
00112
00113
00114
00115 #define MAX_CHARS 32
00116
00117
00118
00119 #define DC1394_SUCCESS 1
00120 #define DC1394_FAILURE -1
00121 #define DC1394_NO_CAMERA 0xffff
00122
00123
00124
00125
00126 typedef enum
00127 {
00128 DC1394_FALSE= 0,
00129 DC1394_TRUE
00130 } dc1394bool_t;
00131
00132
00133
00134 typedef struct __dc1394_camerainfo
00135 {
00136 raw1394handle_t handle;
00137 nodeid_t id;
00138 octlet_t ccr_offset;
00139 u_int64_t euid_64;
00140 char vendor[MAX_CHARS + 1];
00141 char model[MAX_CHARS + 1];
00142 } dc1394_camerainfo;
00143
00144
00145 typedef struct __dc1394_cam_cap_struct
00146 {
00147 nodeid_t node;
00148 int channel;
00149 int frame_rate;
00150 int frame_width, frame_height;
00151 int * capture_buffer;
00152 int quadlets_per_frame;
00153 int quadlets_per_packet;
00154 } dc1394_cameracapture ;
00155
00156 typedef struct __dc1394_feature_info_struct
00157 {
00158 int feature_id;
00159 dc1394bool_t available;
00160 dc1394bool_t one_push;
00161 dc1394bool_t readout_capable;
00162 dc1394bool_t on_off_capable;
00163 dc1394bool_t auto_capable;
00164 dc1394bool_t manual_capable;
00165
00166
00167 dc1394bool_t one_push_active;
00168 dc1394bool_t is_on;
00169 dc1394bool_t auto_active;
00170
00171
00172 int min;
00173 int max;
00174 int value;
00175 } dc1394_feature_info;
00176
00177 00178
00179 typedef struct __dc1394_feature_set_struct
00180 {
00181 dc1394_feature_info feature[NUM_FEATURES];
00182 } dc1394_feature_set;
00183
00184
00185 #ifdef __cplusplus
00186 extern "C" {
00187 #endif
00188
00189 00190 00191 00192 00193
00194 int
00195 dc1394_get_camera_feature_set(raw1394handle_t handle, nodeid_t node,dc1394_feature_set *features);
00196
00197 00198 00199 00200 00201
00202 int
00203 dc1394_get_camera_feature(raw1394handle_t handle, nodeid_t node,dc1394_feature_info *feature);
00204
00205 00206 00207 00208
00209 void
00210 dc1394_print_feature(dc1394_feature_info *feature);
00211
00212 00213 00214 00215
00216 void
00217 dc1394_print_feature_set(dc1394_feature_set *features);
00218
00219
00220 00221 00222 00223 00224 00225 00226
00227 raw1394handle_t
00228 dc1394_create_handle(int port);
00229
00230
00231 00232 00233 00234 00235 00236
00237 nodeid_t*
00238 dc1394_get_camera_nodes(raw1394handle_t handle, int *numCameras,
00239 int showCameras);
00240
00241 00242 00243 00244 00245 00246 00247 00248 00249
00250 nodeid_t*
00251 dc1394_get_sorted_camera_nodes(raw1394handle_t handle,int numids,
00252 int *ids,int * numCameras,
00253 int showCameras);
00254
00255
00256 int
00257 dc1394_init_camera(raw1394handle_t handle, nodeid_t node);
00258
00259
00260 int
00261 dc1394_is_camera(raw1394handle_t handle, nodeid_t node, dc1394bool_t *value);
00262
00263
00264 void
00265 dc1394_print_camera_info(dc1394_camerainfo *info);
00266
00267 int
00268 dc1394_get_camera_info(raw1394handle_t handle, nodeid_t node,
00269 dc1394_camerainfo *info);
00270
00271
00272 int
00273 dc1394_query_supported_formats(raw1394handle_t handle, nodeid_t node,
00274 quadlet_t *value);
00275 int
00276 dc1394_query_supported_modes(raw1394handle_t handle, nodeid_t node,
00277 unsigned int format, quadlet_t *value);
00278 int
00279 dc1394_query_supported_framerates(raw1394handle_t handle, nodeid_t node,
00280 unsigned int format, unsigned int mode,
00281 quadlet_t *value);
00282 int
00283 dc1394_query_revision(raw1394handle_t handle, nodeid_t node, int mode,
00284 quadlet_t *value);
00285 int
00286 dc1394_query_csr_offset(raw1394handle_t handle, nodeid_t node, int mode,
00287 quadlet_t *value);
00288 int
00289 dc1394_query_basic_functionality(raw1394handle_t handle, nodeid_t node,
00290 quadlet_t *value);
00291 int
00292 dc1394_query_feature_control(raw1394handle_t handle, nodeid_t node,
00293 unsigned int feature, unsigned int *availability);
00294 int
00295 dc1394_query_advanced_feature_offset(raw1394handle_t handle, nodeid_t node,
00296 quadlet_t *value);
00297 int
00298 dc1394_query_feature_characteristics(raw1394handle_t handle, nodeid_t node,
00299 unsigned int feature, quadlet_t *value);
00300
00301
00302 int
00303 dc1394_get_video_framerate(raw1394handle_t handle, nodeid_t node,
00304 unsigned int *framerate);
00305 int
00306 dc1394_set_video_framerate(raw1394handle_t handle, nodeid_t node,
00307 unsigned int framerate);
00308 int
00309 dc1394_get_video_mode(raw1394handle_t handle, nodeid_t node,
00310 unsigned int *mode);
00311 int
00312 dc1394_set_video_mode(raw1394handle_t handle, nodeid_t node,
00313 unsigned int mode);
00314 int
00315 dc1394_get_video_format(raw1394handle_t handle, nodeid_t node,
00316 unsigned int *format);
00317 int
00318 dc1394_set_video_format(raw1394handle_t handle, nodeid_t node,
00319 unsigned int format);
00320 int
00321 dc1394_get_iso_channel_and_speed(raw1394handle_t handle, nodeid_t node,
00322 unsigned int *channel, unsigned int *speed);
00323 int
00324 dc1394_set_iso_channel_and_speed(raw1394handle_t handle, nodeid_t node,
00325 unsigned int channel, unsigned int speed);
00326
00327
00328 int
00329 dc1394_camera_on(raw1394handle_t handle, nodeid_t node);
00330 int
00331 dc1394_camera_off(raw1394handle_t handle, nodeid_t node);
00332
00333
00334 int
00335 dc1394_start_iso_transmission(raw1394handle_t handle, nodeid_t node);
00336 int
00337 dc1394_stop_iso_transmission(raw1394handle_t handle, nodeid_t node);
00338
00339
00340 int
00341 dc1394_set_one_shot(raw1394handle_t handle, nodeid_t node);
00342 int
00343 dc1394_unset_one_shot(raw1394handle_t handle, nodeid_t node);
00344
00345
00346 int
00347 dc1394_set_multi_shot(raw1394handle_t handle, nodeid_t node,
00348 unsigned int numFrames);
00349 int
00350 dc1394_unset_multi_shot(raw1394handle_t handle, nodeid_t node);
00351
00352
00353 int
00354 dc1394_get_brightness(raw1394handle_t handle, nodeid_t node,
00355 unsigned int *brightness);
00356 int
00357 dc1394_set_brightness(raw1394handle_t handle, nodeid_t node,
00358 unsigned int brightness);
00359 int
00360 dc1394_get_exposure(raw1394handle_t handle, nodeid_t node,
00361 unsigned int *exposure);
00362 int
00363 dc1394_set_exposure(raw1394handle_t handle, nodeid_t node,
00364 unsigned int exposure);
00365 int
00366 dc1394_get_sharpness(raw1394handle_t handle, nodeid_t node,
00367 unsigned int *sharpness);
00368 int
00369 dc1394_set_sharpness(raw1394handle_t handle, nodeid_t node,
00370 unsigned int sharpness);
00371 int
00372 dc1394_get_white_balance(raw1394handle_t handle, nodeid_t node,
00373 unsigned int *u_b_value, unsigned int *v_r_value);
00374 int
00375 dc1394_set_white_balance(raw1394handle_t handle, nodeid_t node,
00376 unsigned int u_b_value, unsigned int v_r_value);
00377 int
00378 dc1394_get_hue(raw1394handle_t handle, nodeid_t node,
00379 unsigned int *hue);
00380 int
00381 dc1394_set_hue(raw1394handle_t handle, nodeid_t node,
00382 unsigned int hue);
00383 int
00384 dc1394_get_saturation(raw1394handle_t handle, nodeid_t node,
00385 unsigned int *saturation);
00386 int
00387 dc1394_set_saturation(raw1394handle_t handle, nodeid_t node,
00388 unsigned int saturation);
00389 int
00390 dc1394_get_gamma(raw1394handle_t handle, nodeid_t node,
00391 unsigned int *gamma);
00392 int
00393 dc1394_set_gamma(raw1394handle_t handle, nodeid_t node,
00394 unsigned int gamma);
00395 int
00396 dc1394_get_shutter(raw1394handle_t handle, nodeid_t node,
00397 unsigned int *shutter);
00398 int
00399 dc1394_set_shutter(raw1394handle_t handle, nodeid_t node,
00400 unsigned int shutter);
00401 int
00402 dc1394_get_gain(raw1394handle_t handle, nodeid_t node,
00403 unsigned int *gain);
00404 int
00405 dc1394_set_gain(raw1394handle_t handle, nodeid_t node,
00406 unsigned int gain);
00407 int
00408 dc1394_get_iris(raw1394handle_t handle, nodeid_t node,
00409 unsigned int *iris);
00410 int
00411 dc1394_set_iris(raw1394handle_t handle, nodeid_t node,
00412 unsigned int iris);
00413 int
00414 dc1394_get_focus(raw1394handle_t handle, nodeid_t node,
00415 unsigned int *focus);
00416 int
00417 dc1394_set_focus(raw1394handle_t handle, nodeid_t node,
00418 unsigned int focus);
00419 int
00420 dc1394_get_temperature(raw1394handle_t handle, nodeid_t node,
00421 unsigned int *target_temperature,
00422 unsigned int *temperature);
00423 int
00424 dc1394_set_temperature(raw1394handle_t handle, nodeid_t node,
00425 unsigned int target_temperature);
00426 int
00427 dc1394_get_trigger_mode(raw1394handle_t handle, nodeid_t node,
00428 unsigned int *mode);
00429 int
00430 dc1394_set_trigger_mode(raw1394handle_t handle, nodeid_t node,
00431 unsigned int mode);
00432 int
00433 dc1394_get_zoom(raw1394handle_t handle, nodeid_t node,
00434 unsigned int *zoom);
00435 int
00436 dc1394_set_zoom(raw1394handle_t handle, nodeid_t node,
00437 unsigned int zoom);
00438 int
00439 dc1394_get_pan(raw1394handle_t handle, nodeid_t node,
00440 unsigned int *pan);
00441 int
00442 dc1394_set_pan(raw1394handle_t handle, nodeid_t node,
00443 unsigned int pan);
00444 int
00445 dc1394_get_tilt(raw1394handle_t handle, nodeid_t node,
00446 unsigned int *tilt);
00447 int
00448 dc1394_set_tilt(raw1394handle_t handle, nodeid_t node,
00449 unsigned int tilt);
00450 int
00451 dc1394_get_optical_filter(raw1394handle_t handle, nodeid_t node,
00452 unsigned int *optical_filter);
00453 int
00454 dc1394_set_optical_filter(raw1394handle_t handle, nodeid_t node,
00455 unsigned int optical_filter);
00456 int
00457 dc1394_get_capture_size(raw1394handle_t handle, nodeid_t node,
00458 unsigned int *capture_size);
00459 int
00460 dc1394_set_capture_size(raw1394handle_t handle, nodeid_t node,
00461 unsigned int capture_size);
00462 int
00463 dc1394_get_capture_quality(raw1394handle_t handle, nodeid_t node,
00464 unsigned int *capture_quality);
00465 int
00466 dc1394_set_capture_quality(raw1394handle_t handle, nodeid_t node,
00467 unsigned int capture_quality);
00468
00469
00470
00471 int
00472 dc1394_get_feature_value(raw1394handle_t handle, nodeid_t node,
00473 unsigned int feature, unsigned int *value);
00474
00475 int
00476 dc1394_set_feature_value(raw1394handle_t handle, nodeid_t node,
00477 unsigned int feature, unsigned int value);
00478
00479
00480 int
00481 dc1394_is_feature_present(raw1394handle_t handle, nodeid_t node,
00482 unsigned int feature, dc1394bool_t *value);
00483 int
00484 dc1394_has_one_push_auto(raw1394handle_t handle, nodeid_t node,
00485 unsigned int feature, dc1394bool_t *value);
00486 int
00487 dc1394_is_one_push_in_operation(raw1394handle_t handle, nodeid_t node,
00488 unsigned int feature, dc1394bool_t *value);
00489 int
00490 dc1394_start_one_push_operation(raw1394handle_t handle, nodeid_t node,
00491 unsigned int feature);
00492 int
00493 dc1394_can_read_out(raw1394handle_t handle, nodeid_t node,
00494 unsigned int feature, dc1394bool_t *value);
00495 int
00496 dc1394_can_turn_on_off(raw1394handle_t handle, nodeid_t node,
00497 unsigned int feature, dc1394bool_t *value);
00498 int
00499 dc1394_is_feature_on(raw1394handle_t handle, nodeid_t node,
00500 unsigned int feature, dc1394bool_t *value);
00501 int
00502 dc1394_feature_on_off(raw1394handle_t handle, nodeid_t node,
00503 unsigned int feature, unsigned int value);
00504
00505 int
00506 dc1394_has_auto_mode(raw1394handle_t handle, nodeid_t node,
00507 unsigned int feature, dc1394bool_t *value);
00508 int
00509 dc1394_has_manual_mode(raw1394handle_t handle, nodeid_t node,
00510 unsigned int feature, dc1394bool_t *value);
00511 int
00512 dc1394_is_feature_auto(raw1394handle_t handle, nodeid_t node,
00513 unsigned int feature, dc1394bool_t *value);
00514 int
00515 dc1394_auto_on_off(raw1394handle_t handle, nodeid_t node,
00516 unsigned int feature, unsigned int value);
00517
00518 int
00519 dc1394_get_min_value(raw1394handle_t handle, nodeid_t node,
00520 unsigned int feature, unsigned int *value);
00521 int
00522 dc1394_get_max_value(raw1394handle_t handle, nodeid_t node,
00523 unsigned int feature, unsigned int *value);
00524
00525 00526 00527 00528 00529 00530 00531 00532 00533
00534 int
00535 dc1394_setup_camera(raw1394handle_t handle, nodeid_t node,
00536 int channel, int format, int mode,
00537 int speed, int frame_rate,
00538 dc1394_cameracapture * camera);
00539 00540 00541 00542
00543 int
00544 dc1394_release_camera(raw1394handle_t handle,
00545 dc1394_cameracapture *camera);
00546
00547
00548 00549 00550 00551
00552 int
00553 dc1394_single_capture(raw1394handle_t handle,
00554 dc1394_cameracapture *camera);
00555
00556
00557 00558 00559 00560 00561 00562
00563 int
00564 dc1394_multi_capture(raw1394handle_t handle, dc1394_cameracapture * cams, int num);
00565
00566 #ifdef __cplusplus
00567 }
00568 #endif
00569
00570 #endif
00571
00572
00573
00574
00575
00576
00577