summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-12-10 21:55:52 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-10 21:55:52 +0000
commitb279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2 (patch)
tree3e53a23fbf31379eab4d76b68af9f6b20b4c7e0c /include
parenta2bc118cfe860f9c108ba089b021d3b003185c56 (diff)
parentc49d9cda49dab8b7dd0376cf56476b3e1895d5c6 (diff)
downloadframeworks_av-b279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2.zip
frameworks_av-b279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2.tar.gz
frameworks_av-b279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2.tar.bz2
am c49d9cda: am 2dda40d6: Merge "audio policy: add support for custom mixes" into lmp-mr1-dev
* commit 'c49d9cda49dab8b7dd0376cf56476b3e1895d5c6': audio policy: add support for custom mixes
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioPolicy.h82
-rw-r--r--include/media/AudioPolicyHelper.h2
2 files changed, 83 insertions, 1 deletions
diff --git a/include/media/AudioPolicy.h b/include/media/AudioPolicy.h
new file mode 100644
index 0000000..a755e1e
--- /dev/null
+++ b/include/media/AudioPolicy.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ANDROID_AUDIO_POLICY_H
+#define ANDROID_AUDIO_POLICY_H
+
+#include <system/audio.h>
+#include <system/audio_policy.h>
+#include <binder/Parcel.h>
+#include <utils/String8.h>
+#include <utils/Vector.h>
+
+namespace android {
+
+// Keep in sync with AudioMix.java, AudioMixingRule.java, AudioPolicyConfig.java
+#define RULE_EXCLUSION_MASK 0x8000
+#define RULE_MATCH_ATTRIBUTE_USAGE 0x1
+#define RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET (0x1 << 1)
+#define RULE_EXCLUDE_ATTRIBUTE_USAGE (RULE_EXCLUSION_MASK|RULE_MATCH_ATTRIBUTE_USAGE)
+#define RULE_EXCLUDE_ATTRIBUTE_CAPTURE_PRESET \
+ (RULE_EXCLUSION_MASK|RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET)
+
+#define MIX_TYPE_INVALID -1
+#define MIX_TYPE_PLAYERS 0
+#define MIX_TYPE_RECORDERS 1
+
+#define ROUTE_FLAG_RENDER 0x1
+#define ROUTE_FLAG_LOOP_BACK (0x1 << 1)
+
+#define MAX_MIXES_PER_POLICY 10
+#define MAX_CRITERIA_PER_MIX 20
+
+class AttributeMatchCriterion {
+public:
+ AttributeMatchCriterion() {}
+ AttributeMatchCriterion(audio_usage_t usage, audio_source_t source, uint32_t rule);
+
+ status_t readFromParcel(Parcel *parcel);
+ status_t writeToParcel(Parcel *parcel) const;
+
+ union {
+ audio_usage_t mUsage;
+ audio_source_t mSource;
+ } mAttr;
+ uint32_t mRule;
+};
+
+class AudioMix {
+public:
+ AudioMix() {}
+ AudioMix(Vector<AttributeMatchCriterion> criteria, uint32_t mixType, audio_config_t format,
+ uint32_t routeFlags, String8 registrationId) :
+ mCriteria(criteria), mMixType(mixType), mFormat(format),
+ mRouteFlags(routeFlags), mRegistrationId(registrationId) {}
+
+ status_t readFromParcel(Parcel *parcel);
+ status_t writeToParcel(Parcel *parcel) const;
+
+ Vector<AttributeMatchCriterion> mCriteria;
+ uint32_t mMixType;
+ audio_config_t mFormat;
+ uint32_t mRouteFlags;
+ String8 mRegistrationId;
+};
+
+}; // namespace android
+
+#endif // ANDROID_AUDIO_POLICY_H
diff --git a/include/media/AudioPolicyHelper.h b/include/media/AudioPolicyHelper.h
index 3ed0b74..79231be 100644
--- a/include/media/AudioPolicyHelper.h
+++ b/include/media/AudioPolicyHelper.h
@@ -63,7 +63,7 @@ static audio_stream_type_t audio_attributes_to_stream_type(const audio_attribute
static void stream_type_to_audio_attributes(audio_stream_type_t streamType,
audio_attributes_t *attr) {
- attr->flags = 0x0;
+ memset(attr, 0, sizeof(audio_attributes_t));
switch (streamType) {
case AUDIO_STREAM_DEFAULT: