diff options
author | Max Kellermann <max@musicpd.org> | 2020-07-02 13:37:44 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-07-02 13:50:05 +0200 |
commit | db8bf52f7daaa0c54c69a041050e42d40b7060cc (patch) | |
tree | e32b9b44cc260a89ddb2237fc19233177dfdfb6e /src/apple | |
parent | 756f0b80273910e16749a9cc3014a393909ef153 (diff) |
apple/AudioObject: add AudioObjectGetStringProperty()
Diffstat (limited to 'src/apple')
-rw-r--r-- | src/apple/AudioObject.cxx | 40 | ||||
-rw-r--r-- | src/apple/AudioObject.hxx | 8 | ||||
-rw-r--r-- | src/apple/meson.build | 1 |
3 files changed, 49 insertions, 0 deletions
diff --git a/src/apple/AudioObject.cxx b/src/apple/AudioObject.cxx new file mode 100644 index 000000000..f81f82e2f --- /dev/null +++ b/src/apple/AudioObject.cxx @@ -0,0 +1,40 @@ +/* + * 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); +} diff --git a/src/apple/AudioObject.hxx b/src/apple/AudioObject.hxx index 4050c2e72..ff0362dd4 100644 --- a/src/apple/AudioObject.hxx +++ b/src/apple/AudioObject.hxx @@ -37,6 +37,10 @@ #include <cstddef> +namespace Apple { +class StringRef; +} + inline std::size_t AudioObjectGetPropertyDataSize(AudioObjectID inObjectID, const AudioObjectPropertyAddress &inAddress) @@ -69,6 +73,10 @@ AudioObjectGetPropertyDataT(AudioObjectID inObjectID, return value; } +Apple::StringRef +AudioObjectGetStringProperty(AudioObjectID inObjectID, + const AudioObjectPropertyAddress &inAddress); + template<typename T> AllocatedArray<T> AudioObjectGetPropertyDataArray(AudioObjectID inObjectID, diff --git a/src/apple/meson.build b/src/apple/meson.build index 8f9f46484..160c62bc4 100644 --- a/src/apple/meson.build +++ b/src/apple/meson.build @@ -12,6 +12,7 @@ audiounit_dep = declare_dependency( apple = static_library( 'apple', + 'AudioObject.cxx', 'Throw.cxx', include_directories: inc, dependencies: [ |