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
b5f4b4fd
Commit
b5f4b4fd
authored
Jun 07, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wasapi: get audio session, and set display name
parent
733a1051
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
modules/audio_output/wasapi.c
modules/audio_output/wasapi.c
+28
-0
No files found.
modules/audio_output/wasapi.c
View file @
b5f4b4fd
...
...
@@ -27,11 +27,13 @@
#include <assert.h>
#include <audioclient.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
...
...
@@ -73,6 +75,7 @@ struct aout_sys_t
{
ISimpleAudioVolume
*
simple
;
}
volume
;
IAudioSessionControl
*
control
;
UINT32
frames
;
/**< Total buffer size (frames) */
HANDLE
ready
;
/**< Semaphore from MTA thread */
HANDLE
done
;
/**< Semaphore to MTA thread */
...
...
@@ -279,6 +282,18 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
return
0
;
}
static
wchar_t
*
var_InheritWide
(
vlc_object_t
*
obj
,
const
char
*
name
)
{
char
*
v8
=
var_InheritString
(
obj
,
name
);
if
(
v8
==
NULL
)
return
NULL
;
wchar_t
*
v16
=
ToWide
(
v8
);
free
(
v8
);
return
v16
;
}
#define var_InheritWide(o,n) var_InheritWide(VLC_OBJECT(o),n)
/* Dummy thread to create and release COM interfaces when needed. */
static
void
MTAThread
(
void
*
data
)
{
...
...
@@ -307,10 +322,23 @@ static void MTAThread(void *data)
(
void
**
)
&
sys
->
volume
.
simple
);
}
hr
=
IAudioClient_GetService
(
sys
->
client
,
&
IID_IAudioSessionControl
,
(
void
**
)
&
sys
->
control
);
if
(
FAILED
(
hr
))
msg_Warn
(
aout
,
"cannot get audio session control (error 0x%lx)"
,
hr
);
else
{
wchar_t
*
ua
=
var_InheritWide
(
aout
,
"user-agent"
);
IAudioSessionControl_SetDisplayName
(
sys
->
control
,
ua
,
NULL
);
free
(
ua
);
}
/* do nothing until the audio session terminates */
ReleaseSemaphore
(
sys
->
ready
,
1
,
NULL
);
WaitForSingleObject
(
sys
->
done
,
INFINITE
);
if
(
sys
->
control
!=
NULL
)
IAudioSessionControl_Release
(
sys
->
control
);
/*if (AOUT_FMT_LINEAR(&format) && !exclusive)*/
{
if
(
sys
->
volume
.
simple
!=
NULL
)
...
...
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