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
055e9fd7
Commit
055e9fd7
authored
May 30, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access/alsa.c: mmap capture mode.
Capture using alsa mmap functions.
parent
d3dd9028
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
modules/access/alsa.c
modules/access/alsa.c
+14
-3
No files found.
modules/access/alsa.c
View file @
055e9fd7
...
...
@@ -66,6 +66,10 @@
static
int
DemuxOpen
(
vlc_object_t
*
);
static
void
DemuxClose
(
vlc_object_t
*
);
#define MMAP_TEXT N_( "Memory Mapped I/O" )
#define MMAP_LONGTEXT N_( \
"Capture audio samples using mmap I/O API." )
#define STEREO_TEXT N_( "Stereo" )
#define STEREO_LONGTEXT N_( \
"Capture the audio stream in stereo." )
...
...
@@ -102,6 +106,8 @@ vlc_module_begin()
set_capability
(
"access_demux"
,
10
)
set_callbacks
(
DemuxOpen
,
DemuxClose
)
add_bool
(
CFG_PREFIX
"mmap"
,
false
,
MMAP_TEXT
,
MMAP_LONGTEXT
,
false
)
add_bool
(
CFG_PREFIX
"stereo"
,
true
,
STEREO_TEXT
,
STEREO_LONGTEXT
,
true
)
add_string
(
CFG_PREFIX
"format"
,
"s16l"
,
FORMAT_TEXT
,
...
...
@@ -131,6 +137,7 @@ struct demux_sys_t
/* Audio */
int
i_cache
;
unsigned
int
i_sample_rate
;
bool
b_mmap
;
/* mmap'ed I/O */
bool
b_stereo
;
vlc_fourcc_t
i_format
;
size_t
i_max_frame_size
;
...
...
@@ -278,6 +285,7 @@ static int DemuxOpen( vlc_object_t *p_this )
free
(
psz_format
);
p_sys
->
i_sample_rate
=
var_InheritInteger
(
p_demux
,
CFG_PREFIX
"samplerate"
);
p_sys
->
b_mmap
=
var_InheritBool
(
p_demux
,
CFG_PREFIX
"mmap"
);
p_sys
->
b_stereo
=
var_InheritBool
(
p_demux
,
CFG_PREFIX
"stereo"
);
p_sys
->
i_cache
=
var_InheritInteger
(
p_demux
,
CFG_PREFIX
"caching"
);
p_sys
->
p_es
=
NULL
;
...
...
@@ -405,8 +413,10 @@ static block_t* GrabAudio( demux_t *p_demux )
p_sys
->
p_block
=
p_block
;
/* ALSA */
i_read
=
snd_pcm_readi
(
p_sys
->
p_alsa_pcm
,
p_block
->
p_buffer
,
p_sys
->
i_alsa_chunk_size
);
if
(
p_sys
->
b_mmap
)
i_read
=
snd_pcm_mmap_readi
(
p_sys
->
p_alsa_pcm
,
p_block
->
p_buffer
,
p_sys
->
i_alsa_chunk_size
);
else
i_read
=
snd_pcm_readi
(
p_sys
->
p_alsa_pcm
,
p_block
->
p_buffer
,
p_sys
->
i_alsa_chunk_size
);
if
(
i_read
==
-
EAGAIN
)
{
snd_pcm_wait
(
p_sys
->
p_alsa_pcm
,
10
);
/* See poll() comment in oss.c */
...
...
@@ -567,7 +577,8 @@ static int OpenAudioDevAlsa( demux_t *p_demux, const char *psz_device )
/* Set Interleaved access */
if
(
(
i_err
=
snd_pcm_hw_params_set_access
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
SND_PCM_ACCESS_RW_INTERLEAVED
)
)
<
0
)
p_sys
->
b_mmap
?
SND_PCM_ACCESS_MMAP_INTERLEAVED
:
SND_PCM_ACCESS_RW_INTERLEAVED
)
)
<
0
)
{
msg_Err
(
p_demux
,
"ALSA: cannot set access type (%s)"
,
snd_strerror
(
i_err
)
);
...
...
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