Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
media
v4l2-ctrls.h
Go to the documentation of this file.
1
/*
2
V4L2 controls support header.
3
4
Copyright (C) 2010 Hans Verkuil <
[email protected]
>
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*/
20
21
#ifndef _V4L2_CTRLS_H
22
#define _V4L2_CTRLS_H
23
24
#include <linux/list.h>
25
#include <linux/videodev2.h>
26
27
/* forward references */
28
struct
file
;
29
struct
v4l2_ctrl_handler
;
30
struct
v4l2_ctrl_helper
;
31
struct
v4l2_ctrl
;
32
struct
video_device
;
33
struct
v4l2_subdev
;
34
struct
v4l2_subscribed_event
;
35
struct
v4l2_fh
;
36
struct
poll_table_struct
;
37
50
struct
v4l2_ctrl_ops
{
51
int
(*
g_volatile_ctrl
)(
struct
v4l2_ctrl
*
ctrl
);
52
int
(*
try_ctrl
)(
struct
v4l2_ctrl
*
ctrl
);
53
int
(*
s_ctrl
)(
struct
v4l2_ctrl
*
ctrl
);
54
};
55
109
struct
v4l2_ctrl
{
110
/* Administrative fields */
111
struct
list_head
node
;
112
struct
list_head
ev_subs
;
113
struct
v4l2_ctrl_handler
*
handler
;
114
struct
v4l2_ctrl
**
cluster
;
115
unsigned
ncontrols
;
116
unsigned
int
done
:1;
117
118
unsigned
int
is_new
:1;
119
unsigned
int
is_private
:1;
120
unsigned
int
is_auto
:1;
121
unsigned
int
has_volatiles
:1;
122
unsigned
int
manual_mode_value
:8;
123
124
const
struct
v4l2_ctrl_ops
*
ops
;
125
u32
id
;
126
const
char
*
name
;
127
enum
v4l2_ctrl_type
type
;
128
s32
minimum
,
maximum
,
default_value
;
129
union
{
130
u32
step
;
131
u32
menu_skip_mask
;
132
};
133
union
{
134
const
char
*
const
*
qmenu
;
135
const
s64
*
qmenu_int
;
136
};
137
unsigned
long
flags
;
138
union
{
139
s32
val
;
140
s64
val64
;
141
char
*
string
;
142
}
cur
;
143
union
{
144
s32
val
;
145
s64
val64
;
146
char
*
string
;
147
};
148
void
*
priv
;
149
};
150
161
struct
v4l2_ctrl_ref
{
162
struct
list_head
node
;
163
struct
v4l2_ctrl_ref
*
next
;
164
struct
v4l2_ctrl
*
ctrl
;
165
struct
v4l2_ctrl_helper
*
helper
;
166
};
167
183
struct
v4l2_ctrl_handler
{
184
struct
mutex
_lock
;
185
struct
mutex
*
lock
;
186
struct
list_head
ctrls
;
187
struct
list_head
ctrl_refs
;
188
struct
v4l2_ctrl_ref
*
cached
;
189
struct
v4l2_ctrl_ref
**
buckets
;
190
u16
nr_of_buckets
;
191
int
error
;
192
};
193
217
struct
v4l2_ctrl_config
{
218
const
struct
v4l2_ctrl_ops
*
ops
;
219
u32
id
;
220
const
char
*
name
;
221
enum
v4l2_ctrl_type
type
;
222
s32
min
;
223
s32
max
;
224
u32
step
;
225
s32
def
;
226
u32
flags
;
227
u32
menu_skip_mask
;
228
const
char
*
const
*
qmenu
;
229
const
s64
*
qmenu_int
;
230
unsigned
int
is_private
:1;
231
};
232
247
void
v4l2_ctrl_fill
(
u32
id
,
const
char
**
name
,
enum
v4l2_ctrl_type
*
type
,
248
s32
*
min
,
s32
*
max
,
s32
*
step
,
s32
*def,
u32
*
flags
);
249
250
264
int
v4l2_ctrl_handler_init
(
struct
v4l2_ctrl_handler
*hdl,
265
unsigned
nr_of_controls_hint);
266
273
void
v4l2_ctrl_handler_free
(
struct
v4l2_ctrl_handler
*hdl);
274
283
int
v4l2_ctrl_handler_setup
(
struct
v4l2_ctrl_handler
*hdl);
284
296
void
v4l2_ctrl_handler_log_status
(
struct
v4l2_ctrl_handler
*hdl,
297
const
char
*
prefix
);
298
308
struct
v4l2_ctrl
*
v4l2_ctrl_new_custom
(
struct
v4l2_ctrl_handler
*hdl,
309
const
struct
v4l2_ctrl_config
*
cfg
,
void
*
priv
);
310
328
struct
v4l2_ctrl
*
v4l2_ctrl_new_std
(
struct
v4l2_ctrl_handler
*hdl,
329
const
struct
v4l2_ctrl_ops
*
ops
,
330
u32
id
,
s32
min
,
s32
max
,
u32
step
,
s32
def);
331
350
struct
v4l2_ctrl
*
v4l2_ctrl_new_std_menu
(
struct
v4l2_ctrl_handler
*hdl,
351
const
struct
v4l2_ctrl_ops
*
ops
,
352
u32
id
,
s32
max
,
s32
mask
,
s32
def);
353
373
struct
v4l2_ctrl
*
v4l2_ctrl_new_std_menu_items
(
struct
v4l2_ctrl_handler
*hdl,
374
const
struct
v4l2_ctrl_ops
*
ops
,
u32
id
,
s32
max
,
375
s32
mask
,
s32
def,
const
char
*
const
*
qmenu
);
376
390
struct
v4l2_ctrl
*
v4l2_ctrl_new_int_menu
(
struct
v4l2_ctrl_handler
*hdl,
391
const
struct
v4l2_ctrl_ops
*
ops
,
392
u32
id
,
s32
max
,
s32
def,
const
s64
*
qmenu_int
);
393
402
struct
v4l2_ctrl
*
v4l2_ctrl_add_ctrl
(
struct
v4l2_ctrl_handler
*hdl,
403
struct
v4l2_ctrl
*
ctrl
);
404
418
int
v4l2_ctrl_add_handler
(
struct
v4l2_ctrl_handler
*hdl,
419
struct
v4l2_ctrl_handler
*
add
,
420
bool
(*
filter
)(
const
struct
v4l2_ctrl
*
ctrl
));
421
431
bool
v4l2_ctrl_radio_filter
(
const
struct
v4l2_ctrl
*
ctrl
);
432
437
void
v4l2_ctrl_cluster
(
unsigned
ncontrols
,
struct
v4l2_ctrl
**controls);
438
439
469
void
v4l2_ctrl_auto_cluster
(
unsigned
ncontrols
,
struct
v4l2_ctrl
**controls,
470
u8
manual_val,
bool
set_volatile);
471
472
480
struct
v4l2_ctrl
*
v4l2_ctrl_find
(
struct
v4l2_ctrl_handler
*hdl,
u32
id
);
481
493
void
v4l2_ctrl_activate
(
struct
v4l2_ctrl
*
ctrl
,
bool
active
);
494
508
void
v4l2_ctrl_grab
(
struct
v4l2_ctrl
*
ctrl
,
bool
grabbed);
509
514
static
inline
void
v4l2_ctrl_lock(
struct
v4l2_ctrl
*
ctrl
)
515
{
516
mutex_lock
(ctrl->
handler
->lock);
517
}
518
523
static
inline
void
v4l2_ctrl_unlock(
struct
v4l2_ctrl
*
ctrl
)
524
{
525
mutex_unlock
(ctrl->
handler
->lock);
526
}
527
537
s32
v4l2_ctrl_g_ctrl
(
struct
v4l2_ctrl
*
ctrl
);
538
549
int
v4l2_ctrl_s_ctrl
(
struct
v4l2_ctrl
*
ctrl
,
s32
val
);
550
560
s64
v4l2_ctrl_g_ctrl_int64
(
struct
v4l2_ctrl
*
ctrl
);
561
572
int
v4l2_ctrl_s_ctrl_int64
(
struct
v4l2_ctrl
*
ctrl
,
s64
val
);
573
574
/* Internal helper functions that deal with control events. */
575
extern
const
struct
v4l2_subscribed_event_ops
v4l2_ctrl_sub_ev_ops
;
576
void
v4l2_ctrl_replace
(
struct
v4l2_event
*old,
const
struct
v4l2_event
*
new
);
577
void
v4l2_ctrl_merge
(
const
struct
v4l2_event
*old,
struct
v4l2_event
*
new
);
578
579
/* Can be used as a vidioc_log_status function that just dumps all controls
580
associated with the filehandle. */
581
int
v4l2_ctrl_log_status
(
struct
file
*
file
,
void
*fh);
582
583
/* Can be used as a vidioc_subscribe_event function that just subscribes
584
control events. */
585
int
v4l2_ctrl_subscribe_event
(
struct
v4l2_fh
*fh,
586
const
struct
v4l2_event_subscription
*sub);
587
588
/* Can be used as a poll function that just polls for control events. */
589
unsigned
int
v4l2_ctrl_poll
(
struct
file
*
file
,
struct
poll_table_struct
*
wait
);
590
591
/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
592
int
v4l2_queryctrl
(
struct
v4l2_ctrl_handler
*hdl,
struct
v4l2_queryctrl
*qc);
593
int
v4l2_querymenu
(
struct
v4l2_ctrl_handler
*hdl,
struct
v4l2_querymenu
*qm);
594
int
v4l2_g_ctrl
(
struct
v4l2_ctrl_handler
*hdl,
struct
v4l2_control
*
ctrl
);
595
int
v4l2_s_ctrl
(
struct
v4l2_fh
*fh,
struct
v4l2_ctrl_handler
*hdl,
596
struct
v4l2_control
*
ctrl
);
597
int
v4l2_g_ext_ctrls
(
struct
v4l2_ctrl_handler
*hdl,
struct
v4l2_ext_controls
*
c
);
598
int
v4l2_try_ext_ctrls
(
struct
v4l2_ctrl_handler
*hdl,
struct
v4l2_ext_controls
*
c
);
599
int
v4l2_s_ext_ctrls
(
struct
v4l2_fh
*fh,
struct
v4l2_ctrl_handler
*hdl,
600
struct
v4l2_ext_controls
*
c
);
601
602
/* Helpers for subdevices. If the associated ctrl_handler == NULL then they
603
will all return -EINVAL. */
604
int
v4l2_subdev_queryctrl
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_queryctrl
*qc);
605
int
v4l2_subdev_querymenu
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_querymenu
*qm);
606
int
v4l2_subdev_g_ext_ctrls
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_ext_controls
*
cs
);
607
int
v4l2_subdev_try_ext_ctrls
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_ext_controls
*
cs
);
608
int
v4l2_subdev_s_ext_ctrls
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_ext_controls
*
cs
);
609
int
v4l2_subdev_g_ctrl
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_control
*
ctrl
);
610
int
v4l2_subdev_s_ctrl
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_control
*
ctrl
);
611
612
#endif
Generated on Thu Jan 10 2013 14:52:56 for Linux Kernel by
1.8.2