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
313cf680
Commit
313cf680
authored
Nov 23, 2000
by
Henri Fallon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Cosmetic changes to alsa.c - Configure now checks alsa is present
parent
b9079557
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
261 additions
and
196 deletions
+261
-196
configure
configure
+230
-159
configure.in
configure.in
+5
-5
plugins/alsa/aout_alsa.c
plugins/alsa/aout_alsa.c
+26
-32
No files found.
configure
View file @
313cf680
This diff is collapsed.
Click to expand it.
configure.in
View file @
313cf680
...
@@ -115,12 +115,12 @@ AC_ARG_ENABLE(glide,
...
@@ -115,12 +115,12 @@ AC_ARG_ENABLE(glide,
AC_ARG_ENABLE(gnome,
AC_ARG_ENABLE(gnome,
[ --enable-gnome Gnome support (default disabled)],
[ --enable-gnome Gnome support (default disabled)],
[if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi])
[if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi])
AC_ARG_ENABLE(alsa,
[ --enable-alsa Alsa sound drivers supprt (default disabled)],
[if test x$enable_alsa = xyes; then PLUGINS=${PLUGINS}"alsa "; fi])
AC_ARG_ENABLE(x11,
AC_ARG_ENABLE(x11,
[ --enable-x11 X11 support (default enabled)])
[ --enable-x11 X11 support (default enabled)],
if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
[if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi])
AC_ARG_ENABLE(alsa,
[ --enable-alsa Alsa sound drivers supprt (Only for linux) (default disabled)],
[if test x$enable_alsa = xyes; then AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test $have_alsa = true; then PLUGINS=${PLUGINS}"alsa "; fi; fi])
fi
fi
...
...
plugins/alsa/aout_alsa.c
View file @
313cf680
...
@@ -28,10 +28,7 @@
...
@@ -28,10 +28,7 @@
#include "defs.h"
#include "defs.h"
#include <errno.h>
/* ENOMEM */
#include <errno.h>
/* ENOMEM */
#include <fcntl.h>
/* open(), O_WRONLY */
#include <sys/ioctl.h>
/* ioctl() */
#include <string.h>
/* strerror() */
#include <string.h>
/* strerror() */
#include <unistd.h>
/* write(), close() */
#include <stdio.h>
/* "intf_msg.h" */
#include <stdio.h>
/* "intf_msg.h" */
#include <stdlib.h>
/* calloc(), malloc(), free() */
#include <stdlib.h>
/* calloc(), malloc(), free() */
...
@@ -67,8 +64,8 @@ typedef struct alsa_card_s
...
@@ -67,8 +64,8 @@ typedef struct alsa_card_s
typedef
struct
aout_sys_s
typedef
struct
aout_sys_s
{
{
snd_pcm_t
*
p_alsa_handle
;
snd_pcm_t
*
p_alsa_handle
;
alsa_device_t
*
p
_alsa_device
;
alsa_device_t
s
_alsa_device
;
alsa_card_t
*
p
_alsa_card
;
alsa_card_t
s
_alsa_card
;
snd_pcm_channel_params_t
s_alsa_channel_params
;
snd_pcm_channel_params_t
s_alsa_channel_params
;
snd_pcm_format_t
s_alsa_format
;
snd_pcm_format_t
s_alsa_format
;
}
aout_sys_t
;
}
aout_sys_t
;
...
@@ -88,22 +85,14 @@ int aout_AlsaOpen( aout_thread_t *p_aout )
...
@@ -88,22 +85,14 @@ int aout_AlsaOpen( aout_thread_t *p_aout )
p_aout
->
p_sys
=
malloc
(
sizeof
(
aout_sys_t
)
);
p_aout
->
p_sys
=
malloc
(
sizeof
(
aout_sys_t
)
);
if
(
p_aout
->
p_sys
==
NULL
)
if
(
p_aout
->
p_sys
==
NULL
)
{
{
intf_ErrMsg
(
"Alsa Plugin : Could not allocate memory
\n
"
);
intf_ErrMsg
(
"error: %s
\n
"
,
strerror
(
ENOMEM
)
);
intf_ErrMsg
(
"error: %s
\n
"
,
strerror
(
ENOMEM
)
);
return
(
1
);
return
(
1
);
}
}
p_aout
->
p_sys
->
p_alsa_device
=
malloc
(
sizeof
(
alsa_device_t
)
);
p_aout
->
p_sys
->
p_alsa_card
=
malloc
(
sizeof
(
alsa_device_t
)
);
if
(
(
p_aout
->
p_sys
->
p_alsa_device
==
NULL
)
||
(
p_aout
->
p_sys
->
p_alsa_card
==
NULL
)
)
{
intf_ErrMsg
(
"error: %s
\n
"
,
strerror
(
ENOMEM
)
);
return
(
1
);
}
/* Initialize */
/* Initialize */
p_aout
->
p_sys
->
p_alsa_device
->
i_num
=
0
;
p_aout
->
p_sys
->
s_alsa_device
.
i_num
=
0
;
p_aout
->
p_sys
->
p_alsa_card
->
i_num
=
0
;
p_aout
->
p_sys
->
s_alsa_card
.
i_num
=
0
;
/* FIXME : why not other format ? */
/* FIXME : why not other format ? */
p_aout
->
i_format
=
AOUT_FMT_S16_LE
;
p_aout
->
i_format
=
AOUT_FMT_S16_LE
;
/* FIXME : why always 2 channels ?*/
/* FIXME : why always 2 channels ?*/
...
@@ -112,18 +101,18 @@ int aout_AlsaOpen( aout_thread_t *p_aout )
...
@@ -112,18 +101,18 @@ int aout_AlsaOpen( aout_thread_t *p_aout )
/* Open device */
/* Open device */
if
(
(
i_open_returns
=
snd_pcm_open
(
&
(
p_aout
->
p_sys
->
p_alsa_handle
),
if
(
(
i_open_returns
=
snd_pcm_open
(
&
(
p_aout
->
p_sys
->
p_alsa_handle
),
p_aout
->
p_sys
->
p_alsa_card
->
i_num
,
p_aout
->
p_sys
->
s_alsa_card
.
i_num
,
p_aout
->
p_sys
->
p_alsa_device
->
i_num
,
p_aout
->
p_sys
->
s_alsa_device
.
i_num
,
SND_PCM_OPEN_PLAYBACK
)
)
)
SND_PCM_OPEN_PLAYBACK
)
)
)
{
{
intf_ErrMsg
(
"
could not open alsa device; error code :
%i
\n
"
,
intf_ErrMsg
(
"
Could not open alsa device; exit =
%i
\n
"
,
i_open_returns
);
i_open_returns
);
intf_ErrMsg
(
"This means : %s
\n\n
"
,
snd_strerror
(
i_open_returns
)
);
return
(
1
);
return
(
1
);
}
}
intf_DbgMsg
(
"Alsa plugin : Alsa device successfully opened
\n
"
);
return
(
0
);
return
(
0
);
intf_ErrMsg
(
"Alsa device open
\n\n
"
);
}
}
...
@@ -156,7 +145,6 @@ int aout_AlsaSetFormat ( aout_thread_t *p_aout )
...
@@ -156,7 +145,6 @@ int aout_AlsaSetFormat ( aout_thread_t *p_aout )
else
else
p_aout
->
p_sys
->
s_alsa_channel_params
.
format
.
format
=
p_aout
->
p_sys
->
s_alsa_channel_params
.
format
.
format
=
SND_PCM_SFMT_S16_BE
;
SND_PCM_SFMT_S16_BE
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
format
.
rate
=
p_aout
->
l_rate
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
format
.
rate
=
p_aout
->
l_rate
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
format
.
voices
=
p_aout
->
i_channels
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
format
.
voices
=
p_aout
->
i_channels
;
...
@@ -167,8 +155,10 @@ int aout_AlsaSetFormat ( aout_thread_t *p_aout )
...
@@ -167,8 +155,10 @@ int aout_AlsaSetFormat ( aout_thread_t *p_aout )
/* Buffer information . I have chosen the stream mode here
/* Buffer information . I have chosen the stream mode here
* instead of the block mode. I don't know whether i'm wrong
* instead of the block mode. I don't know whether i'm wrong
* but it seemed more logical */
* but it seemed more logical */
/* TODO : find the best value to put here. Probably depending
* on many parameters */
p_aout
->
p_sys
->
s_alsa_channel_params
.
buf
.
stream
.
queue_size
=
131072
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
buf
.
stream
.
queue_size
=
131072
;
/* Fill with silence */
p_aout
->
p_sys
->
s_alsa_channel_params
.
buf
.
stream
.
fill
=
SND_PCM_FILL_NONE
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
buf
.
stream
.
fill
=
SND_PCM_FILL_NONE
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
buf
.
stream
.
max_fill
=
0
;
p_aout
->
p_sys
->
s_alsa_channel_params
.
buf
.
stream
.
max_fill
=
0
;
...
@@ -256,6 +246,7 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit )
...
@@ -256,6 +246,7 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit )
int
i_alsa_get_status_returns
;
int
i_alsa_get_status_returns
;
memset
(
&
alsa_channel_status
,
0
,
sizeof
(
alsa_channel_status
));
memset
(
&
alsa_channel_status
,
0
,
sizeof
(
alsa_channel_status
));
i_alsa_get_status_returns
=
snd_pcm_channel_status
(
i_alsa_get_status_returns
=
snd_pcm_channel_status
(
p_aout
->
p_sys
->
p_alsa_handle
,
&
alsa_channel_status
);
p_aout
->
p_sys
->
p_alsa_handle
,
&
alsa_channel_status
);
...
@@ -273,20 +264,20 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit )
...
@@ -273,20 +264,20 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit )
case
SND_PCM_STATUS_NOTREADY
:
intf_ErrMsg
(
"Status NOT READY
\n
\n
"
);
case
SND_PCM_STATUS_NOTREADY
:
intf_ErrMsg
(
"Status NOT READY
\n
\n
"
);
break
;
break
;
case
SND_PCM_STATUS_UNDERRUN
:
{
case
SND_PCM_STATUS_UNDERRUN
:
{
int
i_
drain
_returns
;
int
i_
prepare
_returns
;
intf_ErrMsg
(
intf_ErrMsg
(
"Status UNDERRUN ...
draining
\n
\n
"
);
"Status UNDERRUN ...
reseting queue
\n
\n
"
);
i_
drain
_returns
=
i_
prepare
_returns
=
snd_pcm_playback_prepare
(
snd_pcm_playback_prepare
(
p_aout
->
p_sys
->
p_alsa_handle
);
p_aout
->
p_sys
->
p_alsa_handle
);
if
(
i_
drain
_returns
)
if
(
i_
prepare
_returns
)
{
{
intf_ErrMsg
(
intf_ErrMsg
(
"Error : could not flush : %i
\n
"
,
"Error : could not flush : %i
\n
"
,
i_
drain
_returns
);
i_
prepare
_returns
);
intf_ErrMsg
(
intf_ErrMsg
(
"This means : %s
\n
"
,
"This means : %s
\n
"
,
snd_strerror
(
i_
drain
_returns
));
snd_strerror
(
i_
prepare
_returns
));
}
}
break
;
break
;
}
}
...
@@ -325,4 +316,7 @@ void aout_AlsaClose ( aout_thread_t *p_aout )
...
@@ -325,4 +316,7 @@ void aout_AlsaClose ( aout_thread_t *p_aout )
intf_ErrMsg
(
"Error closing alsa device; exit=%i
\n
"
,
i_close_returns
);
intf_ErrMsg
(
"Error closing alsa device; exit=%i
\n
"
,
i_close_returns
);
intf_ErrMsg
(
"This means : %s
\n\n
"
,
snd_strerror
(
i_close_returns
)
);
intf_ErrMsg
(
"This means : %s
\n\n
"
,
snd_strerror
(
i_close_returns
)
);
}
}
free
(
p_aout
->
p_sys
);
intf_DbgMsg
(
"Alsa plugin : Alsa device closed
\n
"
);
}
}
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