Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2f2b3f1c
Commit
2f2b3f1c
authored
Mar 05, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/wasapi: SearchDevice() returns IMMDevice
parent
2ff6a9ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
WasapiOutputPlugin.cxx
src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+11
-10
No files found.
src/output/plugins/wasapi/WasapiOutputPlugin.cxx
View file @
2f2b3f1c
...
...
@@ -261,7 +261,7 @@ private:
void
FindSharedFormatSupported
(
AudioFormat
&
audio_format
);
void
EnumerateDevices
();
ComPtr
<
IMMDevice
>
GetDevice
(
unsigned
int
index
);
unsigned
int
SearchDevice
(
std
::
string_view
name
);
ComPtr
<
IMMDevice
>
SearchDevice
(
std
::
string_view
name
);
};
WasapiOutput
&
wasapi_output_downcast
(
AudioOutput
&
output
)
noexcept
{
...
...
@@ -616,13 +616,12 @@ void WasapiOutput::OpenDevice() {
unsigned
int
id
=
kErrorId
;
if
(
!
device_config
.
empty
())
{
if
(
!
SafeSilenceTry
([
this
,
&
id
]()
{
id
=
std
::
stoul
(
device_config
);
}))
{
id
=
SearchDevice
(
device_config
);
if
(
id
==
kErrorId
)
device
=
SearchDevice
(
device_config
);
if
(
!
device
)
throw
FormatRuntimeError
(
"Device '%s' not found"
,
device_config
.
c_str
());
}
device
=
GetDevice
(
id
);
}
else
device
=
GetDevice
(
id
);
}
else
{
device
=
GetDefaultAudioEndpoint
(
*
enumerator
);
}
...
...
@@ -836,9 +835,11 @@ WasapiOutput::GetDevice(unsigned int index)
}
/// run inside COMWorkerThread
unsigned
int
WasapiOutput
::
SearchDevice
(
std
::
string_view
name
)
{
ComPtr
<
IMMDevice
>
WasapiOutput
::
SearchDevice
(
std
::
string_view
name
)
{
if
(
!
SafeTry
([
this
]()
{
EnumerateDevices
();
}))
{
return
kErrorId
;
return
nullptr
;
}
auto
iter
=
std
::
find_if
(
device_desc
.
cbegin
(),
device_desc
.
cend
(),
...
...
@@ -846,11 +847,11 @@ unsigned int WasapiOutput::SearchDevice(std::string_view name) {
if
(
iter
==
device_desc
.
cend
())
{
FormatError
(
wasapi_output_domain
,
"Device %.*s not founded."
,
int
(
name
.
size
()),
name
.
data
());
return
kErrorId
;
return
nullptr
;
}
FormatInfo
(
wasapi_output_domain
,
"Select device
\"
%u
\"
\"
%s
\"
"
,
iter
->
first
,
iter
->
second
.
c_str
());
return
iter
->
first
;
return
GetDevice
(
iter
->
first
)
;
}
static
bool
wasapi_output_test_default_device
()
{
return
true
;
}
...
...
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