Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
97acb225
Commit
97acb225
authored
Jul 30, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: add integer menu controls (Linux 3.5)
parent
f8ac9254
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
2 deletions
+73
-2
configure.ac
configure.ac
+1
-1
modules/access/v4l2/controls.c
modules/access/v4l2/controls.c
+71
-0
modules/access/v4l2/v4l2.h
modules/access/v4l2/v4l2.h
+1
-1
No files found.
configure.ac
View file @
97acb225
...
...
@@ -1759,7 +1759,7 @@ AS_IF([test "$enable_v4l2" != "no"], [
AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
have_v4l2="yes"
])
AC_CHECK_DECLS([V4L2_CTRL_TYPE_BITMASK],,, [
AC_CHECK_DECLS([V4L2_CTRL_TYPE_BITMASK
,V4L2_CTRL_TYPE_INTEGER_MENU
],,, [
#ifdef HAVE_LINUX_VIDEODEV2_H
# include <linux/videodev2.h>
#endif
...
...
modules/access/v4l2/controls.c
View file @
97acb225
...
...
@@ -27,6 +27,7 @@
# include "config.h"
#endif
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <sys/ioctl.h>
...
...
@@ -155,6 +156,9 @@ static int ControlSetCallback (vlc_object_t *obj, const char *var,
case
V4L2_CTRL_TYPE_MENU
:
#if HAVE_DECL_V4L2_CTRL_TYPE_BITMASK
case
V4L2_CTRL_TYPE_BITMASK
:
#endif
#if HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU
case
V4L2_CTRL_TYPE_INTEGER_MENU
:
#endif
ret
=
ControlSet
(
ctrl
,
cur
.
i_int
);
break
;
...
...
@@ -191,6 +195,9 @@ static void ControlsReset (vlc_object_t *obj, vlc_v4l2_ctrl_t *list)
{
case
V4L2_CTRL_TYPE_INTEGER
:
case
V4L2_CTRL_TYPE_MENU
:
#if HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU
case
V4L2_CTRL_TYPE_INTEGER_MENU
:
#endif
var_SetInteger
(
obj
,
list
->
name
,
list
->
default_value
);
break
;
case
V4L2_CTRL_TYPE_BOOLEAN
:
...
...
@@ -253,6 +260,9 @@ next:
case
V4L2_CTRL_TYPE_INTEGER
:
case
V4L2_CTRL_TYPE_BOOLEAN
:
case
V4L2_CTRL_TYPE_MENU
:
#if HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU
case
V4L2_CTRL_TYPE_INTEGER_MENU
:
#endif
{
long
val
=
strtol
(
value
,
&
end
,
0
);
if
(
*
end
)
...
...
@@ -638,6 +648,64 @@ static vlc_v4l2_ctrl_t *ControlAddBitMask (vlc_object_t *obj, int fd,
}
#endif
#if HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU
static
vlc_v4l2_ctrl_t
*
ControlAddIntMenu
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
v4l2_queryctrl
*
query
)
{
msg_Dbg
(
obj
,
" int menu %s (%08"
PRIX32
")"
,
query
->
name
,
query
->
id
);
if
(
query
->
flags
&
(
CTRL_FLAGS_IGNORE
|
V4L2_CTRL_FLAG_WRITE_ONLY
))
return
NULL
;
vlc_v4l2_ctrl_t
*
c
=
ControlCreate
(
fd
,
query
);
if
(
unlikely
(
c
==
NULL
))
return
NULL
;
if
(
var_Create
(
obj
,
c
->
name
,
VLC_VAR_INTEGER
|
VLC_VAR_HASCHOICE
|
VLC_VAR_ISCOMMAND
))
{
free
(
c
);
return
NULL
;
}
vlc_value_t
val
;
struct
v4l2_control
ctrl
=
{
.
id
=
query
->
id
};
if
(
v4l2_ioctl
(
fd
,
VIDIOC_G_CTRL
,
&
ctrl
)
>=
0
)
{
msg_Dbg
(
obj
,
" current: %"
PRId32
", default: %"
PRId32
,
ctrl
.
value
,
query
->
default_value
);
val
.
i_int
=
ctrl
.
value
;
var_Change
(
obj
,
c
->
name
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
}
val
.
i_int
=
query
->
minimum
;
var_Change
(
obj
,
c
->
name
,
VLC_VAR_SETMIN
,
&
val
,
NULL
);
val
.
i_int
=
query
->
maximum
;
var_Change
(
obj
,
c
->
name
,
VLC_VAR_SETMAX
,
&
val
,
NULL
);
val
.
i_int
=
query
->
default_value
;
var_Change
(
obj
,
c
->
name
,
VLC_VAR_SETDEFAULT
,
&
val
,
NULL
);
/* Import menu choices */
for
(
uint_fast32_t
idx
=
query
->
minimum
;
idx
<=
(
uint_fast32_t
)
query
->
maximum
;
idx
++
)
{
struct
v4l2_querymenu
menu
=
{
.
id
=
query
->
id
,
.
index
=
idx
};
char
name
[
sizeof
(
"-9223372036854775808"
)];
if
(
v4l2_ioctl
(
fd
,
VIDIOC_QUERYMENU
,
&
menu
)
<
0
)
continue
;
msg_Dbg
(
obj
,
" choice %"
PRIu32
") %"
PRId64
,
menu
.
index
,
menu
.
value
);
vlc_value_t
text
;
val
.
i_int
=
menu
.
index
;
sprintf
(
name
,
"%"
PRId64
,
menu
.
value
);
text
.
psz_string
=
name
;
var_Change
(
obj
,
c
->
name
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
}
return
c
;
}
#endif
static
vlc_v4l2_ctrl_t
*
ControlAddUnknown
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
v4l2_queryctrl
*
query
)
{
...
...
@@ -671,6 +739,9 @@ vlc_v4l2_ctrl_t *ControlsInit (vlc_object_t *obj, int fd)
[
V4L2_CTRL_TYPE_STRING
]
=
ControlAddString
,
#if HAVE_DECL_V4L2_CTRL_TYPE_BITMASK
[
V4L2_CTRL_TYPE_BITMASK
]
=
ControlAddBitMask
,
#endif
#if HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU
[
V4L2_CTRL_TYPE_INTEGER_MENU
]
=
ControlAddIntMenu
,
#endif
};
...
...
modules/access/v4l2/v4l2.h
View file @
97acb225
...
...
@@ -25,7 +25,7 @@
#else
# error "No Video4Linux2 headers found."
#endif
#if
ndef V4L2_CAP_DEVICE_CAPS
#if
!HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU
# warning Please update Video4Linux2 headers!
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment