summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2013-01-26 16:46:33 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2013-01-26 20:01:27 +0100
commit071dbd5037e402c74efc8e7fa802210dac671a8b (patch)
treefcfaa5c5aadf26ee32f81ec9fbb8b8cfa341fbb1
parenta615d796bac52e83155163acf2e456ec4ebd556a (diff)
downloaddevice_samsung_p3100-replicant-4.0+audio-WIP.zip
device_samsung_p3100-replicant-4.0+audio-WIP.tar.gz
device_samsung_p3100-replicant-4.0+audio-WIP.tar.bz2
Backport audio/ to ics and activate it.replicant-4.0+audio-WIP
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
-rw-r--r--audio/Android.mk4
-rwxr-xr-xaudio/audio_hw.c9
-rw-r--r--audio/compat.h85
-rwxr-xr-xaudio/ril_interface.c1
-rw-r--r--p3100.mk3
5 files changed, 95 insertions, 7 deletions
diff --git a/audio/Android.mk b/audio/Android.mk
index 4655db0..b62a52a 100644
--- a/audio/Android.mk
+++ b/audio/Android.mk
@@ -25,8 +25,8 @@ LOCAL_SRC_FILES := audio_hw.c ril_interface.c
LOCAL_C_INCLUDES += \
external/tinyalsa/include \
external/expat/lib \
- $(call include-path-for, audio-utils) \
- $(call include-path-for, audio-effects)
+ system/media/audio_utils/include \
+ system/media/audio_effects/include \
LOCAL_SHARED_LIBRARIES := liblog libcutils libtinyalsa libaudioutils libdl libexpat
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 01f2b2b..245ab92 100755
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -42,6 +42,7 @@
#include <hardware/audio_effect.h>
#include <audio_effects/effect_aec.h>
+#include "compat.h"
#include "audio_hw.h"
#include "ril_interface.h"
@@ -571,7 +572,7 @@ static void select_mode(struct espresso_audio_device *adev)
change, even if the device selection did not change. */
if (adev->out_device == AUDIO_DEVICE_OUT_SPEAKER) {
adev->out_device = AUDIO_DEVICE_OUT_EARPIECE;
- adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN;
+ adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC;
} else
adev->out_device &= ~AUDIO_DEVICE_OUT_SPEAKER;
select_output_device(adev);
@@ -1572,7 +1573,7 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value));
if (ret >= 0) {
- val = atoi(value) & ~AUDIO_DEVICE_BIT_IN;
+ val = atoi(value);
if ((in->device != val) && (val != 0)) {
in->device = val;
do_standby = true;
@@ -2710,7 +2711,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
in->dev = ladev;
in->standby = 1;
- in->device = devices & ~AUDIO_DEVICE_BIT_IN;
+ in->device = devices;
*stream_in = &in->stream;
return 0;
@@ -3037,7 +3038,7 @@ static int adev_open(const hw_module_t* module, const char* name,
pthread_mutex_init(&adev->lock, NULL);
adev->mode = AUDIO_MODE_NORMAL;
adev->out_device = AUDIO_DEVICE_OUT_SPEAKER;
- adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN;
+ adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC;
select_devices(adev);
adev->pcm_modem_dl = NULL;
diff --git a/audio/compat.h b/audio/compat.h
new file mode 100644
index 0000000..83813e2
--- /dev/null
+++ b/audio/compat.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2013 Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+ *
+ * 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 __COMPAT_H__
+#define __COMPAT_H__
+
+#include <system/audio.h>
+
+#ifndef ALOGE
+#define ALOGE LOGE
+#endif
+
+#ifndef ALOGI
+#define ALOGI LOGI
+#endif
+
+#ifndef ALOGD
+#define ALOGD LOGD
+#endif
+
+#ifndef ALOGV
+#define ALOGV LOGV
+#endif
+
+#ifndef audio_channel_mask_t
+typedef uint32_t audio_channel_mask_t;
+#endif
+
+#ifndef audio_channel_mask_from_count
+/* Derive a channel mask from a channel count.
+ * This is to be used when the content channel mask is unknown. The 1, 2, 4, 5, 6, 7 and 8 channel
+ * cases are mapped to the standard game/home-theater layouts, but note that 4 is mapped to quad,
+ * and not stereo + FC + mono surround. A channel count of 3 is arbitrarily mapped to stereo + FC
+ * for continuity with stereo.
+ * Returns the matching channel mask, or 0 if the number of channels exceeds that of the
+ * configurations for which a default channel mask is defined.
+ */
+static inline audio_channel_mask_t audio_channel_mask_from_count(uint32_t channel_count)
+{
+ switch(channel_count) {
+ case 1:
+ return AUDIO_CHANNEL_OUT_MONO;
+ case 2:
+ return AUDIO_CHANNEL_OUT_STEREO;
+ case 3:
+ return (AUDIO_CHANNEL_OUT_STEREO | AUDIO_CHANNEL_OUT_FRONT_CENTER);
+ case 4: // 4.0
+ return AUDIO_CHANNEL_OUT_QUAD;
+ case 5: // 5.0
+ return (AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER);
+ case 6: // 5.1
+ return AUDIO_CHANNEL_OUT_5POINT1;
+ case 7: // 6.1
+ return (AUDIO_CHANNEL_OUT_5POINT1 | AUDIO_CHANNEL_OUT_BACK_CENTER);
+ case 8:
+ return AUDIO_CHANNEL_OUT_7POINT1;
+ default:
+ return 0;
+ }
+}
+#endif
+
+#ifndef channel_config_s
+// EFFECT_FEATURE_AUX_CHANNELS feature configuration descriptor. Describe a combinatio
+// of main and auxiliary channels supported
+typedef struct channel_config_s {
+ uint32_t main_channels; // channel mask for main channels
+ uint32_t aux_channels; // channel mask for auxiliary channels
+} channel_config_t;
+#endif
+
+#endif
diff --git a/audio/ril_interface.c b/audio/ril_interface.c
index 89a0aef..631a1d0 100755
--- a/audio/ril_interface.c
+++ b/audio/ril_interface.c
@@ -23,6 +23,7 @@
#include <utils/Log.h>
#include <cutils/properties.h>
+#include "compat.h"
#include "ril_interface.h"
#define VOLUME_STEPS_DEFAULT "5"
diff --git a/p3100.mk b/p3100.mk
index 947edcc..3d19f57 100644
--- a/p3100.mk
+++ b/p3100.mk
@@ -28,7 +28,8 @@ PRODUCT_COPY_FILES += \
# Packages
PRODUCT_PACKAGES += \
- SamsungServiceMode
+ SamsungServiceMode \
+ audio.primary.piranha
# RIL
PRODUCT_PROPERTY_OVERRIDES += \