From: Kishore SN Date: Thu, 14 Sep 2017 04:31:45 +0000 (+0530) Subject: Audio: Fix issue of ac_type always coming as AUDIO_TYPE_OUTPUT X-Git-Tag: 1.1_Public_Release~188^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0627468cae291809a57bc0d1020f41a11942791;p=rtos%2Ftinyara.git Audio: Fix issue of ac_type always coming as AUDIO_TYPE_OUTPUT --- diff --git a/framework/src/tinyalsa/tinyalsa.c b/framework/src/tinyalsa/tinyalsa.c index 976dd2f..c0c3e2c 100644 --- a/framework/src/tinyalsa/tinyalsa.c +++ b/framework/src/tinyalsa/tinyalsa.c @@ -934,6 +934,7 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, unsigned int flags, #ifdef CONFIG_AUDIO_FORMAT_PCM if (pcm->flags & PCM_IN) { struct ap_buffer_s *apb = (struct ap_buffer_s *)pcm->pBuffers[0]; + apb->flags = AUDIO_APB_TYPE_INPUT; if (apb->nmaxbytes - apb->nbytes >= sizeof(struct wav_header_s)) { struct wav_header_s *wav = (struct wav_header_s *)(&apb->samp[0]); diff --git a/os/audio/pcm_decode.c b/os/audio/pcm_decode.c index 027f027..4c0c2ec 100644 --- a/os/audio/pcm_decode.c +++ b/os/audio/pcm_decode.c @@ -872,7 +872,6 @@ static int pcm_resume(FAR struct audio_lowerhalf_s *dev, FAR void *session) #else static int pcm_resume(FAR struct audio_lowerhalf_s *dev) #endif -#endif { FAR struct pcm_decode_s *priv = (FAR struct pcm_decode_s *)dev; FAR struct audio_lowerhalf_s *lower; @@ -891,6 +890,7 @@ static int pcm_resume(FAR struct audio_lowerhalf_s *dev) return lower->ops->resume(lower); #endif } +#endif /**************************************************************************** * Name: pcm_allocbuffer @@ -1027,7 +1027,11 @@ static int pcm_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, FAR struct ap_bu DEBUGASSERT(priv->samprate < 65535); caps.ac_len = sizeof(struct audio_caps_s); - caps.ac_type = AUDIO_TYPE_OUTPUT; + if (apb->flags & AUDIO_APB_TYPE_INPUT) { + caps.ac_type = AUDIO_TYPE_INPUT; + } else { + caps.ac_type = AUDIO_TYPE_OUTPUT; + } caps.ac_channels = priv->nchannels; caps.ac_controls.hw[0] = (uint16_t) priv->samprate; diff --git a/os/drivers/audio/alc5658.c b/os/drivers/audio/alc5658.c index 8de592d..188f06c 100644 --- a/os/drivers/audio/alc5658.c +++ b/os/drivers/audio/alc5658.c @@ -534,7 +534,7 @@ static int alc5658_configure(FAR struct audio_lowerhalf_s *dev, FAR const struct } break; /* Break for inner switch case */ case AUDIO_TYPE_INPUT: { - audvdbg(" AUDIO_TYPE_OUTPUT:\n"); + audvdbg(" AUDIO_TYPE_INPUT:\n"); /* Verify that all of the requested values are supported */ ret = -ERANGE; diff --git a/os/include/tinyara/audio/audio.h b/os/include/tinyara/audio/audio.h index 7b5f48f..f2916e1 100644 --- a/os/include/tinyara/audio/audio.h +++ b/os/include/tinyara/audio/audio.h @@ -313,6 +313,8 @@ #define AUDIO_APB_DEQUEUED (1 << 2) #define AUDIO_APB_FINAL (1 << 3) /* Last buffer in the stream */ +#define AUDIO_APB_TYPE_INPUT (1 << 4) +#define AUDIO_APB_TYPE_OUTPUT (1 << 5) /**************************************************************************** * Public Types ****************************************************************************/