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
db8bf52f
Commit
db8bf52f
authored
Jul 02, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apple/AudioObject: add AudioObjectGetStringProperty()
parent
756f0b80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
11 deletions
+56
-11
AudioObject.cxx
src/apple/AudioObject.cxx
+40
-0
AudioObject.hxx
src/apple/AudioObject.hxx
+8
-0
meson.build
src/apple/meson.build
+1
-0
OSXOutputPlugin.cxx
src/output/plugins/OSXOutputPlugin.cxx
+7
-11
No files found.
src/apple/AudioObject.cxx
0 → 100644
View file @
db8bf52f
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AudioObject.hxx"
#include "StringRef.hxx"
Apple
::
StringRef
AudioObjectGetStringProperty
(
AudioObjectID
inObjectID
,
const
AudioObjectPropertyAddress
&
inAddress
)
{
auto
s
=
AudioObjectGetPropertyDataT
<
CFStringRef
>
(
inObjectID
,
inAddress
);
return
Apple
::
StringRef
(
s
);
}
src/apple/AudioObject.hxx
View file @
db8bf52f
...
@@ -37,6 +37,10 @@
...
@@ -37,6 +37,10 @@
#include <cstddef>
#include <cstddef>
namespace
Apple
{
class
StringRef
;
}
inline
std
::
size_t
inline
std
::
size_t
AudioObjectGetPropertyDataSize
(
AudioObjectID
inObjectID
,
AudioObjectGetPropertyDataSize
(
AudioObjectID
inObjectID
,
const
AudioObjectPropertyAddress
&
inAddress
)
const
AudioObjectPropertyAddress
&
inAddress
)
...
@@ -69,6 +73,10 @@ AudioObjectGetPropertyDataT(AudioObjectID inObjectID,
...
@@ -69,6 +73,10 @@ AudioObjectGetPropertyDataT(AudioObjectID inObjectID,
return
value
;
return
value
;
}
}
Apple
::
StringRef
AudioObjectGetStringProperty
(
AudioObjectID
inObjectID
,
const
AudioObjectPropertyAddress
&
inAddress
);
template
<
typename
T
>
template
<
typename
T
>
AllocatedArray
<
T
>
AllocatedArray
<
T
>
AudioObjectGetPropertyDataArray
(
AudioObjectID
inObjectID
,
AudioObjectGetPropertyDataArray
(
AudioObjectID
inObjectID
,
...
...
src/apple/meson.build
View file @
db8bf52f
...
@@ -12,6 +12,7 @@ audiounit_dep = declare_dependency(
...
@@ -12,6 +12,7 @@ audiounit_dep = declare_dependency(
apple = static_library(
apple = static_library(
'apple',
'apple',
'AudioObject.cxx',
'Throw.cxx',
'Throw.cxx',
include_directories: inc,
include_directories: inc,
dependencies: [
dependencies: [
...
...
src/output/plugins/OSXOutputPlugin.cxx
View file @
db8bf52f
...
@@ -535,19 +535,15 @@ IsAudioDeviceName(AudioDeviceID id, const char *expected_name) noexcept
...
@@ -535,19 +535,15 @@ IsAudioDeviceName(AudioDeviceID id, const char *expected_name) noexcept
kAudioObjectPropertyElementMaster
,
kAudioObjectPropertyElementMaster
,
};
};
CFStringRef
cfname
;
UInt32
size
=
sizeof
(
cfname
);
if
(
AudioObjectGetPropertyData
(
id
,
&
aopa_name
,
0
,
nullptr
,
&
size
,
&
cfname
)
!=
noErr
)
return
false
;
const
Apple
::
StringRef
cfname_
(
cfname
);
char
actual_name
[
256
];
char
actual_name
[
256
];
if
(
!
cfname_
.
GetCString
(
actual_name
,
sizeof
(
actual_name
)))
try
{
auto
cfname
=
AudioObjectGetStringProperty
(
id
,
aopa_name
);
if
(
!
cfname
.
GetCString
(
actual_name
,
sizeof
(
actual_name
)))
return
false
;
}
catch
(...)
{
return
false
;
return
false
;
}
return
StringIsEqual
(
actual_name
,
expected_name
);
return
StringIsEqual
(
actual_name
,
expected_name
);
}
}
...
...
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