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
753cdfb2
Commit
753cdfb2
authored
Sep 01, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enumerate V4L2 audio inputs correctly and do not store unused infos
parent
2bedf377
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
46 deletions
+24
-46
modules/access/v4l2.c
modules/access/v4l2.c
+24
-46
No files found.
modules/access/v4l2.c
View file @
753cdfb2
...
...
@@ -316,9 +316,9 @@ vlc_module_begin ()
true
)
change_integer_range
(
0
,
0xFFFFFFFE
)
change_safe
()
add_integer
(
CFG_PREFIX
"audio-input"
,
0
,
AUDIO_INPUT_TEXT
,
add_integer
(
CFG_PREFIX
"audio-input"
,
-
1
,
AUDIO_INPUT_TEXT
,
AUDIO_INPUT_LONGTEXT
,
true
)
change_integer_range
(
0
,
0xFFFFFFFE
)
change_integer_range
(
-
1
,
0xFFFFFFFE
)
change_safe
()
add_obsolete_integer
(
CFG_PREFIX
"io"
)
/* since 1.2.0 */
add_integer
(
CFG_PREFIX
"width"
,
DEFAULT_WIDTH
,
WIDTH_TEXT
,
...
...
@@ -573,11 +573,6 @@ struct demux_sys_t
unsigned
i_selected_input
;
char
*
psz_standard
;
uint32_t
i_audio
;
/* V4L2 devices cannot have more than 32 audio inputs */
struct
v4l2_audio
p_audios
[
32
];
unsigned
i_selected_audio_input
;
unsigned
i_codec
;
struct
v4l2_fmtdesc
*
p_codecs
;
...
...
@@ -593,6 +588,9 @@ struct demux_sys_t
es_out_id_t
*
p_es
;
/* Audio */
uint32_t
i_audio_input
;
/* Tuner */
uint32_t
i_tuner
;
enum
v4l2_tuner_type
i_tuner_type
;
...
...
@@ -679,8 +677,7 @@ static void GetV4L2Params( demux_sys_t *p_sys, vlc_object_t *p_obj )
p_sys
->
psz_device
=
var_CreateGetNonEmptyString
(
p_obj
,
"v4l2-dev"
);
p_sys
->
i_selected_input
=
var_CreateGetInteger
(
p_obj
,
"v4l2-input"
);
p_sys
->
i_selected_audio_input
=
var_CreateGetInteger
(
p_obj
,
"v4l2-audio-input"
);
p_sys
->
i_audio_input
=
var_CreateGetInteger
(
p_obj
,
"v4l2-audio-input"
);
p_sys
->
i_width
=
var_CreateGetInteger
(
p_obj
,
"v4l2-width"
);
p_sys
->
i_height
=
var_CreateGetInteger
(
p_obj
,
"v4l2-height"
);
...
...
@@ -1623,24 +1620,21 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
}
/* Set audio input */
if
(
p_sys
->
i_audio
>
0
)
if
(
p_sys
->
i_audio_input
!=
(
uint32_t
)
-
1
)
{
if
(
p_sys
->
i_selected_audio_input
>=
p_sys
->
i_audio
)
{
msg_Warn
(
p_obj
,
"invalid audio input: using default instead"
);
p_sys
->
i_selected_audio_input
=
0
;
}
struct
v4l2_audio
audio
=
{
.
index
=
p_sys
->
i_audio_input
,
.
mode
=
0
,
/* TODO: AVL support */
};
if
(
v4l2_ioctl
(
i_fd
,
VIDIOC_S_AUDIO
,
&
p_sys
->
p_audios
[
p_sys
->
i_selected_audio_input
]
)
<
0
)
if
(
v4l2_ioctl
(
i_fd
,
VIDIOC_S_AUDIO
,
&
audio
)
<
0
)
{
msg_Err
(
p_obj
,
"cannot set audio input %u: %m"
,
p_sys
->
i_
selected_
audio_input
);
p_sys
->
i_audio_input
);
goto
error
;
}
msg_Dbg
(
p_obj
,
"audio input set to %u"
,
p_sys
->
i_
selected_
audio_input
);
p_sys
->
i_audio_input
);
}
...
...
@@ -2111,36 +2105,20 @@ static int ProbeVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
}
}
/* initialize the structures for the ioctls */
for
(
unsigned
i_index
=
0
;
i_index
<
32
;
i_index
++
)
{
p_sys
->
p_audios
[
i_index
].
index
=
i_index
;
}
/* Probe audio inputs */
if
(
cap
.
capabilities
&
V4L2_CAP_AUDIO
)
{
while
(
p_sys
->
i_audio
<
32
&&
v4l2_ioctl
(
i_fd
,
VIDIOC_S_AUDIO
,
&
p_sys
->
p_audios
[
p_sys
->
i_audio
]
)
>=
0
)
{
if
(
v4l2_ioctl
(
i_fd
,
VIDIOC_G_AUDIO
,
&
p_sys
->
p_audios
[
p_sys
->
i_audio
]
)
<
0
)
{
msg_Err
(
p_obj
,
"cannot get audio input characteristics: %m"
);
return
-
1
;
}
struct
v4l2_audio
audio
=
{
.
index
=
0
};
msg_Dbg
(
p_obj
,
"audio input %u (%s) is %s %s %c"
,
p_sys
->
i_audio
,
p_sys
->
p_audios
[
p_sys
->
i_audio
].
name
,
p_sys
->
p_audios
[
p_sys
->
i_audio
].
capability
&
V4L2_AUDCAP_STEREO
?
"Stereo"
:
"Mono"
,
p_sys
->
p_audios
[
p_sys
->
i_audio
].
capability
&
V4L2_AUDCAP_AVL
?
"(Automatic Volume Level supported)"
:
""
,
p_sys
->
i_audio
==
(
unsigned
)
p_sys
->
i_selected_audio_input
?
'*'
:
' '
);
p_sys
->
i_audio
++
;
while
(
v4l2_ioctl
(
i_fd
,
VIDIOC_ENUMAUDIO
,
&
audio
)
>=
0
)
{
msg_Dbg
(
p_obj
,
"audio input %u (%s) is %s%s %c"
,
audio
.
index
,
audio
.
name
,
audio
.
capability
&
V4L2_AUDCAP_STEREO
?
"Stereo"
:
"Mono"
,
audio
.
capability
&
V4L2_AUDCAP_AVL
?
" (Automatic Volume Level supported)"
:
""
,
p_sys
->
i_audio_input
==
audio
.
index
);
audio
.
index
++
;
}
}
...
...
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