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
aa5559bf
Commit
aa5559bf
authored
Mar 16, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: clean up video standard selection
Do not bother if the input does not support/need it.
parent
caa43042
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
39 deletions
+63
-39
modules/access/v4l2/v4l2.h
modules/access/v4l2/v4l2.h
+0
-2
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+63
-37
No files found.
modules/access/v4l2/v4l2.h
View file @
aa5559bf
...
...
@@ -110,8 +110,6 @@ struct buffer_t
/* video.c */
void
ParseMRL
(
vlc_object_t
*
,
const
char
*
);
int
SetupAudio
(
vlc_object_t
*
,
int
,
const
struct
v4l2_input
*
);
int
SetupTuner
(
vlc_object_t
*
,
int
,
const
struct
v4l2_input
*
);
block_t
*
GrabVideo
(
vlc_object_t
*
,
demux_sys_t
*
);
int
InitVideo
(
vlc_object_t
*
,
int
fd
,
demux_sys_t
*
,
bool
demux
);
...
...
modules/access/v4l2/video.c
View file @
aa5559bf
...
...
@@ -537,7 +537,65 @@ void ParseMRL( vlc_object_t *obj, const char *mrl )
}
}
int
SetupAudio
(
vlc_object_t
*
obj
,
int
fd
,
static
v4l2_std_id
var_InheritStandard
(
vlc_object_t
*
obj
,
const
char
*
varname
)
{
char
*
name
=
var_InheritString
(
obj
,
varname
);
if
(
name
==
NULL
)
return
V4L2_STD_UNKNOWN
;
const
size_t
n
=
sizeof
(
standards_vlc
)
/
sizeof
(
*
standards_vlc
);
static_assert
(
sizeof
(
standards_vlc
)
/
sizeof
(
*
standards_vlc
)
==
sizeof
(
standards_v4l2
)
/
sizeof
(
*
standards_v4l2
),
"Inconsistent standards tables"
);
static_assert
(
sizeof
(
standards_vlc
)
/
sizeof
(
*
standards_vlc
)
==
sizeof
(
standards_user
)
/
sizeof
(
*
standards_user
),
"Inconsistent standards tables"
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
if
(
strcasecmp
(
name
,
standards_vlc
[
i
])
==
0
)
{
free
(
name
);
return
standards_v4l2
[
i
];
}
/* Backward compatibility with old versions using V4L2 magic numbers */
char
*
end
;
v4l2_std_id
std
=
strtoull
(
name
,
&
end
,
0
);
if
(
*
end
!=
'\0'
)
{
msg_Err
(
obj
,
"unknown video standard
\"
%s
\"
"
,
name
);
std
=
V4L2_STD_UNKNOWN
;
}
free
(
name
);
return
std
;
}
static
int
SetupStandard
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
v4l2_input
*
restrict
input
)
{
if
(
!
(
input
->
capabilities
&
V4L2_IN_CAP_STD
))
{
msg_Dbg
(
obj
,
"no video standard selection"
);
return
0
;
}
v4l2_std_id
std
=
var_InheritStandard
(
obj
,
CFG_PREFIX
"standard"
);
if
(
std
==
V4L2_STD_UNKNOWN
)
{
msg_Warn
(
obj
,
"video standard not set"
);
return
0
;
}
if
(
v4l2_ioctl
(
fd
,
VIDIOC_S_STD
,
&
std
)
<
0
)
{
msg_Err
(
obj
,
"cannot set video standard 0x%"
PRIx64
": %m"
,
std
);
return
-
1
;
}
msg_Dbg
(
obj
,
"video standard set to 0x%"
PRIx64
":"
,
std
);
return
0
;
}
static
int
SetupAudio
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
v4l2_input
*
restrict
input
)
{
if
(
input
->
audioset
==
0
)
...
...
@@ -587,7 +645,7 @@ int SetupAudio (vlc_object_t *obj, int fd,
return
0
;
}
int
SetupTuner
(
vlc_object_t
*
obj
,
int
fd
,
static
int
SetupTuner
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
v4l2_input
*
restrict
input
)
{
switch
(
input
->
type
)
...
...
@@ -1003,39 +1061,7 @@ int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
}
msg_Dbg
(
p_obj
,
"input set to %u"
,
index
);
/* Select standard */
const
char
*
stdname
=
var_InheritString
(
p_obj
,
CFG_PREFIX
"standard"
);
if
(
stdname
!=
NULL
)
{
v4l2_std_id
std
=
strtoull
(
stdname
,
NULL
,
0
);
if
(
std
==
0
)
{
const
size_t
n
=
sizeof
(
standards_vlc
)
/
sizeof
(
*
standards_vlc
);
static_assert
(
sizeof
(
standards_vlc
)
/
sizeof
(
*
standards_vlc
)
==
sizeof
(
standards_v4l2
)
/
sizeof
(
*
standards_v4l2
),
"Inconsistent standards tables"
);
static_assert
(
sizeof
(
standards_vlc
)
/
sizeof
(
*
standards_vlc
)
==
sizeof
(
standards_user
)
/
sizeof
(
*
standards_user
),
"Inconsistent standards tables"
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
if
(
strcasecmp
(
stdname
,
standards_vlc
[
i
]
)
==
0
)
{
std
=
standards_v4l2
[
i
];
break
;
}
}
if
(
v4l2_ioctl
(
i_fd
,
VIDIOC_S_STD
,
&
std
)
<
0
||
v4l2_ioctl
(
i_fd
,
VIDIOC_G_STD
,
&
std
)
<
0
)
{
msg_Err
(
p_obj
,
"cannot set standard 0x%"
PRIx64
": %m"
,
std
);
return
-
1
;
}
msg_Dbg
(
p_obj
,
"standard set to 0x%"
PRIx64
":"
,
std
);
}
SetupStandard
(
p_obj
,
i_fd
,
&
input
);
SetupAudio
(
p_obj
,
i_fd
,
&
input
);
SetupTuner
(
p_obj
,
i_fd
,
&
input
);
...
...
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