Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 201e28a8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "audio: Add vendor tags handling for AIDL" am: a3a1c665 am: 431c0d4d am: 22524f58

parents f07e3f2b 22524f58
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <algorithm>
#include <algorithm>
#include <array>
#include <array>
#include <initializer_list>
#include <initializer_list>
#include <regex>
#include <type_traits>
#include <type_traits>


#include <aidl/android/media/audio/common/AudioChannelLayout.h>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
@@ -133,6 +134,18 @@ constexpr bool isValidAudioMode(::aidl::android::media::audio::common::AudioMode
           kValidAudioModes.end();
           kValidAudioModes.end();
}
}


static inline bool maybeVendorExtension(const std::string& s) {
    // Only checks whether the string starts with the "vendor prefix".
    static const std::string vendorPrefix = "VX_";
    return s.size() > vendorPrefix.size() && s.substr(0, vendorPrefix.size()) == vendorPrefix;
}

static inline bool isVendorExtension(const std::string& s) {
    // Must be the same as defined in {Playback|Record}TrackMetadata.aidl
    static const std::regex vendorExtension("VX_[A-Z0-9]{3,}_[_A-Z0-9]+");
    return std::regex_match(s.begin(), s.end(), vendorExtension);
}

// The helper functions defined below are only applicable to the case when an enum type
// The helper functions defined below are only applicable to the case when an enum type
// specifies zero-based bit positions, not bit masks themselves. This is why instantiation
// specifies zero-based bit positions, not bit masks themselves. This is why instantiation
// is restricted to certain enum types.
// is restricted to certain enum types.
+1 −1
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ struct HidlUtils {
#endif
#endif


#if MAJOR_VERSION >= 7
#if MAJOR_VERSION >= 7
    static constexpr char sAudioTagSeparator = ';';
    static constexpr char sAudioTagSeparator = AUDIO_ATTRIBUTES_TAGS_SEPARATOR;


    static status_t audioChannelMaskFromHal(audio_channel_mask_t halChannelMask, bool isInput,
    static status_t audioChannelMaskFromHal(audio_channel_mask_t halChannelMask, bool isInput,
                                            AudioChannelMask* channelMask);
                                            AudioChannelMask* channelMask);