summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--audio_hw.c204
-rw-r--r--audio_hw.h16
-rw-r--r--audio_hw_profile.c67
-rw-r--r--audio_hw_profile.h20
-rw-r--r--audio_hw_utils.c157
-rw-r--r--audio_hw_utils.h20
-rw-r--r--audio_hwsync.c18
-rw-r--r--audio_hwsync.h18
8 files changed, 406 insertions, 114 deletions
diff --git a/audio_hw_profile.c b/audio_hw_profile.c
index d90cdeb..81bb83f 100644
--- a/audio_hw_profile.c
+++ b/audio_hw_profile.c
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2010 Amlogic Corporation.
+ *
+ * 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.
+ */
+
+
+
#define LOG_TAG "audio_hw_profile"
#include <errno.h>
#include <pthread.h>
@@ -131,7 +149,7 @@ Dobly_Digital+, 8 ch, 44.1/48 kHz, 16 bit
DTS-HD, 8 ch, 44.1/48/88.2/96/176.4/192 kHz, 16 bit
MAT, 8 ch, 32/44.1/48/88.2/96/176.4/192 kHz, 16 bit
*/
-char* get_hdmi_sink_cap(const char *keys)
+char* get_hdmi_sink_cap(const char *keys,audio_format_t format)
{
int i = 0;
char * infobuf = NULL;
@@ -194,7 +212,8 @@ char* get_hdmi_sink_cap(const char *keys)
if (mystrstr(infobuf, "176.4")) {
size += sprintf(aud_cap + size, "|%s", "176400");
}
- if (mystrstr(infobuf, "192")) {
+ if (mystrstr(infobuf, "192") || (mystrstr(infobuf, "Dobly_Digital+") &&
+ format == AUDIO_FORMAT_IEC61937)) {
size += sprintf(aud_cap + size, "|%s", "192000");
}
}
@@ -222,6 +241,8 @@ char* get_hdmi_arc_cap(unsigned *ad, int maxsize, const char *keys)
int dgraw = 0;
int fd = -1;
int size = 0;
+ int raw_support = 0;
+ int iec_added = 0;
char *aud_cap = NULL;
unsigned char format, ch, sr;
aud_cap = (char*)malloc(1024);
@@ -233,16 +254,16 @@ char* get_hdmi_arc_cap(unsigned *ad, int maxsize, const char *keys)
ALOGI("get_hdmi_arc_cap\n");
/* check the format cap */
if (strstr(keys, AUDIO_PARAMETER_STREAM_SUP_FORMATS)) {
- size += sprintf(aud_cap, "=%s|", "AUDIO_FORMAT_PCM_16_BIT");
+ size += sprintf(aud_cap, "sup_formats=%s", "AUDIO_FORMAT_PCM_16_BIT");
}
/*check the channel cap */
else if (strstr(keys, AUDIO_PARAMETER_STREAM_SUP_CHANNELS)) {
//ALOGI("check channels\n");
/* take the 2ch suppported as default */
- size += sprintf(aud_cap, "=%s|", "AUDIO_CHANNEL_OUT_STEREO");
+ size += sprintf(aud_cap, "sup_channels=%s", "AUDIO_CHANNEL_OUT_STEREO");
} else if (strstr(keys, AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES)) {
/* take the 32/44.1/48 khz suppported as default */
- size += sprintf(aud_cap, "=%s|", "32000|44100|48000");
+ size += sprintf(aud_cap, "sup_sampling_rates=%s", "32000|44100|48000");
//ALOGI("check sample rate\n");
}
for (i = 0; i < maxsize; i++) {
@@ -255,41 +276,49 @@ char* get_hdmi_arc_cap(unsigned *ad, int maxsize, const char *keys)
if (strstr(keys, AUDIO_PARAMETER_STREAM_SUP_FORMATS)) {
//ALOGI("check format\n");
if (format == 10) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_FORMAT_E_AC3");
+ raw_support = 1;
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_FORMAT_E_AC3");
}
- if (format == 2) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_FORMAT_AC3");
+ else if (format == 2) {
+ raw_support = 1;
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_FORMAT_AC3");
}
- if (format == 11) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_FORMAT_DTS|AUDIO_FORMAT_DTSHD");
+ else if (format == 11) {
+ raw_support = 1;
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_FORMAT_DTS|AUDIO_FORMAT_DTSHD");
} else if (format == 7) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_FORMAT_DTS");
+ raw_support = 1;
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_FORMAT_DTS");
+ }
+ else if (format == 12) {
+ raw_support = 1;
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_FORMAT_TRUEHD");
}
- if (format == 12) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_FORMAT_TRUEHD");
+ if (raw_support == 1 && iec_added == 0) {
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_FORMAT_IEC61937");
}
}
/*check the channel cap */
else if (strstr(keys, AUDIO_PARAMETER_STREAM_SUP_CHANNELS)) {
//ALOGI("check channels\n");
if (/*format == 1 && */ch == 7) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_7POINT1");
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_7POINT1");
} else if (/*format == 1 && */ch == 5) {
- size += sprintf(aud_cap + size, "%s|", "AUDIO_CHANNEL_OUT_5POINT1");
+ size += sprintf(aud_cap + size, "|%s", "AUDIO_CHANNEL_OUT_5POINT1");
}
} else if (strstr(keys, AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES)) {
ALOGI("check sample rate\n");
if (format == 1 && sr == 4) {
- size += sprintf(aud_cap + size, "%s|", "88200");
+ size += sprintf(aud_cap + size, "|%s", "88200");
}
if (format == 1 && sr == 5) {
- size += sprintf(aud_cap + size, "%s|", "96000");
+ size += sprintf(aud_cap + size, "|%s", "96000");
}
if (format == 1 && sr == 6) {
- size += sprintf(aud_cap + size, "%s|", "176400");
+ size += sprintf(aud_cap + size, "|%s", "176400");
}
if (format == 1 && sr == 7) {
- size += sprintf(aud_cap + size, "%s|", "192000");
+ size += sprintf(aud_cap + size, "|%s", "192000");
}
}