Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Jean-Baptiste Kempf
vlc
Commits
6429b8ea
Commit
6429b8ea
authored
Apr 23, 2018
by
Romain Vimont
Committed by
Jean-Baptiste Kempf
Apr 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: replace aout_sys_t* by void*
See #17078 Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
4655ce5d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
162 additions
and
135 deletions
+162
-135
include/vlc_aout.h
include/vlc_aout.h
+1
-1
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+6
-3
modules/audio_output/auhal.c
modules/audio_output/auhal.c
+3
-3
modules/audio_output/directsound.c
modules/audio_output/directsound.c
+16
-10
modules/audio_output/file.c
modules/audio_output/file.c
+37
-33
modules/audio_output/mmdevice.c
modules/audio_output/mmdevice.c
+3
-2
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+1
-1
modules/audio_output/sndio.c
modules/audio_output/sndio.c
+2
-1
modules/audio_output/waveout.c
modules/audio_output/waveout.c
+93
-81
No files found.
include/vlc_aout.h
View file @
6429b8ea
...
...
@@ -116,7 +116,7 @@ struct audio_output
{
struct
vlc_common_members
obj
;
struct
aout_sys_t
*
sys
;
/**< Private data for callbacks */
void
*
sys
;
/**< Private data for callbacks */
int
(
*
start
)(
audio_output_t
*
,
audio_sample_format_t
*
fmt
);
/**< Starts a new stream (mandatory, cannot be NULL).
...
...
modules/audio_output/alsa.c
View file @
6429b8ea
...
...
@@ -694,7 +694,8 @@ static void Play (audio_output_t *aout, block_t *block)
*/
static
void
Pause
(
audio_output_t
*
aout
,
bool
pause
,
mtime_t
date
)
{
snd_pcm_t
*
pcm
=
aout
->
sys
->
pcm
;
aout_sys_t
*
p_sys
=
aout
->
sys
;
snd_pcm_t
*
pcm
=
p_sys
->
pcm
;
int
val
=
snd_pcm_pause
(
pcm
,
pause
);
if
(
unlikely
(
val
))
...
...
@@ -703,7 +704,8 @@ static void Pause (audio_output_t *aout, bool pause, mtime_t date)
static
void
PauseDummy
(
audio_output_t
*
aout
,
bool
pause
,
mtime_t
date
)
{
snd_pcm_t
*
pcm
=
aout
->
sys
->
pcm
;
aout_sys_t
*
p_sys
=
aout
->
sys
;
snd_pcm_t
*
pcm
=
p_sys
->
pcm
;
/* Stupid device cannot pause. Discard samples. */
if
(
pause
)
...
...
@@ -718,7 +720,8 @@ static void PauseDummy (audio_output_t *aout, bool pause, mtime_t date)
*/
static
void
Flush
(
audio_output_t
*
aout
,
bool
wait
)
{
snd_pcm_t
*
pcm
=
aout
->
sys
->
pcm
;
aout_sys_t
*
p_sys
=
aout
->
sys
;
snd_pcm_t
*
pcm
=
p_sys
->
pcm
;
if
(
wait
)
snd_pcm_drain
(
pcm
);
...
...
modules/audio_output/auhal.c
View file @
6429b8ea
...
...
@@ -636,7 +636,7 @@ DefaultDeviceChangedListener(AudioObjectID inObjectID, UInt32 inNumberAddresses,
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
if
(
!
p_
aout
->
sys
->
b_selected_dev_is_default
)
if
(
!
p_sys
->
b_selected_dev_is_default
)
return
noErr
;
AudioObjectID
defaultDeviceID
;
...
...
@@ -651,7 +651,7 @@ DefaultDeviceChangedListener(AudioObjectID inObjectID, UInt32 inNumberAddresses,
/* Default device is changed by the os to allow other apps to play sound
* while in digital mode. But this should not affect ourself. */
if
(
p_
aout
->
sys
->
b_digital
)
if
(
p_sys
->
b_digital
)
{
msg_Dbg
(
p_aout
,
"ignore, as digital mode is active"
);
return
noErr
;
...
...
@@ -659,7 +659,7 @@ DefaultDeviceChangedListener(AudioObjectID inObjectID, UInt32 inNumberAddresses,
vlc_mutex_lock
(
&
p_sys
->
selected_device_lock
);
/* Also ignore events which announce the same device id */
if
(
defaultDeviceID
!=
p_
aout
->
sys
->
i_selected_dev
)
if
(
defaultDeviceID
!=
p_sys
->
i_selected_dev
)
{
msg_Dbg
(
p_aout
,
"default device actually changed, resetting aout"
);
aout_RestartRequest
(
p_aout
,
AOUT_RESTART_OUTPUT
);
...
...
modules/audio_output/directsound.c
View file @
6429b8ea
...
...
@@ -183,7 +183,8 @@ static HRESULT StreamTimeGet( aout_stream_t *s, mtime_t *delay )
static
int
OutputTimeGet
(
audio_output_t
*
aout
,
mtime_t
*
delay
)
{
return
(
TimeGet
(
&
aout
->
sys
->
s
,
delay
)
==
DS_OK
)
?
0
:
-
1
;
aout_sys_t
*
sys
=
aout
->
sys
;
return
(
TimeGet
(
&
sys
->
s
,
delay
)
==
DS_OK
)
?
0
:
-
1
;
}
/**
...
...
@@ -304,7 +305,8 @@ static HRESULT StreamPlay( aout_stream_t *s, block_t *block )
static
void
OutputPlay
(
audio_output_t
*
aout
,
block_t
*
block
)
{
Play
(
VLC_OBJECT
(
aout
),
&
aout
->
sys
->
s
,
block
);
aout_sys_t
*
sys
=
aout
->
sys
;
Play
(
VLC_OBJECT
(
aout
),
&
sys
->
s
,
block
);
}
static
HRESULT
Pause
(
aout_stream_sys_t
*
sys
,
bool
pause
)
...
...
@@ -333,7 +335,8 @@ static HRESULT StreamPause( aout_stream_t *s, bool pause )
static
void
OutputPause
(
audio_output_t
*
aout
,
bool
pause
,
mtime_t
date
)
{
Pause
(
&
aout
->
sys
->
s
,
pause
);
aout_sys_t
*
sys
=
aout
->
sys
;
Pause
(
&
sys
->
s
,
pause
);
(
void
)
date
;
}
...
...
@@ -359,8 +362,8 @@ static HRESULT StreamFlush( aout_stream_t *s )
static
void
OutputFlush
(
audio_output_t
*
aout
,
bool
drain
)
{
aout_s
tream_sys_t
*
sys
=
&
aout
->
sys
->
s
;
Flush
(
sy
s
,
drain
);
aout_s
ys_t
*
sys
=
aout
->
sy
s
;
Flush
(
&
sys
->
s
,
drain
);
}
/**
...
...
@@ -585,7 +588,8 @@ static HRESULT StreamStop( aout_stream_t *s )
static
void
OutputStop
(
audio_output_t
*
aout
)
{
msg_Dbg
(
aout
,
"closing audio device"
);
Stop
(
&
aout
->
sys
->
s
);
aout_sys_t
*
sys
=
aout
->
sys
;
Stop
(
&
sys
->
s
);
}
static
HRESULT
Start
(
vlc_object_t
*
obj
,
aout_stream_sys_t
*
sys
,
...
...
@@ -964,13 +968,14 @@ static int OutputStart( audio_output_t *p_aout,
return
-
1
;
}
HRESULT
hr
=
Start
(
VLC_OBJECT
(
p_aout
),
&
p_aout
->
sys
->
s
,
fmt
);
aout_sys_t
*
sys
=
p_aout
->
sys
;
HRESULT
hr
=
Start
(
VLC_OBJECT
(
p_aout
),
&
sys
->
s
,
fmt
);
if
(
FAILED
(
hr
)
)
return
-
1
;
/* Force volume update */
VolumeSet
(
p_aout
,
p_aout
->
sys
->
volume
.
volume
);
MuteSet
(
p_aout
,
p_aout
->
sys
->
volume
.
mute
);
VolumeSet
(
p_aout
,
sys
->
volume
.
volume
);
MuteSet
(
p_aout
,
sys
->
volume
.
mute
);
/* then launch the notification thread */
p_aout
->
time_get
=
OutputTimeGet
;
...
...
@@ -1099,7 +1104,8 @@ static void Close(vlc_object_t *obj)
static
void
*
PlayedDataEraser
(
void
*
data
)
{
const
audio_output_t
*
aout
=
(
audio_output_t
*
)
data
;
aout_stream_sys_t
*
p_sys
=
&
aout
->
sys
->
s
;
aout_sys_t
*
aout_sys
=
aout
->
sys
;
aout_stream_sys_t
*
p_sys
=
&
aout_sys
->
s
;
void
*
p_write_position
,
*
p_wrap_around
;
unsigned
long
l_bytes1
,
l_bytes2
;
DWORD
i_read
;
...
...
modules/audio_output/file.c
View file @
6429b8ea
...
...
@@ -146,19 +146,20 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
}
/* Allocate structure */
p_aout
->
sys
=
malloc
(
sizeof
(
aout_sys_t
)
);
if
(
p_
aout
->
sys
==
NULL
)
aout_sys_t
*
p_
sys
=
malloc
(
sizeof
(
aout_sys_t
)
);
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
p_aout
->
sys
=
p_sys
;
if
(
!
strcmp
(
psz_name
,
"-"
)
)
p_
aout
->
sys
->
p_file
=
stdout
;
p_sys
->
p_file
=
stdout
;
else
p_
aout
->
sys
->
p_file
=
vlc_fopen
(
psz_name
,
"wb"
);
p_sys
->
p_file
=
vlc_fopen
(
psz_name
,
"wb"
);
free
(
psz_name
);
if
(
p_
aout
->
sys
->
p_file
==
NULL
)
if
(
p_sys
->
p_file
==
NULL
)
{
free
(
p_
aout
->
sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -171,9 +172,9 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
psz_format
=
var_InheritString
(
p_aout
,
"audiofile-format"
);
if
(
!
psz_format
)
/* FIXME */
{
if
(
p_
aout
->
sys
->
p_file
!=
stdout
)
fclose
(
p_
aout
->
sys
->
p_file
);
free
(
p_
aout
->
sys
);
if
(
p_sys
->
p_file
!=
stdout
)
fclose
(
p_sys
->
p_file
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -190,9 +191,9 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
{
msg_Err
(
p_aout
,
"cannot understand the format string (%s)"
,
psz_format
);
if
(
p_
aout
->
sys
->
p_file
!=
stdout
)
fclose
(
p_
aout
->
sys
->
p_file
);
free
(
p_
aout
->
sys
);
if
(
p_sys
->
p_file
!=
stdout
)
fclose
(
p_sys
->
p_file
);
free
(
p_sys
);
free
(
psz_format
);
return
VLC_EGENERIC
;
}
...
...
@@ -214,11 +215,11 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
fmt
->
channel_type
=
AUDIO_CHANNEL_TYPE_BITMAP
;
/* WAV header */
p_
aout
->
sys
->
b_add_wav_header
=
var_InheritBool
(
p_aout
,
"audiofile-wav"
);
if
(
p_
aout
->
sys
->
b_add_wav_header
)
p_sys
->
b_add_wav_header
=
var_InheritBool
(
p_aout
,
"audiofile-wav"
);
if
(
p_sys
->
b_add_wav_header
)
{
/* Write wave header */
WAVEHEADER
*
wh
=
&
p_
aout
->
sys
->
waveh
;
WAVEHEADER
*
wh
=
&
p_sys
->
waveh
;
memset
(
wh
,
0
,
sizeof
(
*
wh
)
);
...
...
@@ -264,7 +265,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
SetDWLE
(
&
wh
->
BytesPerSec
,
wh
->
BytesPerSec
);
if
(
fwrite
(
wh
,
sizeof
(
WAVEHEADER
),
1
,
p_
aout
->
sys
->
p_file
)
!=
1
)
p_sys
->
p_file
)
!=
1
)
{
msg_Err
(
p_aout
,
"write error: %s"
,
vlc_strerror_c
(
errno
)
);
}
...
...
@@ -279,35 +280,36 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
static
void
Stop
(
audio_output_t
*
p_aout
)
{
msg_Dbg
(
p_aout
,
"closing audio file"
);
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
if
(
p_
aout
->
sys
->
b_add_wav_header
)
if
(
p_sys
->
b_add_wav_header
)
{
/* Update Wave Header */
p_
aout
->
sys
->
waveh
.
Length
=
p_
aout
->
sys
->
waveh
.
DataLength
+
sizeof
(
WAVEHEADER
)
-
4
;
p_sys
->
waveh
.
Length
=
p_sys
->
waveh
.
DataLength
+
sizeof
(
WAVEHEADER
)
-
4
;
/* Write Wave Header */
if
(
fseek
(
p_
aout
->
sys
->
p_file
,
0
,
SEEK_SET
)
)
if
(
fseek
(
p_sys
->
p_file
,
0
,
SEEK_SET
)
)
{
msg_Err
(
p_aout
,
"seek error: %s"
,
vlc_strerror_c
(
errno
)
);
}
/* Header -> little endian format */
SetDWLE
(
&
p_
aout
->
sys
->
waveh
.
Length
,
p_
aout
->
sys
->
waveh
.
Length
);
SetDWLE
(
&
p_
aout
->
sys
->
waveh
.
DataLength
,
p_
aout
->
sys
->
waveh
.
DataLength
);
SetDWLE
(
&
p_sys
->
waveh
.
Length
,
p_sys
->
waveh
.
Length
);
SetDWLE
(
&
p_sys
->
waveh
.
DataLength
,
p_sys
->
waveh
.
DataLength
);
if
(
fwrite
(
&
p_
aout
->
sys
->
waveh
,
sizeof
(
WAVEHEADER
),
1
,
p_
aout
->
sys
->
p_file
)
!=
1
)
if
(
fwrite
(
&
p_sys
->
waveh
,
sizeof
(
WAVEHEADER
),
1
,
p_sys
->
p_file
)
!=
1
)
{
msg_Err
(
p_aout
,
"write error: %s"
,
vlc_strerror_c
(
errno
)
);
}
}
if
(
p_
aout
->
sys
->
p_file
!=
stdout
)
fclose
(
p_
aout
->
sys
->
p_file
);
free
(
p_
aout
->
sys
);
if
(
p_sys
->
p_file
!=
stdout
)
fclose
(
p_sys
->
p_file
);
free
(
p_sys
);
}
/*****************************************************************************
...
...
@@ -315,16 +317,17 @@ static void Stop( audio_output_t *p_aout )
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
p_buffer
)
{
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
if
(
fwrite
(
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
,
1
,
p_
aout
->
sys
->
p_file
)
!=
1
)
p_sys
->
p_file
)
!=
1
)
{
msg_Err
(
p_aout
,
"write error: %s"
,
vlc_strerror_c
(
errno
)
);
}
if
(
p_
aout
->
sys
->
b_add_wav_header
)
if
(
p_sys
->
b_add_wav_header
)
{
/* Update Wave Header */
p_
aout
->
sys
->
waveh
.
DataLength
+=
p_buffer
->
i_buffer
;
p_sys
->
waveh
.
DataLength
+=
p_buffer
->
i_buffer
;
}
block_Release
(
p_buffer
);
...
...
@@ -332,7 +335,8 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer )
static
void
Flush
(
audio_output_t
*
aout
,
bool
wait
)
{
if
(
fflush
(
aout
->
sys
->
p_file
)
)
aout_sys_t
*
p_sys
=
aout
->
sys
;
if
(
fflush
(
p_sys
->
p_file
)
)
msg_Err
(
aout
,
"flush error: %s"
,
vlc_strerror_c
(
errno
)
);
(
void
)
wait
;
}
...
...
modules/audio_output/mmdevice.c
View file @
6429b8ea
...
...
@@ -776,9 +776,10 @@ static int DeviceRestartLocked(audio_output_t *aout)
static
int
DeviceSelect
(
audio_output_t
*
aout
,
const
char
*
id
)
{
EnterCriticalSection
(
&
aout
->
sys
->
lock
);
aout_sys_t
*
sys
=
aout
->
sys
;
EnterCriticalSection
(
&
sys
->
lock
);
int
ret
=
DeviceSelectLocked
(
aout
,
id
);
LeaveCriticalSection
(
&
aout
->
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
return
ret
;
}
...
...
modules/audio_output/pulse.c
View file @
6429b8ea
...
...
@@ -175,7 +175,7 @@ static void stream_start_now(pa_stream *s, audio_output_t *aout)
{
pa_operation
*
op
;
assert
(
aout
->
sys
->
trigger
==
NULL
);
assert
(
((
aout_sys_t
*
)
aout
->
sys
)
->
trigger
==
NULL
);
op
=
pa_stream_cork
(
s
,
0
,
NULL
,
NULL
);
if
(
op
!=
NULL
)
...
...
modules/audio_output/sndio.c
View file @
6429b8ea
...
...
@@ -253,12 +253,13 @@ static void Flush (audio_output_t *aout, bool wait)
static
void
VolumeChanged
(
void
*
arg
,
unsigned
volume
)
{
audio_output_t
*
aout
=
arg
;
aout_sys_t
*
p_sys
=
aout
->
sys
;
float
fvol
=
(
float
)
volume
/
(
float
)
SIO_MAXVOL
;
aout_VolumeReport
(
aout
,
fvol
);
aout_MuteReport
(
aout
,
volume
==
0
);
if
(
volume
)
/* remember last non-zero volume to unmute later */
aout
->
sys
->
volume
=
volume
;
p_
sys
->
volume
=
volume
;
}
static
int
VolumeSet
(
audio_output_t
*
aout
,
float
fvol
)
...
...
modules/audio_output/waveout.c
View file @
6429b8ea
...
...
@@ -176,8 +176,10 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
p_aout
->
pause
=
WaveOutPause
;
p_aout
->
flush
=
WaveOutFlush
;
aout_sys_t
*
sys
=
p_aout
->
sys
;
/* Default behaviour is to use software gain */
p_aout
->
sys
->
b_soft
=
true
;
sys
->
b_soft
=
true
;
char
*
dev
=
var_GetNonEmptyString
(
p_aout
,
"waveout-audio-device"
);
uint32_t
devid
=
findDeviceID
(
dev
);
...
...
@@ -217,8 +219,8 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
/* Calculate the frame size in bytes */
fmt
->
i_bytes_per_frame
=
AOUT_SPDIF_SIZE
;
fmt
->
i_frame_length
=
A52_FRAME_NB
;
p_aout
->
sys
->
i_buffer_size
=
fmt
->
i_bytes_per_frame
;
p_aout
->
sys
->
b_spdif
=
true
;
sys
->
i_buffer_size
=
fmt
->
i_bytes_per_frame
;
sys
->
b_spdif
=
true
;
}
else
...
...
@@ -290,42 +292,42 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
/* Calculate the frame size in bytes */
aout_FormatPrepare
(
fmt
);
p_aout
->
sys
->
i_buffer_size
=
FRAME_SIZE
*
fmt
->
i_bytes_per_frame
;
sys
->
i_buffer_size
=
FRAME_SIZE
*
fmt
->
i_bytes_per_frame
;
if
(
waveoutcaps
.
dwSupport
&
WAVECAPS_VOLUME
)
{
aout_GainRequest
(
p_aout
,
1
.
0
f
);
p_aout
->
sys
->
b_soft
=
false
;
sys
->
b_soft
=
false
;
}
WaveoutMuteSet
(
p_aout
,
p_aout
->
sys
->
b_mute
);
WaveoutMuteSet
(
p_aout
,
sys
->
b_mute
);
p_aout
->
sys
->
b_spdif
=
false
;
sys
->
b_spdif
=
false
;
}
p_aout
->
sys
->
i_rate
=
fmt
->
i_rate
;
sys
->
i_rate
=
fmt
->
i_rate
;
waveOutReset
(
p_aout
->
sys
->
h_waveout
);
waveOutReset
(
sys
->
h_waveout
);
/* Allocate silence buffer */
p_aout
->
sys
->
p_silence_buffer
=
malloc
(
p_aout
->
sys
->
i_buffer_size
);
if
(
p_aout
->
sys
->
p_silence_buffer
==
NULL
)
sys
->
p_silence_buffer
=
malloc
(
sys
->
i_buffer_size
);
if
(
sys
->
p_silence_buffer
==
NULL
)
{
msg_Err
(
p_aout
,
"Couldn't alloc silence buffer... aborting"
);
return
VLC_ENOMEM
;
}
p_aout
->
sys
->
i_repeat_counter
=
0
;
sys
->
i_repeat_counter
=
0
;
/* Zero the buffer. WinCE doesn't have calloc(). */
memset
(
p_aout
->
sys
->
p_silence_buffer
,
0
,
p_aout
->
sys
->
i_buffer_size
);
memset
(
sys
->
p_silence_buffer
,
0
,
sys
->
i_buffer_size
);
/* Now we need to setup our waveOut play notification structure */
p_aout
->
sys
->
i_frames
=
0
;
p_aout
->
sys
->
i_played_length
=
0
;
p_aout
->
sys
->
p_free_list
=
NULL
;
sys
->
i_frames
=
0
;
sys
->
i_played_length
=
0
;
sys
->
p_free_list
=
NULL
;
fmt
->
channel_type
=
AUDIO_CHANNEL_TYPE_BITMAP
;
...
...
@@ -340,6 +342,8 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
block
)
{
aout_sys_t
*
sys
=
p_aout
->
sys
;
struct
lkwavehdr
*
p_waveheader
=
(
struct
lkwavehdr
*
)
malloc
(
sizeof
(
struct
lkwavehdr
));
if
(
!
p_waveheader
)
...
...
@@ -352,27 +356,27 @@ static void Play( audio_output_t *p_aout, block_t *block )
p_waveheader
->
p_next
=
NULL
;
if
(
block
&&
p_aout
->
sys
->
chans_to_reorder
)
if
(
block
&&
sys
->
chans_to_reorder
)
{
aout_ChannelReorder
(
block
->
p_buffer
,
block
->
i_buffer
,
p_aout
->
sys
->
waveformat
.
Format
.
nChannels
,
p_aout
->
sys
->
chan_table
,
p_aout
->
sys
->
format
);
sys
->
waveformat
.
Format
.
nChannels
,
sys
->
chan_table
,
sys
->
format
);
}
while
(
PlayWaveOut
(
p_aout
,
p_aout
->
sys
->
h_waveout
,
p_waveheader
,
block
,
p_aout
->
sys
->
b_spdif
)
!=
VLC_SUCCESS
)
while
(
PlayWaveOut
(
p_aout
,
sys
->
h_waveout
,
p_waveheader
,
block
,
sys
->
b_spdif
)
!=
VLC_SUCCESS
)
{
msg_Warn
(
p_aout
,
"Couln't write frame... sleeping"
);
msleep
(
block
->
i_length
);
}
WaveOutClean
(
p_aout
->
sys
);
WaveOutClean
(
sys
);
WaveoutPollVolume
(
p_aout
);
vlc_mutex_lock
(
&
p_aout
->
sys
->
lock
);
p_aout
->
sys
->
i_frames
++
;
p_aout
->
sys
->
i_played_length
+=
block
->
i_length
;
vlc_mutex_unlock
(
&
p_aout
->
sys
->
lock
);
vlc_mutex_lock
(
&
sys
->
lock
);
sys
->
i_frames
++
;
sys
->
i_played_length
+=
block
->
i_length
;
vlc_mutex_unlock
(
&
sys
->
lock
);
}
/*****************************************************************************
...
...
@@ -408,7 +412,7 @@ static void Stop( audio_output_t *p_aout )
/* wait for the frames to be queued in cleaning list */
WaveOutFlush
(
p_aout
,
true
);
WaveOutClean
(
p_
aout
->
sys
);
WaveOutClean
(
p_sys
);
/* now we can Close the device */
if
(
waveOutClose
(
p_sys
->
h_waveout
)
!=
MMSYSERR_NOERROR
)
...
...
@@ -417,7 +421,7 @@ static void Stop( audio_output_t *p_aout )
}
free
(
p_sys
->
p_silence_buffer
);
p_
aout
->
sys
->
i_played_length
=
0
;
p_sys
->
i_played_length
=
0
;
p_sys
->
b_soft
=
true
;
}
...
...
@@ -429,10 +433,11 @@ static int OpenWaveOut( audio_output_t *p_aout, uint32_t i_device_id, int i_form
bool
b_probe
)
{
MMRESULT
result
;
aout_sys_t
*
sys
=
p_aout
->
sys
;
/* Set sound format */
#define waveformat
p_aout->
sys->waveformat
#define waveformat sys->waveformat
waveformat
.
dwChannelMask
=
0
;
for
(
unsigned
i
=
0
;
pi_vlc_chan_order_wg4
[
i
];
i
++
)
...
...
@@ -513,7 +518,7 @@ static int OpenWaveOut( audio_output_t *p_aout, uint32_t i_device_id, int i_form
}
/* Open the device */
result
=
waveOutOpen
(
&
p_aout
->
sys
->
h_waveout
,
i_device_id
,
result
=
waveOutOpen
(
&
sys
->
h_waveout
,
i_device_id
,
(
WAVEFORMATEX
*
)
&
waveformat
,
(
DWORD_PTR
)
WaveOutCallback
,
(
DWORD_PTR
)
p_aout
,
CALLBACK_FUNCTION
|
(
b_probe
?
WAVE_FORMAT_QUERY
:
0
)
);
...
...
@@ -533,13 +538,13 @@ static int OpenWaveOut( audio_output_t *p_aout, uint32_t i_device_id, int i_form
return
VLC_EGENERIC
;
}
p_aout
->
sys
->
chans_to_reorder
=
sys
->
chans_to_reorder
=
aout_CheckChannelReorder
(
pi_channels_in
,
pi_channels_out
,
waveformat
.
dwChannelMask
,
p_aout
->
sys
->
chan_table
);
if
(
p_aout
->
sys
->
chans_to_reorder
)
sys
->
chan_table
);
if
(
sys
->
chans_to_reorder
)
msg_Dbg
(
p_aout
,
"channel reordering needed"
);
p_aout
->
sys
->
format
=
i_format
;
sys
->
format
=
i_format
;
return
VLC_SUCCESS
;
...
...
@@ -587,6 +592,7 @@ static int PlayWaveOut( audio_output_t *p_aout, HWAVEOUT h_waveout,
struct
lkwavehdr
*
p_waveheader
,
block_t
*
p_buffer
,
bool
b_spdif
)
{
MMRESULT
result
;
aout_sys_t
*
sys
=
p_aout
->
sys
;
/* Prepare the buffer */
if
(
p_buffer
!=
NULL
)
...
...
@@ -601,24 +607,24 @@ static int PlayWaveOut( audio_output_t *p_aout, HWAVEOUT h_waveout,
*/
if
(
b_spdif
)
{
memcpy
(
p_aout
->
sys
->
p_silence_buffer
,
memcpy
(
sys
->
p_silence_buffer
,
p_buffer
->
p_buffer
,
p_aout
->
sys
->
i_buffer_size
);
p_aout
->
sys
->
i_repeat_counter
=
2
;
sys
->
i_buffer_size
);
sys
->
i_repeat_counter
=
2
;
}
}
else
{
/* Use silence buffer instead */
if
(
p_aout
->
sys
->
i_repeat_counter
)
if
(
sys
->
i_repeat_counter
)
{
p_aout
->
sys
->
i_repeat_counter
--
;
if
(
!
p_aout
->
sys
->
i_repeat_counter
)
sys
->
i_repeat_counter
--
;
if
(
!
sys
->
i_repeat_counter
)
{
memset
(
p_aout
->
sys
->
p_silence_buffer
,
0x00
,
p_aout
->
sys
->
i_buffer_size
);
memset
(
sys
->
p_silence_buffer
,
0x00
,
sys
->
i_buffer_size
);
}
}
p_waveheader
->
hdr
.
lpData
=
(
LPSTR
)
p_aout
->
sys
->
p_silence_buffer
;
p_waveheader
->
hdr
.
dwBufferLength
=
p_aout
->
sys
->
i_buffer_size
;
p_waveheader
->
hdr
.
lpData
=
(
LPSTR
)
sys
->
p_silence_buffer
;
p_waveheader
->
hdr
.
dwBufferLength
=
sys
->
i_buffer_size
;
}
p_waveheader
->
hdr
.
dwUser
=
p_buffer
?
(
DWORD_PTR
)
p_buffer
:
(
DWORD_PTR
)
1
;
...
...
@@ -651,17 +657,17 @@ static void CALLBACK WaveOutCallback( HWAVEOUT h_waveout, UINT uMsg,
{
(
void
)
h_waveout
;
(
void
)
dwParam2
;
a
udio_output_t
*
p_aout
=
(
audio_output_t
*
)
_p_aout
;
a
out_sys_t
*
sys
=
((
audio_output_t
*
)
_p_aout
)
->
sys
;
struct
lkwavehdr
*
p_waveheader
=
(
struct
lkwavehdr
*
)
dwParam1
;
if
(
uMsg
!=
WOM_DONE
)
return
;
vlc_mutex_lock
(
&
p_aout
->
sys
->
lock
);
p_waveheader
->
p_next
=
p_aout
->
sys
->
p_free_list
;
p_aout
->
sys
->
p_free_list
=
p_waveheader
;
p_aout
->
sys
->
i_frames
--
;
vlc_cond_broadcast
(
&
p_aout
->
sys
->
cond
);
vlc_mutex_unlock
(
&
p_aout
->
sys
->
lock
);
vlc_mutex_lock
(
&
sys
->
lock
);
p_waveheader
->
p_next
=
sys
->
p_free_list
;
sys
->
p_free_list
=
p_waveheader
;
sys
->
i_frames
--
;
vlc_cond_broadcast
(
&
sys
->
cond
);
vlc_mutex_unlock
(
&
sys
->
lock
);
}
static
void
WaveOutClean
(
aout_sys_t
*
p_sys
)
...
...
@@ -843,40 +849,43 @@ static int WaveOutTimeGet(audio_output_t * p_aout, mtime_t *delay)
{
MMTIME
mmtime
;
mmtime
.
wType
=
TIME_SAMPLES
;
aout_sys_t
*
sys
=
p_aout
->
sys
;
if
(
!
p_aout
->
sys
->
i_frames
)
if
(
!
sys
->
i_frames
)
return
-
1
;
if
(
waveOutGetPosition
(
p_aout
->
sys
->
h_waveout
,
&
mmtime
,
sizeof
(
MMTIME
)
)
if
(
waveOutGetPosition
(
sys
->
h_waveout
,
&
mmtime
,
sizeof
(
MMTIME
)
)
!=
MMSYSERR_NOERROR
)
{
msg_Err
(
p_aout
,
"waveOutGetPosition failed"
);
return
-
1
;
}
mtime_t
i_pos
=
(
mtime_t
)
mmtime
.
u
.
sample
*
CLOCK_FREQ
/
p_aout
->
sys
->
i_rate
;
*
delay
=
p_aout
->
sys
->
i_played_length
-
i_pos
;
mtime_t
i_pos
=
(
mtime_t
)
mmtime
.
u
.
sample
*
CLOCK_FREQ
/
sys
->
i_rate
;
*
delay
=
sys
->
i_played_length
-
i_pos
;
return
0
;
}
static
void
WaveOutFlush
(
audio_output_t
*
p_aout
,
bool
wait
)
{
MMRESULT
res
;