diff options
author | Priyesh Bisla | 2012-10-02 18:25:38 -0500 |
---|---|---|
committer | Priyesh Bisla | 2012-10-02 18:25:38 -0500 |
commit | f11b96a250cf9cbf0810a39cd54512805a03c503 (patch) | |
tree | 3c6b25d32fe352a2575b9a37513e83875f03821f | |
parent | 977eeecf873286f809f8d0a2ee5513920d417127 (diff) | |
download | device-ti-common-open-f11b96a250cf9cbf0810a39cd54512805a03c503.tar.gz device-ti-common-open-f11b96a250cf9cbf0810a39cd54512805a03c503.tar.xz device-ti-common-open-f11b96a250cf9cbf0810a39cd54512805a03c503.zip |
audio: No re-order of multichannel output if already in CEA format
If 6 or more channels match the CEA channel position we have confidence
the advertised channel position is in CEA format. No need to re-order
channel position as this is format HDMI expects
Signed-off-by: Priyesh Bisla <a0271372@ti.com>
Change-Id: If78e2ed15d9e5c93d6bf777a06d6ed9b6e1cb590
-rw-r--r-- | audio/hdmi_audio_hw.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/audio/hdmi_audio_hw.c b/audio/hdmi_audio_hw.c index 0779c84..f46aee6 100644 --- a/audio/hdmi_audio_hw.c +++ b/audio/hdmi_audio_hw.c | |||
@@ -67,7 +67,8 @@ | |||
67 | typedef audio_hw_device_t hdmi_device_t; | 67 | typedef audio_hw_device_t hdmi_device_t; |
68 | 68 | ||
69 | struct hdmi_device_t { | 69 | struct hdmi_device_t { |
70 | int map[HDMI_MAX_CHANNELS]; | 70 | int map[HDMI_MAX_CHANNELS]; |
71 | bool CEAMap; | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | int cea_channel_map[HDMI_MAX_CHANNELS] = {OMX_AUDIO_ChannelLF,OMX_AUDIO_ChannelRF,OMX_AUDIO_ChannelLFE, | 74 | int cea_channel_map[HDMI_MAX_CHANNELS] = {OMX_AUDIO_ChannelLF,OMX_AUDIO_ChannelRF,OMX_AUDIO_ChannelLFE, |
@@ -364,6 +365,7 @@ ssize_t hdmi_out_write(struct audio_stream_out *stream, const void* buffer, | |||
364 | size_t bytes) | 365 | size_t bytes) |
365 | { | 366 | { |
366 | hdmi_out_t *out = (hdmi_out_t*)stream; | 367 | hdmi_out_t *out = (hdmi_out_t*)stream; |
368 | struct hdmi_device_t *adev = (struct hdmi_device_t *)out->dev; | ||
367 | ssize_t ret; | 369 | ssize_t ret; |
368 | 370 | ||
369 | TRACEM("stream=%p buffer=%p bytes=%d", stream, buffer, bytes); | 371 | TRACEM("stream=%p buffer=%p bytes=%d", stream, buffer, bytes); |
@@ -374,7 +376,7 @@ ssize_t hdmi_out_write(struct audio_stream_out *stream, const void* buffer, | |||
374 | } | 376 | } |
375 | } | 377 | } |
376 | 378 | ||
377 | if (out->config.channels > 2){ | 379 | if (out->config.channels > 2 && !adev->CEAMap){ |
378 | channel_remap(stream, buffer, bytes); | 380 | channel_remap(stream, buffer, bytes); |
379 | ret = pcm_write(out->pcm, out->buffcpy, bytes); | 381 | ret = pcm_write(out->pcm, out->buffcpy, bytes); |
380 | } else { | 382 | } else { |
@@ -498,7 +500,7 @@ static int hdmi_adev_set_parameters(audio_hw_device_t *dev, const char *kv_pairs | |||
498 | struct str_parms *params; | 500 | struct str_parms *params; |
499 | char *str; | 501 | char *str; |
500 | char value[HDMI_MAX_CHANNELS]; | 502 | char value[HDMI_MAX_CHANNELS]; |
501 | int ret, x, val; | 503 | int ret, x, val, numMatch = 0; |
502 | struct hdmi_device_t *adev = (struct hdmi_device_t *)dev; | 504 | struct hdmi_device_t *adev = (struct hdmi_device_t *)dev; |
503 | 505 | ||
504 | params = str_parms_create_str(kv_pairs); | 506 | params = str_parms_create_str(kv_pairs); |
@@ -508,7 +510,13 @@ static int hdmi_adev_set_parameters(audio_hw_device_t *dev, const char *kv_pairs | |||
508 | val = strtol(value, NULL, 10); | 510 | val = strtol(value, NULL, 10); |
509 | for(x = 0; x < HDMI_MAX_CHANNELS; x++) { | 511 | for(x = 0; x < HDMI_MAX_CHANNELS; x++) { |
510 | adev->map[x] = (val & (0xF << x*4)) >> x*4; | 512 | adev->map[x] = (val & (0xF << x*4)) >> x*4; |
513 | if (adev->map[x] == cea_channel_map[x]) | ||
514 | numMatch += 1; | ||
511 | } | 515 | } |
516 | if (numMatch >= 5) | ||
517 | adev->CEAMap = true; | ||
518 | else | ||
519 | adev->CEAMap = false; | ||
512 | } | 520 | } |
513 | return 0; | 521 | return 0; |
514 | } | 522 | } |