Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
e43b973a
Commit
e43b973a
authored
Dec 13, 2007
by
Richard Hosking
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: ALSA error handling.
parent
191479d7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
modules/access/v4l2.c
modules/access/v4l2.c
+28
-7
No files found.
modules/access/v4l2.c
View file @
e43b973a
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
/*
/*
* TODO: Tuner partial implementation.
* TODO: Tuner partial implementation.
* TODO: Alsa input support - experimental
*/
*/
/*****************************************************************************
/*****************************************************************************
...
@@ -1129,10 +1128,32 @@ static block_t* GrabAudio( demux_t *p_demux )
...
@@ -1129,10 +1128,32 @@ static block_t* GrabAudio( demux_t *p_demux )
{
{
/* ALSA */
/* ALSA */
i_read
=
snd_pcm_readi
(
p_sys
->
p_alsa_pcm
,
p_block
->
p_buffer
,
p_sys
->
i_alsa_chunk_size
);
i_read
=
snd_pcm_readi
(
p_sys
->
p_alsa_pcm
,
p_block
->
p_buffer
,
p_sys
->
i_alsa_chunk_size
);
/* TODO: ALSA ERROR HANDLING?? xrun?? */
if
(
i_read
<=
0
)
{
int
i_resume
;
switch
(
i_read
)
{
case
-
EAGAIN
:
break
;
case
-
EPIPE
:
/* xrun */
snd_pcm_prepare
(
p_sys
->
p_alsa_pcm
);
break
;
case
-
ESTRPIPE
:
/* suspend */
i_resume
=
snd_pcm_resume
(
p_sys
->
p_alsa_pcm
);
if
(
i_resume
<
0
&&
i_resume
!=
-
EAGAIN
)
snd_pcm_prepare
(
p_sys
->
p_alsa_pcm
);
break
;
default:
msg_Err
(
p_demux
,
"Failed to read alsa frame (%s)"
,
snd_strerror
(
i_read
)
);
return
0
;
}
}
else
{
/* convert from frames to bytes */
/* convert from frames to bytes */
if
(
i_read
>
0
)
i_read
*=
p_sys
->
i_alsa_frame_size
;
i_read
*=
p_sys
->
i_alsa_frame_size
;
}
}
}
else
else
#endif
#endif
...
@@ -1153,6 +1174,7 @@ static block_t* GrabAudio( demux_t *p_demux )
...
@@ -1153,6 +1174,7 @@ static block_t* GrabAudio( demux_t *p_demux )
if
(
!
p_sys
->
b_use_alsa
)
if
(
!
p_sys
->
b_use_alsa
)
#endif
#endif
{
{
/* OSS */
if
(
ioctl
(
p_sys
->
i_fd_audio
,
SNDCTL_DSP_GETISPACE
,
&
buf_info
)
==
0
)
if
(
ioctl
(
p_sys
->
i_fd_audio
,
SNDCTL_DSP_GETISPACE
,
&
buf_info
)
==
0
)
{
{
i_correct
+=
buf_info
.
bytes
;
i_correct
+=
buf_info
.
bytes
;
...
@@ -1161,8 +1183,7 @@ static block_t* GrabAudio( demux_t *p_demux )
...
@@ -1161,8 +1183,7 @@ static block_t* GrabAudio( demux_t *p_demux )
#ifdef HAVE_ALSA
#ifdef HAVE_ALSA
else
else
{
{
/* TODO: ALSA timing */
/* ALSA */
/* Very experimental code... */
int
i_err
;
int
i_err
;
snd_pcm_sframes_t
delay
=
0
;
snd_pcm_sframes_t
delay
=
0
;
if
(
(
i_err
=
snd_pcm_delay
(
p_sys
->
p_alsa_pcm
,
&
delay
)
)
>=
0
)
if
(
(
i_err
=
snd_pcm_delay
(
p_sys
->
p_alsa_pcm
,
&
delay
)
)
>=
0
)
...
...
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