Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a3926236
Commit
a3926236
authored
Dec 06, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wasapi: cosmetic, rename api to stream
parent
a0442893
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
78 deletions
+80
-78
modules/audio_output/mmdevice.c
modules/audio_output/mmdevice.c
+14
-14
modules/audio_output/mmdevice.h
modules/audio_output/mmdevice.h
+19
-18
modules/audio_output/wasapi.c
modules/audio_output/wasapi.c
+47
-46
No files found.
modules/audio_output/mmdevice.c
View file @
a3926236
...
@@ -72,7 +72,7 @@ static void LeaveMTA(void)
...
@@ -72,7 +72,7 @@ static void LeaveMTA(void)
struct
aout_sys_t
struct
aout_sys_t
{
{
audio_output_t
*
aout
;
audio_output_t
*
aout
;
aout_
api_t
*
api
;
/**< Audio output back-end API
*/
aout_
stream_t
*
stream
;
/**< Underlying audio output stream
*/
IMMDeviceEnumerator
*
it
;
/**< Device enumerator, NULL when exiting */
IMMDeviceEnumerator
*
it
;
/**< Device enumerator, NULL when exiting */
/*TODO: IMMNotificationClient*/
/*TODO: IMMNotificationClient*/
...
@@ -112,7 +112,7 @@ static int TimeGet(audio_output_t *aout, mtime_t *restrict delay)
...
@@ -112,7 +112,7 @@ static int TimeGet(audio_output_t *aout, mtime_t *restrict delay)
EnterMTA
();
EnterMTA
();
EnterCriticalSection
(
&
sys
->
lock
);
EnterCriticalSection
(
&
sys
->
lock
);
hr
=
aout_
api_TimeGet
(
sys
->
api
,
delay
);
hr
=
aout_
stream_TimeGet
(
sys
->
stream
,
delay
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveMTA
();
LeaveMTA
();
...
@@ -126,7 +126,7 @@ static void Play(audio_output_t *aout, block_t *block)
...
@@ -126,7 +126,7 @@ static void Play(audio_output_t *aout, block_t *block)
EnterMTA
();
EnterMTA
();
EnterCriticalSection
(
&
sys
->
lock
);
EnterCriticalSection
(
&
sys
->
lock
);
hr
=
aout_
api_Play
(
sys
->
api
,
block
);
hr
=
aout_
stream_Play
(
sys
->
stream
,
block
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveMTA
();
LeaveMTA
();
...
@@ -140,7 +140,7 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date)
...
@@ -140,7 +140,7 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date)
EnterMTA
();
EnterMTA
();
EnterCriticalSection
(
&
sys
->
lock
);
EnterCriticalSection
(
&
sys
->
lock
);
hr
=
aout_
api_Pause
(
sys
->
api
,
paused
);
hr
=
aout_
stream_Pause
(
sys
->
stream
,
paused
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveMTA
();
LeaveMTA
();
...
@@ -158,11 +158,11 @@ static void Flush(audio_output_t *aout, bool wait)
...
@@ -158,11 +158,11 @@ static void Flush(audio_output_t *aout, bool wait)
if
(
wait
)
if
(
wait
)
{
/* Loosy drain emulation */
{
/* Loosy drain emulation */
if
(
FAILED
(
aout_
api_TimeGet
(
sys
->
api
,
&
delay
)))
if
(
FAILED
(
aout_
stream_TimeGet
(
sys
->
stream
,
&
delay
)))
delay
=
VLC_TS_INVALID
;
delay
=
VLC_TS_INVALID
;
}
}
else
else
aout_
api_Flush
(
sys
->
api
);
aout_
stream_Flush
(
sys
->
stream
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveMTA
();
LeaveMTA
();
...
@@ -237,7 +237,7 @@ static int MuteSet(audio_output_t *aout, bool mute)
...
@@ -237,7 +237,7 @@ static int MuteSet(audio_output_t *aout, bool mute)
static
int
DeviceChanged
(
vlc_object_t
*
obj
,
const
char
*
varname
,
static
int
DeviceChanged
(
vlc_object_t
*
obj
,
const
char
*
varname
,
vlc_value_t
prev
,
vlc_value_t
cur
,
void
*
data
)
vlc_value_t
prev
,
vlc_value_t
cur
,
void
*
data
)
{
{
/* FIXME: This does not work. sys->dev,
sys->manager and sys->api
must be
/* FIXME: This does not work. sys->dev,
->manager and ->stream
must be
* recreated. Those pointers are protected by the aout lock, which
* recreated. Those pointers are protected by the aout lock, which
* serializes accesses to the audio_output_t. Unfortunately,
* serializes accesses to the audio_output_t. Unfortunately,
* aout lock cannot be taken from a variable callback.
* aout lock cannot be taken from a variable callback.
...
@@ -615,32 +615,32 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
...
@@ -615,32 +615,32 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
{
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
assert
(
sys
->
api
==
NULL
);
assert
(
sys
->
stream
==
NULL
);
if
(
sys
->
dev
==
NULL
)
if
(
sys
->
dev
==
NULL
)
return
-
1
;
return
-
1
;
EnterMTA
();
EnterMTA
();
EnterCriticalSection
(
&
sys
->
lock
);
EnterCriticalSection
(
&
sys
->
lock
);
sys
->
api
=
aout_api
_Start
(
aout
,
fmt
,
sys
->
dev
,
&
GUID_VLC_AUD_OUT
);
sys
->
stream
=
aout_stream
_Start
(
aout
,
fmt
,
sys
->
dev
,
&
GUID_VLC_AUD_OUT
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveMTA
();
LeaveMTA
();
return
(
sys
->
api
!=
NULL
)
?
0
:
-
1
;
return
(
sys
->
stream
!=
NULL
)
?
0
:
-
1
;
}
}
static
void
Stop
(
audio_output_t
*
aout
)
static
void
Stop
(
audio_output_t
*
aout
)
{
{
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
assert
(
sys
->
api
!=
NULL
);
assert
(
sys
->
stream
!=
NULL
);
EnterMTA
();
EnterMTA
();
EnterCriticalSection
(
&
sys
->
lock
);
EnterCriticalSection
(
&
sys
->
lock
);
aout_
api_Stop
(
sys
->
api
);
aout_
stream_Stop
(
sys
->
stream
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveCriticalSection
(
&
sys
->
lock
);
LeaveMTA
();
LeaveMTA
();
sys
->
api
=
NULL
;
sys
->
stream
=
NULL
;
}
}
static
int
Open
(
vlc_object_t
*
obj
)
static
int
Open
(
vlc_object_t
*
obj
)
...
@@ -659,7 +659,7 @@ static int Open(vlc_object_t *obj)
...
@@ -659,7 +659,7 @@ static int Open(vlc_object_t *obj)
aout
->
sys
=
sys
;
aout
->
sys
=
sys
;
sys
->
aout
=
aout
;
sys
->
aout
=
aout
;
sys
->
api
=
NULL
;
sys
->
stream
=
NULL
;
sys
->
it
=
NULL
;
sys
->
it
=
NULL
;
sys
->
session_events
.
lpVtbl
=
&
vlc_AudioSessionEvents
;
sys
->
session_events
.
lpVtbl
=
&
vlc_AudioSessionEvents
;
sys
->
refs
=
1
;
sys
->
refs
=
1
;
...
...
modules/audio_output/mmdevice.h
View file @
a3926236
...
@@ -21,20 +21,20 @@
...
@@ -21,20 +21,20 @@
#ifndef VLC_AOUT_MMDEVICE_H
#ifndef VLC_AOUT_MMDEVICE_H
# define VLC_AOUT_MMDEVICE_H 1
# define VLC_AOUT_MMDEVICE_H 1
typedef
struct
aout_
api
aout_api
_t
;
typedef
struct
aout_
stream
aout_stream
_t
;
/**
/**
* Audio output simplified API for Windows
* Audio output simplified API for Windows
*/
*/
struct
aout_
api
struct
aout_
stream
{
{
VLC_COMMON_MEMBERS
VLC_COMMON_MEMBERS
void
*
sys
;
void
*
sys
;
HRESULT
(
*
time_get
)(
aout_
api
_t
*
,
mtime_t
*
);
HRESULT
(
*
time_get
)(
aout_
stream
_t
*
,
mtime_t
*
);
HRESULT
(
*
play
)(
aout_
api
_t
*
,
block_t
*
);
HRESULT
(
*
play
)(
aout_
stream
_t
*
,
block_t
*
);
HRESULT
(
*
pause
)(
aout_
api
_t
*
,
bool
);
HRESULT
(
*
pause
)(
aout_
stream
_t
*
,
bool
);
HRESULT
(
*
flush
)(
aout_
api
_t
*
);
HRESULT
(
*
flush
)(
aout_
stream
_t
*
);
};
};
/**
/**
...
@@ -44,32 +44,33 @@ struct aout_api
...
@@ -44,32 +44,33 @@ struct aout_api
* \param dev audio output device
* \param dev audio output device
* \param sid audio output session GUID [IN]
* \param sid audio output session GUID [IN]
*/
*/
aout_api_t
*
aout_api_Start
(
vlc_object_t
*
parent
,
audio_sample_format_t
*
fmt
,
aout_stream_t
*
aout_stream_Start
(
vlc_object_t
*
parent
,
audio_sample_format_t
*
fmt
,
IMMDevice
*
dev
,
const
GUID
*
sid
);
IMMDevice
*
dev
,
const
GUID
*
sid
);
#define aout_
api_Start(o,f,d,s) aout_api
_Start(VLC_OBJECT(o),f,d,s)
#define aout_
stream_Start(o,f,d,s) aout_stream
_Start(VLC_OBJECT(o),f,d,s)
/**
/**
* Destroys an audio output stream.
* Destroys an audio output stream.
*/
*/
void
aout_
api_Stop
(
aout_api
_t
*
);
void
aout_
stream_Stop
(
aout_stream
_t
*
);
static
inline
HRESULT
aout_
api_TimeGet
(
aout_api_t
*
api
,
mtime_t
*
delay
)
static
inline
HRESULT
aout_
stream_TimeGet
(
aout_stream_t
*
s
,
mtime_t
*
delay
)
{
{
return
(
api
->
time_get
)(
api
,
delay
);
return
(
s
->
time_get
)(
s
,
delay
);
}
}
static
inline
HRESULT
aout_
api_Play
(
aout_api_t
*
api
,
block_t
*
block
)
static
inline
HRESULT
aout_
stream_Play
(
aout_stream_t
*
s
,
block_t
*
block
)
{
{
return
(
api
->
play
)(
api
,
block
);
return
(
s
->
play
)(
s
,
block
);
}
}
static
inline
HRESULT
aout_
api_Pause
(
aout_api_t
*
api
,
bool
paused
)
static
inline
HRESULT
aout_
stream_Pause
(
aout_stream_t
*
s
,
bool
paused
)
{
{
return
(
api
->
pause
)(
api
,
paused
);
return
(
s
->
pause
)(
s
,
paused
);
}
}
static
inline
HRESULT
aout_
api_Flush
(
aout_api_t
*
api
)
static
inline
HRESULT
aout_
stream_Flush
(
aout_stream_t
*
s
)
{
{
return
(
api
->
flush
)(
api
);
return
(
s
->
flush
)(
s
);
}
}
#endif
#endif
modules/audio_output/wasapi.c
View file @
a3926236
...
@@ -77,7 +77,7 @@ static void Leave(void)
...
@@ -77,7 +77,7 @@ static void Leave(void)
CoUninitialize
();
CoUninitialize
();
}
}
typedef
struct
aout_
api
_sys
typedef
struct
aout_
stream
_sys
{
{
IAudioClient
*
client
;
IAudioClient
*
client
;
...
@@ -89,13 +89,13 @@ typedef struct aout_api_sys
...
@@ -89,13 +89,13 @@ typedef struct aout_api_sys
unsigned
bytes_per_frame
;
unsigned
bytes_per_frame
;
UINT32
written
;
/**< Frames written to the buffer */
UINT32
written
;
/**< Frames written to the buffer */
UINT32
frames
;
/**< Total buffer size (frames) */
UINT32
frames
;
/**< Total buffer size (frames) */
}
aout_
api
_sys_t
;
}
aout_
stream
_sys_t
;
/*** VLC audio output callbacks ***/
/*** VLC audio output callbacks ***/
static
HRESULT
TimeGet
(
aout_
api_t
*
api
,
mtime_t
*
restrict
delay
)
static
HRESULT
TimeGet
(
aout_
stream_t
*
s
,
mtime_t
*
restrict
delay
)
{
{
aout_
api_sys_t
*
sys
=
api
->
sys
;
aout_
stream_sys_t
*
sys
=
s
->
sys
;
void
*
pv
;
void
*
pv
;
UINT64
pos
,
qpcpos
;
UINT64
pos
,
qpcpos
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -107,11 +107,11 @@ static HRESULT TimeGet(aout_api_t *api, mtime_t *restrict delay)
...
@@ -107,11 +107,11 @@ static HRESULT TimeGet(aout_api_t *api, mtime_t *restrict delay)
hr
=
IAudioClock_GetPosition
(
clock
,
&
pos
,
&
qpcpos
);
hr
=
IAudioClock_GetPosition
(
clock
,
&
pos
,
&
qpcpos
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
msg_Err
(
api
,
"cannot get position (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get position (error 0x%lx)"
,
hr
);
IAudioClock_Release
(
clock
);
IAudioClock_Release
(
clock
);
}
}
else
else
msg_Err
(
api
,
"cannot get clock (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get clock (error 0x%lx)"
,
hr
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
...
@@ -124,15 +124,15 @@ static HRESULT TimeGet(aout_api_t *api, mtime_t *restrict delay)
...
@@ -124,15 +124,15 @@ static HRESULT TimeGet(aout_api_t *api, mtime_t *restrict delay)
else
else
{
{
*
delay
=
sys
->
written
*
CLOCK_FREQ
/
sys
->
rate
;
*
delay
=
sys
->
written
*
CLOCK_FREQ
/
sys
->
rate
;
msg_Dbg
(
api
,
"extrapolating position: still propagating buffers"
);
msg_Dbg
(
s
,
"extrapolating position: still propagating buffers"
);
}
}
}
}
return
hr
;
return
hr
;
}
}
static
HRESULT
Play
(
aout_
api_t
*
api
,
block_t
*
block
)
static
HRESULT
Play
(
aout_
stream_t
*
s
,
block_t
*
block
)
{
{
aout_
api_sys_t
*
sys
=
api
->
sys
;
aout_
stream_sys_t
*
sys
=
s
->
sys
;
void
*
pv
;
void
*
pv
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -143,7 +143,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
...
@@ -143,7 +143,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
hr
=
IAudioClient_GetService
(
sys
->
client
,
&
IID_IAudioRenderClient
,
&
pv
);
hr
=
IAudioClient_GetService
(
sys
->
client
,
&
IID_IAudioRenderClient
,
&
pv
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot get render client (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get render client (error 0x%lx)"
,
hr
);
goto
out
;
goto
out
;
}
}
...
@@ -154,7 +154,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
...
@@ -154,7 +154,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
hr
=
IAudioClient_GetCurrentPadding
(
sys
->
client
,
&
frames
);
hr
=
IAudioClient_GetCurrentPadding
(
sys
->
client
,
&
frames
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot get current padding (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get current padding (error 0x%lx)"
,
hr
);
break
;
break
;
}
}
...
@@ -167,7 +167,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
...
@@ -167,7 +167,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
hr
=
IAudioRenderClient_GetBuffer
(
render
,
frames
,
&
dst
);
hr
=
IAudioRenderClient_GetBuffer
(
render
,
frames
,
&
dst
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot get buffer (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get buffer (error 0x%lx)"
,
hr
);
break
;
break
;
}
}
...
@@ -177,7 +177,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
...
@@ -177,7 +177,7 @@ static HRESULT Play(aout_api_t *api, block_t *block)
hr
=
IAudioRenderClient_ReleaseBuffer
(
render
,
frames
,
0
);
hr
=
IAudioRenderClient_ReleaseBuffer
(
render
,
frames
,
0
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot release buffer (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot release buffer (error 0x%lx)"
,
hr
);
break
;
break
;
}
}
IAudioClient_Start
(
sys
->
client
);
IAudioClient_Start
(
sys
->
client
);
...
@@ -200,9 +200,9 @@ out:
...
@@ -200,9 +200,9 @@ out:
return
hr
;
return
hr
;
}
}
static
HRESULT
Pause
(
aout_
api_t
*
api
,
bool
paused
)
static
HRESULT
Pause
(
aout_
stream_t
*
s
,
bool
paused
)
{
{
aout_
api_sys_t
*
sys
=
api
->
sys
;
aout_
stream_sys_t
*
sys
=
s
->
sys
;
HRESULT
hr
;
HRESULT
hr
;
if
(
paused
)
if
(
paused
)
...
@@ -210,21 +210,21 @@ static HRESULT Pause(aout_api_t *api, bool paused)
...
@@ -210,21 +210,21 @@ static HRESULT Pause(aout_api_t *api, bool paused)
else
else
hr
=
IAudioClient_Start
(
sys
->
client
);
hr
=
IAudioClient_Start
(
sys
->
client
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
msg_Warn
(
api
,
"cannot %s stream (error 0x%lx)"
,
msg_Warn
(
s
,
"cannot %s stream (error 0x%lx)"
,
paused
?
"stop"
:
"start"
,
hr
);
paused
?
"stop"
:
"start"
,
hr
);
return
hr
;
return
hr
;
}
}
static
HRESULT
Flush
(
aout_
api_t
*
api
)
static
HRESULT
Flush
(
aout_
stream_t
*
s
)
{
{
aout_
api_sys_t
*
sys
=
api
->
sys
;
aout_
stream_sys_t
*
sys
=
s
->
sys
;
HRESULT
hr
;
HRESULT
hr
;
IAudioClient_Stop
(
sys
->
client
);
IAudioClient_Stop
(
sys
->
client
);
hr
=
IAudioClient_Reset
(
sys
->
client
);
hr
=
IAudioClient_Reset
(
sys
->
client
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
msg_Warn
(
api
,
"cannot reset stream (error 0x%lx)"
,
hr
);
msg_Warn
(
s
,
"cannot reset stream (error 0x%lx)"
,
hr
);
else
else
sys
->
written
=
0
;
sys
->
written
=
0
;
return
hr
;
return
hr
;
...
@@ -323,10 +323,10 @@ static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf,
...
@@ -323,10 +323,10 @@ static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf,
return
aout_CheckChannelReorder
(
chans_in
,
chans_out
,
mask
,
table
);
return
aout_CheckChannelReorder
(
chans_in
,
chans_out
,
mask
,
table
);
}
}
static
HRESULT
Start
(
aout_
api_t
*
api
,
audio_sample_format_t
*
restrict
fmt
,
static
HRESULT
Start
(
aout_
stream_t
*
s
,
audio_sample_format_t
*
restrict
fmt
,
IMMDevice
*
dev
,
const
GUID
*
sid
)
IMMDevice
*
dev
,
const
GUID
*
sid
)
{
{
aout_
api
_sys_t
*
sys
=
malloc
(
sizeof
(
*
sys
));
aout_
stream
_sys_t
*
sys
=
malloc
(
sizeof
(
*
sys
));
if
(
unlikely
(
sys
==
NULL
))
if
(
unlikely
(
sys
==
NULL
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
sys
->
client
=
NULL
;
sys
->
client
=
NULL
;
...
@@ -339,7 +339,7 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
...
@@ -339,7 +339,7 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
Leave
();
Leave
();
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot activate client (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot activate client (error 0x%lx)"
,
hr
);
goto
error
;
goto
error
;
}
}
sys
->
client
=
pv
;
sys
->
client
=
pv
;
...
@@ -353,7 +353,7 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
...
@@ -353,7 +353,7 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
&
wf
.
Format
,
&
pwf
);
&
wf
.
Format
,
&
pwf
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot negotiate audio format (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot negotiate audio format (error 0x%lx)"
,
hr
);
goto
error
;
goto
error
;
}
}
...
@@ -363,11 +363,11 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
...
@@ -363,11 +363,11 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
if
(
vlc_FromWave
(
pwf
,
fmt
))
if
(
vlc_FromWave
(
pwf
,
fmt
))
{
{
CoTaskMemFree
(
pwf
);
CoTaskMemFree
(
pwf
);
msg_Err
(
api
,
"unsupported audio format"
);
msg_Err
(
s
,
"unsupported audio format"
);
hr
=
E_INVALIDARG
;
hr
=
E_INVALIDARG
;
goto
error
;
goto
error
;
}
}
msg_Dbg
(
api
,
"modified format"
);
msg_Dbg
(
s
,
"modified format"
);
}
}
else
else
assert
(
pwf
==
NULL
);
assert
(
pwf
==
NULL
);
...
@@ -382,25 +382,25 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
...
@@ -382,25 +382,25 @@ static HRESULT Start(aout_api_t *api, audio_sample_format_t *restrict fmt,
CoTaskMemFree
(
pwf
);
CoTaskMemFree
(
pwf
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot initialize audio client (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot initialize audio client (error 0x%lx)"
,
hr
);
goto
error
;
goto
error
;
}
}
hr
=
IAudioClient_GetBufferSize
(
sys
->
client
,
&
sys
->
frames
);
hr
=
IAudioClient_GetBufferSize
(
sys
->
client
,
&
sys
->
frames
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
msg_Err
(
api
,
"cannot get buffer size (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get buffer size (error 0x%lx)"
,
hr
);
goto
error
;
goto
error
;
}
}
sys
->
rate
=
fmt
->
i_rate
;
sys
->
rate
=
fmt
->
i_rate
;
sys
->
bytes_per_frame
=
fmt
->
i_bytes_per_frame
;
sys
->
bytes_per_frame
=
fmt
->
i_bytes_per_frame
;
sys
->
written
=
0
;
sys
->
written
=
0
;
api
->
sys
=
sys
;
s
->
sys
=
sys
;
api
->
time_get
=
TimeGet
;
s
->
time_get
=
TimeGet
;
api
->
play
=
Play
;
s
->
play
=
Play
;
api
->
pause
=
Pause
;
s
->
pause
=
Pause
;
api
->
flush
=
Flush
;
s
->
flush
=
Flush
;
return
S_OK
;
return
S_OK
;
error:
error:
if
(
sys
->
client
!=
NULL
)
if
(
sys
->
client
!=
NULL
)
...
@@ -409,33 +409,34 @@ error:
...
@@ -409,33 +409,34 @@ error:
return
hr
;
return
hr
;
}
}
static
void
Stop
(
aout_
api_t
*
api
)
static
void
Stop
(
aout_
stream_t
*
s
)
{
{
aout_
api_sys_t
*
sys
=
api
->
sys
;
aout_
stream_sys_t
*
sys
=
s
->
sys
;
IAudioClient_Stop
(
sys
->
client
);
/* should not be needed */
IAudioClient_Stop
(
sys
->
client
);
/* should not be needed */
IAudioClient_Release
(
sys
->
client
);
IAudioClient_Release
(
sys
->
client
);
}
}
#undef aout_api_Start
#undef aout_stream_Start
aout_api_t
*
aout_api_Start
(
vlc_object_t
*
parent
,
audio_sample_format_t
*
fmt
,
aout_stream_t
*
aout_stream_Start
(
vlc_object_t
*
parent
,
audio_sample_format_t
*
restrict
fmt
,
IMMDevice
*
dev
,
const
GUID
*
sid
)
IMMDevice
*
dev
,
const
GUID
*
sid
)
{
{
aout_
api_t
*
api
=
vlc_object_create
(
parent
,
sizeof
(
*
api
));
aout_
stream_t
*
s
=
vlc_object_create
(
parent
,
sizeof
(
*
s
));
if
(
unlikely
(
api
==
NULL
))
if
(
unlikely
(
s
==
NULL
))
return
NULL
;
return
NULL
;
HRESULT
hr
=
Start
(
api
,
fmt
,
dev
,
sid
);
HRESULT
hr
=
Start
(
s
,
fmt
,
dev
,
sid
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
vlc_object_release
(
api
);
vlc_object_release
(
s
);
api
=
NULL
;
s
=
NULL
;
}
}
return
api
;
return
s
;
}
}
void
aout_
api_Stop
(
aout_api_t
*
api
)
void
aout_
stream_Stop
(
aout_stream_t
*
s
)
{
{
Stop
(
api
);
Stop
(
s
);
vlc_object_release
(
api
);
vlc_object_release
(
s
);
}
}
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