Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
c45b364e
Commit
c45b364e
authored
Dec 05, 2007
by
Richard Hosking
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: Workaround misbehaving devices (2 DVB cards in my case)
parent
a192939a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
modules/access/v4l2.c
modules/access/v4l2.c
+23
-14
No files found.
modules/access/v4l2.c
View file @
c45b364e
...
@@ -2032,9 +2032,12 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
...
@@ -2032,9 +2032,12 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
if
(
p_sys
->
dev_cap
.
capabilities
&
V4L2_CAP_VIDEO_CAPTURE
)
if
(
p_sys
->
dev_cap
.
capabilities
&
V4L2_CAP_VIDEO_CAPTURE
)
{
{
while
(
ioctl
(
i_fd
,
VIDIOC_S_INPUT
,
&
p_sys
->
i_input
)
>=
0
)
struct
v4l2_input
t_input
;
t_input
.
index
=
0
;
while
(
ioctl
(
i_fd
,
VIDIOC_ENUMINPUT
,
&
t_input
)
>=
0
)
{
{
p_sys
->
i_input
++
;
p_sys
->
i_input
++
;
t_input
.
index
=
p_sys
->
i_input
;
}
}
p_sys
->
p_inputs
=
calloc
(
1
,
p_sys
->
i_input
*
sizeof
(
struct
v4l2_input
)
);
p_sys
->
p_inputs
=
calloc
(
1
,
p_sys
->
i_input
*
sizeof
(
struct
v4l2_input
)
);
...
@@ -2095,7 +2098,6 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
...
@@ -2095,7 +2098,6 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
}
}
/* Probe audio inputs */
/* Probe audio inputs */
if
(
p_sys
->
dev_cap
.
capabilities
&
V4L2_CAP_AUDIO
)
if
(
p_sys
->
dev_cap
.
capabilities
&
V4L2_CAP_AUDIO
)
{
{
while
(
p_sys
->
i_audio
<
32
&&
while
(
p_sys
->
i_audio
<
32
&&
...
@@ -2118,14 +2120,15 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
...
@@ -2118,14 +2120,15 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
}
}
}
}
/* List tuner caps */
if
(
p_sys
->
dev_cap
.
capabilities
&
V4L2_CAP_TUNER
)
if
(
p_sys
->
dev_cap
.
capabilities
&
V4L2_CAP_TUNER
)
{
{
struct
v4l2_tuner
tuner
;
struct
v4l2_tuner
tuner
;
memset
(
&
tuner
,
0
,
sizeof
(
tuner
)
);
memset
(
&
tuner
,
0
,
sizeof
(
tuner
)
);
while
(
ioctl
(
i_fd
,
VIDIOC_
S
_TUNER
,
&
tuner
)
>=
0
)
while
(
ioctl
(
i_fd
,
VIDIOC_
G
_TUNER
,
&
tuner
)
>=
0
)
{
{
p_sys
->
i_tuner
++
;
p_sys
->
i_tuner
++
;
memset
(
&
tuner
,
0
,
sizeof
(
tuner
)
);
tuner
.
index
=
p_sys
->
i_tuner
;
tuner
.
index
=
p_sys
->
i_tuner
;
}
}
...
@@ -2213,7 +2216,8 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
...
@@ -2213,7 +2216,8 @@ vlc_bool_t ProbeVideoDev( demux_t *p_demux, char *psz_device )
frmsize
.
pixel_format
=
p_sys
->
p_codecs
[
i_index
].
pixelformat
;
frmsize
.
pixel_format
=
p_sys
->
p_codecs
[
i_index
].
pixelformat
;
if
(
ioctl
(
i_fd
,
VIDIOC_ENUM_FRAMESIZES
,
&
frmsize
)
<
0
)
if
(
ioctl
(
i_fd
,
VIDIOC_ENUM_FRAMESIZES
,
&
frmsize
)
<
0
)
{
{
msg_Err
(
p_demux
,
"Error while querying for frame size"
);
/* Not all devices support this ioctl */
msg_Warn
(
p_demux
,
"Unable to query for frame sizes"
);
}
}
else
else
{
{
...
@@ -2332,6 +2336,7 @@ static void VideoControlListPrint( demux_t *p_demux, int i_fd,
...
@@ -2332,6 +2336,7 @@ static void VideoControlListPrint( demux_t *p_demux, int i_fd,
vlc_bool_t
b_reset
)
vlc_bool_t
b_reset
)
{
{
struct
v4l2_querymenu
querymenu
;
struct
v4l2_querymenu
querymenu
;
unsigned
int
i_mid
;
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_GRABBED
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_GRABBED
)
msg_Dbg
(
p_demux
,
" control is busy"
);
msg_Dbg
(
p_demux
,
" control is busy"
);
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_READ_ONLY
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_READ_ONLY
)
...
@@ -2351,11 +2356,12 @@ static void VideoControlListPrint( demux_t *p_demux, int i_fd,
...
@@ -2351,11 +2356,12 @@ static void VideoControlListPrint( demux_t *p_demux, int i_fd,
case
V4L2_CTRL_TYPE_MENU
:
case
V4L2_CTRL_TYPE_MENU
:
msg_Dbg
(
p_demux
,
" menu control"
);
msg_Dbg
(
p_demux
,
" menu control"
);
memset
(
&
querymenu
,
0
,
sizeof
(
querymenu
)
);
memset
(
&
querymenu
,
0
,
sizeof
(
querymenu
)
);
querymenu
.
id
=
queryctrl
.
id
;
for
(
i_mid
=
queryctrl
.
minimum
;
for
(
querymenu
.
index
=
queryctrl
.
minimum
;
i_mid
<=
(
unsigned
)
queryctrl
.
maximum
;
querymenu
.
index
<=
(
unsigned
)
queryctrl
.
maximum
;
i_mid
++
)
querymenu
.
index
++
)
{
{
querymenu
.
index
=
i_mid
;
querymenu
.
id
=
queryctrl
.
id
;
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYMENU
,
&
querymenu
)
>=
0
)
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYMENU
,
&
querymenu
)
>=
0
)
{
{
msg_Dbg
(
p_demux
,
" %d: %s"
,
msg_Dbg
(
p_demux
,
" %d: %s"
,
...
@@ -2403,14 +2409,16 @@ static void VideoControlListPrint( demux_t *p_demux, int i_fd,
...
@@ -2403,14 +2409,16 @@ static void VideoControlListPrint( demux_t *p_demux, int i_fd,
static
int
VideoControlList
(
demux_t
*
p_demux
,
int
i_fd
,
vlc_bool_t
b_reset
)
static
int
VideoControlList
(
demux_t
*
p_demux
,
int
i_fd
,
vlc_bool_t
b_reset
)
{
{
struct
v4l2_queryctrl
queryctrl
;
struct
v4l2_queryctrl
queryctrl
;
int
i_cid
;
memset
(
&
queryctrl
,
0
,
sizeof
(
queryctrl
)
);
memset
(
&
queryctrl
,
0
,
sizeof
(
queryctrl
)
);
/* List public controls */
/* List public controls */
for
(
queryctrl
.
id
=
V4L2_CID_BASE
;
for
(
i_c
id
=
V4L2_CID_BASE
;
queryctrl
.
id
<
V4L2_CID_LASTP1
;
i_c
id
<
V4L2_CID_LASTP1
;
queryctrl
.
id
++
)
i_c
id
++
)
{
{
queryctrl
.
id
=
i_cid
;
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYCTRL
,
&
queryctrl
)
>=
0
)
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYCTRL
,
&
queryctrl
)
>=
0
)
{
{
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
...
@@ -2422,10 +2430,11 @@ static int VideoControlList( demux_t *p_demux, int i_fd, vlc_bool_t b_reset )
...
@@ -2422,10 +2430,11 @@ static int VideoControlList( demux_t *p_demux, int i_fd, vlc_bool_t b_reset )
}
}
/* List private controls */
/* List private controls */
for
(
queryctrl
.
id
=
V4L2_CID_PRIVATE_BASE
;
for
(
i_c
id
=
V4L2_CID_PRIVATE_BASE
;
;
;
queryctrl
.
id
++
)
i_c
id
++
)
{
{
queryctrl
.
id
=
i_cid
;
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYCTRL
,
&
queryctrl
)
>=
0
)
if
(
ioctl
(
i_fd
,
VIDIOC_QUERYCTRL
,
&
queryctrl
)
>=
0
)
{
{
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
if
(
queryctrl
.
flags
&
V4L2_CTRL_FLAG_DISABLED
)
...
...
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