Webcam Library Reference Documentation
Main Page
Modules
Data Structures
Files
File List
Globals
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,
51
C_NOT_IMPLEMENTED
,
52
C_INIT_ERROR
,
53
C_INVALID_ARG
,
54
C_INVALID_HANDLE
,
55
C_INVALID_DEVICE
,
56
C_NOT_EXIST
,
57
C_NOT_FOUND
,
58
C_BUFFER_TOO_SMALL
,
59
C_SYNC_ERROR
,
60
C_NO_MEMORY
,
61
C_NO_HANDLES
,
62
C_V4L2_ERROR
,
63
C_SYSFS_ERROR
,
64
C_PARSE_ERROR
,
65
C_CANNOT_WRITE
,
66
C_CANNOT_READ
,
67
};
68
69
75
typedef
enum
_CControlId
{
76
// UVC: Basic image control
77
CC_BRIGHTNESS
= 1,
78
CC_CONTRAST
,
79
CC_GAIN
,
80
CC_SATURATION
,
81
CC_HUE
,
82
CC_GAMMA
,
83
CC_SHARPNESS
,
84
85
// UVC: Advanced image control
87
CC_WHITE_BALANCE_TEMPERATURE
,
89
CC_AUTO_WHITE_BALANCE_TEMPERATURE
,
91
CC_WHITE_BALANCE_COMPONENT
,
93
CC_AUTO_WHITE_BALANCE_COMPONENT
,
95
CC_BACKLIGHT_COMPENSATION
,
97
CC_POWER_LINE_FREQUENCY
,
99
CC_AUTO_HUE
,
101
CC_AUTO_EXPOSURE_MODE
,
103
CC_AUTO_EXPOSURE_PRIORITY
,
105
CC_EXPOSURE_TIME_ABSOLUTE
,
107
CC_EXPOSURE_TIME_RELATIVE
,
108
109
// UVC: Optics control
111
CC_AUTO_FOCUS
,
113
CC_FOCUS_ABSOLUTE
,
115
CC_FOCUS_RELATIVE
,
117
CC_IRIS_ABSOLUTE
,
119
CC_IRIS_RELATIVE
,
121
CC_ZOOM_ABSOLUTE
,
123
CC_ZOOM_RELATIVE
,
125
CC_DIGITAL_ZOOM
,
126
127
// UVC: Motion control
129
CC_PAN_ABSOLUTE
,
131
CC_PAN_RELATIVE
,
133
CC_TILT_ABSOLUTE
,
135
CC_TILT_RELATIVE
,
137
CC_ROLL_ABSOLUTE
,
139
CC_ROLL_RELATIVE
,
140
141
// UVC: Misc
143
CC_PRIVACY
,
144
145
// V4L2: Motion control (new since 2.6.26)
147
CC_PAN_RESET
,
149
CC_TILT_RESET
,
150
151
// V4L2: Unknown controls
153
CC_V4L2_BASE
= 0x1000,
155
CC_V4L2_CUSTOM_BASE
= 0x2000,
157
CC_V4L2_MPEG_BASE
= 0x3000,
159
CC_V4L2_CAMERA_CLASS_BASE
= 0x4000,
160
161
// Logitech (USB vendor ID: 0x046d)
162
CC_LOGITECH_BASE = 0x046d0000,
166
CC_LOGITECH_PANTILT_RELATIVE
,
170
CC_LOGITECH_PANTILT_RESET
,
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
{
218
CC_TYPE_RAW
= 1,
221
CC_TYPE_BOOLEAN
,
224
CC_TYPE_CHOICE
,
226
CC_TYPE_BYTE
,
228
CC_TYPE_WORD
,
230
CC_TYPE_DWORD
,
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
{
258
CF_SIZE_DISCRETE
= 1,
260
CF_SIZE_CONTINUOUS
,
262
CF_SIZE_STEPWISE
,
263
264
}
CFrameSizeTypes
;
265
266
270
typedef
enum
_CFrameIntervalTypes
{
272
CF_INTERVAL_DISCRETE
= 1,
274
CF_INTERVAL_CONTINUOUS
,
276
CF_INTERVAL_STEPWISE
,
277
278
}
CFrameIntervalTypes
;
279
280
284
typedef
enum
_CDynctrlFlags
{
286
CD_DONT_VALIDATE
= 1 << 0,
288
CD_REPORT_ERRORS
= 1 << 1,
290
CD_RETRIEVE_META_INFO
= 1 << 2,
291
292
}
CDynctrlFlags
;
293
294
298
typedef
enum
_CDynctrlMessageSeverity
{
299
CD_SEVERITY_ERROR
= 2,
300
CD_SEVERITY_WARNING
= 3,
301
CD_SEVERITY_INFO
= 4,
302
303
}
CDynctrlMessageSeverity
;
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
350
CUSBInfo
usb
;
351
352
}
CDevice
;
353
354
358
typedef
struct
_CControlRawValue
{
360
void
*
data
;
362
unsigned
int
size
;
363
364
}
CControlRawValue
;
365
366
370
typedef
struct
_CControlValue
{
374
CControlType
type
;
375
376
union
{
381
int
value
;
382
385
CControlRawValue
raw
;
386
};
387
388
}
CControlValue
;
389
390
395
typedef
struct
_CControlChoice
{
399
int
index
;
400
403
char
*
name
;
404
405
}
CControlChoice
;
406
407
411
typedef
struct
_CControl
{
413
CControlId
id
;
415
char
*
name
;
417
CControlType
type
;
419
CControlFlags
flags
;
420
422
CControlValue
value
;
424
CControlValue
def
;
425
426
union
{
430
struct
{
432
CControlValue
min
;
434
CControlValue
max
;
436
CControlValue
step
;
437
};
438
441
struct
{
443
unsigned
int
count
;
445
CControlChoice
*
list
;
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
{
484
CFrameSizeTypes
type
;
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
{
524
CFrameIntervalTypes
type
;
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
555
}
CFrameInterval
;
556
557
561
typedef
struct
_CEvent
{
563
CEventId
id
;
564
566
char
*
name
;
567
569
CEventFlags
flags
;
570
571
}
CEvent
;
572
573
577
typedef
struct
_CDynctrlMessage
{
579
int
line
;
580
582
int
col
;
583
585
CDynctrlMessageSeverity
severity
;
586
588
char
*
text
;
589
590
}
CDynctrlMessage
;
591
592
596
typedef
struct
_CVersionNumber
{
598
unsigned
int
major
;
599
601
unsigned
int
minor
;
602
603
}
CVersionNumber
;
604
605
609
typedef
struct
_CDynctrlInfoListStats
{
611
unsigned
int
successful
;
612
614
unsigned
int
failed
;
615
616
}
CDynctrlInfoListStats
;
617
618
622
typedef
struct
_CDynctrlInfo
{
624
CDynctrlFlags
flags
;
625
627
struct
{
629
CDynctrlInfoListStats
constants
;
630
632
CDynctrlInfoListStats
controls
;
633
635
CDynctrlInfoListStats
mappings
;
636
637
} stats;
638
640
struct
{
642
CVersionNumber
version
;
643
645
char
*
author
;
646
648
char
*
contact
;
649
651
char
*
copyright
;
652
654
CVersionNumber
revision
;
655
656
} meta;
657
659
unsigned
int
message_count
;
660
662
CDynctrlMessage
*
messages
;
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.