Webcam Library Reference Documentation  Logitech logo
webcam.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright (c) 2006-2007 Logitech.
10  *
11  * This file is part of libwebcam.
12  *
13  * libwebcam is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published
15  * by the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * libwebcam is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with libwebcam. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #ifndef C_WEBCAM_H
28 #define C_WEBCAM_H
29 
30 
31 /*
32  * Basic type definitions
33  */
34 
36 typedef unsigned int CHandle;
38 typedef unsigned int CResult;
39 
40 
41 
42 /*
43  * Enums
44  */
45 
49 enum _CResults {
50  C_SUCCESS = 0,
67 };
68 
69 
75 typedef enum _CControlId {
76  // UVC: Basic image control
84 
85  // UVC: Advanced image control
108 
109  // UVC: Optics control
126 
127  // UVC: Motion control
140 
141  // UVC: Misc
144 
145  // V4L2: Motion control (new since 2.6.26)
150 
151  // V4L2: Unknown controls
153  CC_V4L2_BASE = 0x1000,
160 
161  // Logitech (USB vendor ID: 0x046d)
162  CC_LOGITECH_BASE = 0x046d0000,
171  // Illumination mode of the first LED.
172  CC_LOGITECH_LED1_MODE,
173  // Blinking frequency of the first LED.
174  CC_LOGITECH_LED1_FREQUENCY,
175  // Disable video processing (enable raw mode)
176  CC_LOGITECH_DISABLE_PROCESSING,
177  // Bits per pixel for raw (Bayer) mode
178  CC_LOGITECH_RAW_BITS_PER_PIXEL,
179 
180 
181 } CControlId;
182 
183 
187 typedef enum _CControlFlags {
190  CC_CAN_READ = 1 << 0,
194  CC_CAN_WRITE = 1 << 1,
196  CC_CAN_NOTIFY = 1 << 2,
197 
198  // The control is a custom vendor control and not standardized in V4L2 or UVC.
199  CC_IS_CUSTOM = 1 << 8,
200  // Set values are interpreted as being relative to the current value.
201  CC_IS_RELATIVE = 1 << 9,
202  // The control triggers an action.
203  CC_IS_ACTION = 1 << 10,
204 
205 } CControlFlags;
206 
207 
214 typedef enum _CControlType {
231 
232 } CControlType;
233 
234 
238 typedef enum _CEventId {
239  CE_CONTROL_INVALID = 0,
240 
241 } CEventId;
242 
243 
247 typedef enum _CEventFlags {
248  CE_INVALID = 0,
249 
250 } CEventFlags;
251 
252 
256 typedef enum _CFrameSizeTypes {
263 
265 
266 
270 typedef enum _CFrameIntervalTypes {
277 
279 
280 
284 typedef enum _CDynctrlFlags {
291 
292 } CDynctrlFlags;
293 
294 
302 
304 
305 
306 
307 /*
308  * Structs
309  */
310 
314 typedef struct _CUSBInfo {
316  unsigned short vendor;
318  unsigned short product;
320  unsigned short release;
321 
322 } CUSBInfo;
323 
324 
328 typedef struct _CDevice {
333  char * shortName;
334 
337  char * name;
338 
341  char * driver;
342 
347  char * location;
348 
351 
352 } CDevice;
353 
354 
358 typedef struct _CControlRawValue {
360  void * data;
362  unsigned int size;
363 
365 
366 
370 typedef struct _CControlValue {
375 
376  union {
381  int value;
382 
386  };
387 
388 } CControlValue;
389 
390 
395 typedef struct _CControlChoice {
399  int index;
400 
403  char * name;
404 
406 
407 
411 typedef struct _CControl {
415  char * name;
420 
425 
426  union {
430  struct {
437  };
438 
441  struct {
443  unsigned int count;
446 
451  char * names;
452 
453  } choices;
454  };
455 
456 } CControl;
457 
458 
462 typedef struct _CPixelFormat {
467  char fourcc[5];
468 
470  char * name;
471 
474  char * mimeType;
475 
476 } CPixelFormat;
477 
478 
482 typedef struct _CFrameSize {
485 
486  union {
489  struct {
491  unsigned int width;
493  unsigned int height;
494  };
495 
499  struct {
501  unsigned int min_width;
503  unsigned int max_width;
505  unsigned int step_width;
507  unsigned int min_height;
509  unsigned int max_height;
511  unsigned int step_height;
512  };
513  };
514 
515 } CFrameSize;
516 
517 
522 typedef struct _CFrameInterval {
525 
526  union {
529  struct {
531  unsigned int n;
533  unsigned int d;
534  };
535 
539  struct {
541  unsigned int min_n;
543  unsigned int min_d;
545  unsigned int max_n;
547  unsigned int max_d;
549  unsigned int step_n;
551  unsigned int step_d;
552  };
553  };
554 
556 
557 
561 typedef struct _CEvent {
564 
566  char * name;
567 
570 
571 } CEvent;
572 
573 
577 typedef struct _CDynctrlMessage {
579  int line;
580 
582  int col;
583 
586 
588  char * text;
589 
591 
592 
596 typedef struct _CVersionNumber {
598  unsigned int major;
599 
601  unsigned int minor;
602 
604 
605 
609 typedef struct _CDynctrlInfoListStats {
611  unsigned int successful;
612 
614  unsigned int failed;
615 
617 
618 
622 typedef struct _CDynctrlInfo {
625 
627  struct {
630 
633 
636 
637  } stats;
638 
640  struct {
643 
645  char * author;
646 
648  char * contact;
649 
651  char * copyright;
652 
655 
656  } meta;
657 
659  unsigned int message_count;
660 
663 
664 } CDynctrlInfo;
665 
666 
667 
668 /*
669  * Type definitions
670  */
671 
675 typedef void (*CEventHandler)(CHandle hDevice, CEventId event_id, void *context);
676 
677 
678 
679 /*
680  * Functions
681  */
682 
683 #ifdef __cplusplus
684 extern "C" {
685 #endif
686 
687 extern CResult c_init (void);
688 extern void c_cleanup (void);
689 
690 extern CHandle c_open_device (const char *device_name);
691 extern void c_close_device (CHandle hDevice);
692 
693 extern CResult c_enum_devices (CDevice *devices, unsigned int *size, unsigned int *count);
694 extern CResult c_get_device_info (CHandle hDevice, const char *device_name, CDevice *info, unsigned int *size);
695 
696 extern CResult c_enum_pixel_formats (CHandle hDevice, CPixelFormat *formats, unsigned int *size, unsigned int *count);
697 extern CResult c_enum_frame_sizes (CHandle hDevice, const CPixelFormat *pixelformat, CFrameSize *sizes, unsigned int *size, unsigned int *count);
698 extern CResult c_enum_frame_intervals (CHandle hDevice, const CPixelFormat *pixelformat, const CFrameSize *framesize, CFrameInterval *intervals, unsigned int *size, unsigned int *count);
699 
700 extern CResult c_enum_controls (CHandle hDevice, CControl *controls, unsigned int *size, unsigned int *count);
701 extern CResult c_set_control (CHandle hDevice, CControlId control_id, const CControlValue *value);
702 extern CResult c_get_control (CHandle hDevice, CControlId control_id, CControlValue *value);
703 
704 extern CResult c_enum_events (CHandle hDevice, CEvent *events, unsigned int *size, unsigned int *count);
705 extern CResult c_subscribe_event (CHandle hDevice, CEventId event_id, CEventHandler handler, void *context);
706 extern CResult c_unsubscribe_event (CHandle hDevice, CEventId event_id);
707 
708 #ifndef DISABLE_UVCVIDEO_DYNCTRL
709 extern CResult c_add_control_mappings_from_file (const char *file_name, CDynctrlInfo *info);
710 #endif
711 
712 extern char *c_get_error_text (CResult error);
713 extern char *c_get_handle_error_text (CHandle hDevice, CResult error);
714 
715 #ifdef __cplusplus
716 }
717 #endif
718 
719 
720 #endif /* C_WEBCAM_H */

Generated on Sun Apr 28 2013 23:41:32 for Webcam Library by Doxygen 1.8.3.1
Copyright © 2006-2008 Logitech.