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
33b03f0e
Commit
33b03f0e
authored
Jan 03, 2009
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup alsa.
parent
f1451e35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
52 deletions
+39
-52
modules/access/alsa.c
modules/access/alsa.c
+38
-51
modules/access/v4l2/v4l2.c
modules/access/v4l2/v4l2.c
+1
-1
No files found.
modules/access/alsa.c
View file @
33b03f0e
...
@@ -111,13 +111,12 @@ static int Demux( demux_t * );
...
@@ -111,13 +111,12 @@ static int Demux( demux_t * );
static
block_t
*
GrabAudio
(
demux_t
*
p_demux
);
static
block_t
*
GrabAudio
(
demux_t
*
p_demux
);
static
int
OpenAudioDev
(
vlc_object_t
*
,
demux_sys
_t
*
);
static
int
OpenAudioDev
(
demux
_t
*
);
static
bool
ProbeAudioDevAlsa
(
vlc_object
_t
*
,
const
char
*
psz_device
);
static
bool
ProbeAudioDevAlsa
(
demux
_t
*
,
const
char
*
psz_device
);
struct
demux_sys_t
struct
demux_sys_t
{
{
const
char
*
psz_device
;
/* Alsa device from MRL */
const
char
*
psz_device
;
/* Alsa device from MRL */
int
i_fd_audio
;
/* Audio */
/* Audio */
int
i_pts
;
int
i_pts
;
...
@@ -127,27 +126,23 @@ struct demux_sys_t
...
@@ -127,27 +126,23 @@ struct demux_sys_t
block_t
*
p_block_audio
;
block_t
*
p_block_audio
;
es_out_id_t
*
p_es_audio
;
es_out_id_t
*
p_es_audio
;
int
i_audio_method
;
/* ALSA Audio */
/* ALSA Audio */
snd_pcm_t
*
p_alsa_pcm
;
snd_pcm_t
*
p_alsa_pcm
;
size_t
i_alsa_frame_size
;
size_t
i_alsa_frame_size
;
int
i_alsa_chunk_size
;
int
i_alsa_chunk_size
;
struct
pollfd
*
p_pollfd
;
int
i_pollfd
;
};
};
static
int
FindMainDevice
(
vlc_object_t
*
p_this
,
demux_sys_t
*
p_sys
)
static
int
FindMainDevice
(
demux_t
*
p_demux
)
{
{
msg_Dbg
(
p_
this
,
"opening device '%s'"
,
p_sys
->
psz_device
);
msg_Dbg
(
p_
demux
,
"opening device '%s'"
,
p_demux
->
p_sys
->
psz_device
);
if
(
ProbeAudioDevAlsa
(
p_
this
,
p_sys
->
psz_device
)
)
if
(
ProbeAudioDevAlsa
(
p_
demux
,
p_demux
->
p_sys
->
psz_device
)
)
{
{
msg_Dbg
(
p_this
,
"'%s' is an audio device"
,
p_sys
->
psz_device
);
msg_Dbg
(
p_demux
,
"'%s' is an audio device"
,
p_sys
->
i_fd_audio
=
OpenAudioDev
(
p_this
,
p_sys
);
p_demux
->
p_sys
->
psz_device
);
OpenAudioDev
(
p_demux
);
}
}
if
(
p_
sys
->
i_fd_audio
<
0
)
if
(
p_
demux
->
p_sys
->
p_alsa_pcm
==
NULL
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -181,17 +176,15 @@ static int DemuxOpen( vlc_object_t *p_this )
...
@@ -181,17 +176,15 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys
->
b_stereo
=
var_CreateGetBool
(
p_demux
,
CFG_PREFIX
"stereo"
);
p_sys
->
b_stereo
=
var_CreateGetBool
(
p_demux
,
CFG_PREFIX
"stereo"
);
p_sys
->
i_pts
=
var_CreateGetInteger
(
p_demux
,
CFG_PREFIX
"caching"
);
p_sys
->
i_pts
=
var_CreateGetInteger
(
p_demux
,
CFG_PREFIX
"caching"
);
p_sys
->
psz_device
=
NULL
;
p_sys
->
psz_device
=
NULL
;
p_sys
->
i_fd_audio
=
-
1
;
p_sys
->
p_es_audio
=
NULL
;
p_sys
->
p_es_audio
=
NULL
;
p_sys
->
p_block_audio
=
NULL
;
p_sys
->
p_block_audio
=
NULL
;
p_sys
->
p_pollfd
=
NULL
;
if
(
p_demux
->
psz_path
&&
*
p_demux
->
psz_path
)
if
(
p_demux
->
psz_path
&&
*
p_demux
->
psz_path
)
p_sys
->
psz_device
=
p_demux
->
psz_path
;
p_sys
->
psz_device
=
p_demux
->
psz_path
;
else
else
p_sys
->
psz_device
=
ALSA_DEFAULT
;
p_sys
->
psz_device
=
ALSA_DEFAULT
;
if
(
FindMainDevice
(
p_
this
,
p_sys
)
!=
VLC_SUCCESS
)
if
(
FindMainDevice
(
p_
demux
)
!=
VLC_SUCCESS
)
{
{
DemuxClose
(
p_this
);
DemuxClose
(
p_this
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -211,14 +204,10 @@ static void DemuxClose( vlc_object_t *p_this )
...
@@ -211,14 +204,10 @@ static void DemuxClose( vlc_object_t *p_this )
if
(
p_sys
->
p_alsa_pcm
)
if
(
p_sys
->
p_alsa_pcm
)
{
{
snd_pcm_close
(
p_sys
->
p_alsa_pcm
);
snd_pcm_close
(
p_sys
->
p_alsa_pcm
);
p_sys
->
i_fd_audio
=
-
1
;
}
}
if
(
p_sys
->
i_fd_audio
>=
0
)
close
(
p_sys
->
i_fd_audio
);
if
(
p_sys
->
p_block_audio
)
block_Release
(
p_sys
->
p_block_audio
);
if
(
p_sys
->
p_block_audio
)
block_Release
(
p_sys
->
p_block_audio
);
free
(
p_sys
->
p_pollfd
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -387,8 +376,9 @@ static block_t* GrabAudio( demux_t *p_demux )
...
@@ -387,8 +376,9 @@ static block_t* GrabAudio( demux_t *p_demux )
/*****************************************************************************
/*****************************************************************************
* OpenAudioDev: open and set up the audio device and probe for capabilities
* OpenAudioDev: open and set up the audio device and probe for capabilities
*****************************************************************************/
*****************************************************************************/
static
int
OpenAudioDevAlsa
(
vlc_object_t
*
p_this
,
demux_sys_t
*
p_sys
)
static
int
OpenAudioDevAlsa
(
demux_t
*
p_demux
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
const
char
*
psz_device
=
p_sys
->
psz_device
;
const
char
*
psz_device
=
p_sys
->
psz_device
;
p_sys
->
p_alsa_pcm
=
NULL
;
p_sys
->
p_alsa_pcm
=
NULL
;
snd_pcm_hw_params_t
*
p_hw_params
=
NULL
;
snd_pcm_hw_params_t
*
p_hw_params
=
NULL
;
...
@@ -401,14 +391,14 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -401,14 +391,14 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
if
(
(
i_err
=
snd_pcm_open
(
&
p_sys
->
p_alsa_pcm
,
psz_device
,
if
(
(
i_err
=
snd_pcm_open
(
&
p_sys
->
p_alsa_pcm
,
psz_device
,
SND_PCM_STREAM_CAPTURE
,
SND_PCM_NONBLOCK
)
)
<
0
)
SND_PCM_STREAM_CAPTURE
,
SND_PCM_NONBLOCK
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"Cannot open ALSA audio device %s (%s)"
,
msg_Err
(
p_
demux
,
"Cannot open ALSA audio device %s (%s)"
,
psz_device
,
snd_strerror
(
i_err
)
);
psz_device
,
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
if
(
(
i_err
=
snd_pcm_nonblock
(
p_sys
->
p_alsa_pcm
,
1
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_nonblock
(
p_sys
->
p_alsa_pcm
,
1
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"Cannot set ALSA nonblock (%s)"
,
msg_Err
(
p_
demux
,
"Cannot set ALSA nonblock (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -417,7 +407,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -417,7 +407,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
if
(
(
i_err
=
snd_pcm_hw_params_malloc
(
&
p_hw_params
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params_malloc
(
&
p_hw_params
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
msg_Err
(
p_
demux
,
"ALSA: cannot allocate hardware parameter structure (%s)"
,
"ALSA: cannot allocate hardware parameter structure (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
...
@@ -425,7 +415,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -425,7 +415,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
if
(
(
i_err
=
snd_pcm_hw_params_any
(
p_sys
->
p_alsa_pcm
,
p_hw_params
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params_any
(
p_sys
->
p_alsa_pcm
,
p_hw_params
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
msg_Err
(
p_
demux
,
"ALSA: cannot initialize hardware parameter structure (%s)"
,
"ALSA: cannot initialize hardware parameter structure (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
...
@@ -434,7 +424,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -434,7 +424,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
/* Set Interleaved access */
/* 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
)
if
(
(
i_err
=
snd_pcm_hw_params_set_access
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
SND_PCM_ACCESS_RW_INTERLEAVED
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set access type (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set access type (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -442,7 +432,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -442,7 +432,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
/* Set 16 bit little endian */
/* Set 16 bit little endian */
if
(
(
i_err
=
snd_pcm_hw_params_set_format
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
SND_PCM_FORMAT_S16_LE
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params_set_format
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
SND_PCM_FORMAT_S16_LE
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set sample format (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set sample format (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -455,7 +445,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -455,7 +445,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
#endif
#endif
if
(
i_err
<
0
)
if
(
i_err
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set sample rate (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set sample rate (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -465,13 +455,13 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -465,13 +455,13 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
if
(
(
i_err
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
channels
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
channels
)
)
<
0
)
{
{
channels
=
(
channels
==
1
)
?
2
:
1
;
channels
=
(
channels
==
1
)
?
2
:
1
;
msg_Warn
(
p_
this
,
"ALSA: cannot set channel count (%s). "
msg_Warn
(
p_
demux
,
"ALSA: cannot set channel count (%s). "
"Trying with channels=%d"
,
"Trying with channels=%d"
,
snd_strerror
(
i_err
),
snd_strerror
(
i_err
),
channels
);
channels
);
if
(
(
i_err
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
channels
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_alsa_pcm
,
p_hw_params
,
channels
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set channel count (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set channel count (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -482,7 +472,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -482,7 +472,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
unsigned
int
buffer_time
;
unsigned
int
buffer_time
;
if
(
(
i_err
=
snd_pcm_hw_params_get_buffer_time_max
(
p_hw_params
,
&
buffer_time
,
0
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params_get_buffer_time_max
(
p_hw_params
,
&
buffer_time
,
0
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot get buffer time max (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot get buffer time max (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -497,7 +487,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -497,7 +487,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
#endif
#endif
if
(
i_err
<
0
)
if
(
i_err
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set period time (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set period time (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -510,7 +500,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -510,7 +500,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
#endif
#endif
if
(
i_err
<
0
)
if
(
i_err
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set buffer time (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set buffer time (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -518,7 +508,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -518,7 +508,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
/* Apply new hardware parameters */
/* Apply new hardware parameters */
if
(
(
i_err
=
snd_pcm_hw_params
(
p_sys
->
p_alsa_pcm
,
p_hw_params
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_hw_params
(
p_sys
->
p_alsa_pcm
,
p_hw_params
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"ALSA: cannot set hw parameters (%s)"
,
msg_Err
(
p_
demux
,
"ALSA: cannot set hw parameters (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
}
}
...
@@ -528,7 +518,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -528,7 +518,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
snd_pcm_hw_params_get_buffer_size
(
p_hw_params
,
&
buffer_size
);
snd_pcm_hw_params_get_buffer_size
(
p_hw_params
,
&
buffer_size
);
if
(
chunk_size
==
buffer_size
)
if
(
chunk_size
==
buffer_size
)
{
{
msg_Err
(
p_
this
,
msg_Err
(
p_
demux
,
"ALSA: period cannot equal buffer size (%lu == %lu)"
,
"ALSA: period cannot equal buffer size (%lu == %lu)"
,
chunk_size
,
buffer_size
);
chunk_size
,
buffer_size
);
goto
adev_fail
;
goto
adev_fail
;
...
@@ -547,7 +537,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -547,7 +537,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
/* Prep device */
/* Prep device */
if
(
(
i_err
=
snd_pcm_prepare
(
p_sys
->
p_alsa_pcm
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_prepare
(
p_sys
->
p_alsa_pcm
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
msg_Err
(
p_
demux
,
"ALSA: cannot prepare audio interface for use (%s)"
,
"ALSA: cannot prepare audio interface for use (%s)"
,
snd_strerror
(
i_err
)
);
snd_strerror
(
i_err
)
);
goto
adev_fail
;
goto
adev_fail
;
...
@@ -555,8 +545,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -555,8 +545,7 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
snd_pcm_start
(
p_sys
->
p_alsa_pcm
);
snd_pcm_start
(
p_sys
->
p_alsa_pcm
);
/* Return a fake handle so other tests work */
return
VLC_SUCCESS
;
return
1
;
adev_fail:
adev_fail:
...
@@ -564,18 +553,17 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -564,18 +553,17 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys )
if
(
p_sys
->
p_alsa_pcm
)
snd_pcm_close
(
p_sys
->
p_alsa_pcm
);
if
(
p_sys
->
p_alsa_pcm
)
snd_pcm_close
(
p_sys
->
p_alsa_pcm
);
p_sys
->
p_alsa_pcm
=
NULL
;
p_sys
->
p_alsa_pcm
=
NULL
;
return
-
1
;
return
VLC_EGENERIC
;
}
}
static
int
OpenAudioDev
(
vlc_object_t
*
p_this
,
demux_sys_t
*
p_sys
)
static
int
OpenAudioDev
(
demux_t
*
p_demux
)
{
{
int
i_fd
=
OpenAudioDevAlsa
(
p_this
,
p_sys
);
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
if
(
OpenAudioDevAlsa
(
p_demux
)
!=
VLC_SUCCESS
)
if
(
i_fd
<
0
)
return
VLC_EGENERIC
;
return
i_fd
;
msg_Dbg
(
p_
this
,
"opened adev=`%s' %s %dHz"
,
msg_Dbg
(
p_
demux
,
"opened adev=`%s' %s %dHz"
,
p_sys
->
psz_device
,
p_sys
->
b_stereo
?
"stereo"
:
"mono"
,
p_sys
->
psz_device
,
p_sys
->
b_stereo
?
"stereo"
:
"mono"
,
p_sys
->
i_sample_rate
);
p_sys
->
i_sample_rate
);
...
@@ -588,26 +576,25 @@ static int OpenAudioDev( vlc_object_t *p_this, demux_sys_t *p_sys )
...
@@ -588,26 +576,25 @@ static int OpenAudioDev( vlc_object_t *p_this, demux_sys_t *p_sys )
fmt
.
audio
.
i_blockalign
=
fmt
.
audio
.
i_channels
*
fmt
.
audio
.
i_bitspersample
/
8
;
fmt
.
audio
.
i_blockalign
=
fmt
.
audio
.
i_channels
*
fmt
.
audio
.
i_bitspersample
/
8
;
fmt
.
i_bitrate
=
fmt
.
audio
.
i_channels
*
fmt
.
audio
.
i_rate
*
fmt
.
audio
.
i_bitspersample
;
fmt
.
i_bitrate
=
fmt
.
audio
.
i_channels
*
fmt
.
audio
.
i_rate
*
fmt
.
audio
.
i_bitspersample
;
msg_Dbg
(
p_
this
,
"new audio es %d channels %dHz"
,
msg_Dbg
(
p_
demux
,
"new audio es %d channels %dHz"
,
fmt
.
audio
.
i_channels
,
fmt
.
audio
.
i_rate
);
fmt
.
audio
.
i_channels
,
fmt
.
audio
.
i_rate
);
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
p_sys
->
p_es_audio
=
es_out_Add
(
p_demux
->
out
,
&
fmt
);
p_sys
->
p_es_audio
=
es_out_Add
(
p_demux
->
out
,
&
fmt
);
return
i_fd
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* ProbeAudioDevAlsa: probe audio for capabilities
* ProbeAudioDevAlsa: probe audio for capabilities
*****************************************************************************/
*****************************************************************************/
static
bool
ProbeAudioDevAlsa
(
vlc_object_t
*
p_this
,
const
char
*
psz_device
)
static
bool
ProbeAudioDevAlsa
(
demux_t
*
p_demux
,
const
char
*
psz_device
)
{
{
int
i_err
;
int
i_err
;
snd_pcm_t
*
p_alsa_pcm
;
snd_pcm_t
*
p_alsa_pcm
;
if
(
(
i_err
=
snd_pcm_open
(
&
p_alsa_pcm
,
psz_device
,
SND_PCM_STREAM_CAPTURE
,
SND_PCM_NONBLOCK
)
)
<
0
)
if
(
(
i_err
=
snd_pcm_open
(
&
p_alsa_pcm
,
psz_device
,
SND_PCM_STREAM_CAPTURE
,
SND_PCM_NONBLOCK
)
)
<
0
)
{
{
msg_Err
(
p_
this
,
"cannot open device %s for ALSA audio (%s)"
,
psz_device
,
snd_strerror
(
i_err
)
);
msg_Err
(
p_
demux
,
"cannot open device %s for ALSA audio (%s)"
,
psz_device
,
snd_strerror
(
i_err
)
);
return
false
;
return
false
;
}
}
...
...
modules/access/v4l2/v4l2.c
View file @
33b03f0e
/*****************************************************************************
/*****************************************************************************
* v4l2.c : Video4Linux2 input module for vlc
* v4l2.c : Video4Linux2 input module for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-200
8
the VideoLAN team
* Copyright (C) 2002-200
9
the VideoLAN team
* $Id$
* $Id$
*
*
* Authors: Benjamin Pracht <bigben at videolan dot org>
* Authors: Benjamin Pracht <bigben at videolan dot org>
...
...
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