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
f8c07e70
Commit
f8c07e70
authored
Dec 06, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wasapi: remove direct dependency on desktop-only IMMDevice
parent
4a1c30a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
modules/audio_output/mmdevice.c
modules/audio_output/mmdevice.c
+16
-1
modules/audio_output/mmdevice.h
modules/audio_output/mmdevice.h
+14
-2
modules/audio_output/wasapi.c
modules/audio_output/wasapi.c
+4
-8
No files found.
modules/audio_output/mmdevice.c
View file @
f8c07e70
...
...
@@ -618,6 +618,18 @@ static void CloseDevice(audio_output_t *aout)
sys
->
dev
=
NULL
;
}
/**
* Callback for aout_stream_t to create a stream on the device.
* This can instantiate an IAudioClient or IDirectSound(8) object.
*/
static
HRESULT
ActivateDevice
(
void
*
opaque
,
REFIID
iid
,
PROPVARIANT
*
actparms
,
void
**
restrict
pv
)
{
IMMDevice
*
dev
=
opaque
;
return
IMMDevice_Activate
(
dev
,
iid
,
CLSCTX_ALL
,
actparms
,
pv
);
}
static
int
Start
(
audio_output_t
*
aout
,
audio_sample_format_t
*
restrict
fmt
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
...
...
@@ -631,8 +643,11 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
if
(
unlikely
(
s
==
NULL
))
return
-
1
;
s
->
owner
.
device
=
sys
->
dev
;
s
->
owner
.
activate
=
ActivateDevice
;
EnterMTA
();
hr
=
aout_stream_Start
(
s
,
fmt
,
sys
->
dev
,
&
GUID_VLC_AUD_OUT
);
hr
=
aout_stream_Start
(
s
,
fmt
,
&
GUID_VLC_AUD_OUT
);
if
(
SUCCEEDED
(
hr
))
sys
->
stream
=
s
;
else
...
...
modules/audio_output/mmdevice.h
View file @
f8c07e70
...
...
@@ -35,17 +35,22 @@ struct aout_stream
HRESULT
(
*
play
)(
aout_stream_t
*
,
block_t
*
);
HRESULT
(
*
pause
)(
aout_stream_t
*
,
bool
);
HRESULT
(
*
flush
)(
aout_stream_t
*
);
struct
{
void
*
device
;
HRESULT
(
*
activate
)(
void
*
device
,
REFIID
,
PROPVARIANT
*
,
void
**
);
}
owner
;
};
/**
* Creates an audio output stream on a given Windows multimedia device.
* \param s audio output stream object to be initialized
* \param fmt audio output sample format [IN/OUT]
* \param dev MMDevice API output device
* \param sid audio output session GUID [IN]
*/
HRESULT
aout_stream_Start
(
aout_stream_t
*
s
,
audio_sample_format_t
*
fmt
,
IMMDevice
*
dev
,
const
GUID
*
sid
);
const
GUID
*
sid
);
/**
* Destroys an audio output stream.
...
...
@@ -71,4 +76,11 @@ static inline HRESULT aout_stream_Flush(aout_stream_t *s)
{
return
(
s
->
flush
)(
s
);
}
static
inline
HRESULT
aout_stream_Activate
(
aout_stream_t
*
s
,
REFIID
iid
,
PROPVARIANT
*
actparms
,
void
**
pv
)
{
return
s
->
owner
.
activate
(
s
->
owner
.
device
,
iid
,
actparms
,
pv
);
}
#endif
modules/audio_output/wasapi.c
View file @
f8c07e70
...
...
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <assert.h>
#include <audioclient.h>
#include <mmdeviceapi.h>
#include <vlc_common.h>
#include <vlc_aout.h>
...
...
@@ -312,7 +311,7 @@ static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf,
}
static
HRESULT
Start
(
aout_stream_t
*
s
,
audio_sample_format_t
*
restrict
fmt
,
IMMDevice
*
dev
,
const
GUID
*
sid
)
const
GUID
*
sid
)
{
aout_stream_sys_t
*
sys
=
malloc
(
sizeof
(
*
sys
));
if
(
unlikely
(
sys
==
NULL
))
...
...
@@ -320,9 +319,7 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict fmt,
sys
->
client
=
NULL
;
void
*
pv
;
HRESULT
hr
;
hr
=
IMMDevice_Activate
(
dev
,
&
IID_IAudioClient
,
CLSCTX_ALL
,
NULL
,
&
pv
);
HRESULT
hr
=
aout_stream_Activate
(
s
,
&
IID_IAudioClient
,
NULL
,
&
pv
);
if
(
FAILED
(
hr
))
{
msg_Err
(
s
,
"cannot activate client (error 0x%lx)"
,
hr
);
...
...
@@ -404,10 +401,9 @@ static void Stop(aout_stream_t *s)
}
HRESULT
aout_stream_Start
(
aout_stream_t
*
s
,
audio_sample_format_t
*
restrict
fmt
,
IMMDevice
*
dev
,
const
GUID
*
sid
)
audio_sample_format_t
*
restrict
fmt
,
const
GUID
*
sid
)
{
return
Start
(
s
,
fmt
,
dev
,
sid
);
return
Start
(
s
,
fmt
,
sid
);
}
void
aout_stream_Stop
(
aout_stream_t
*
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