nuttx/audio: add channels range
use the upper 4bits in ac_channels to indicate the minimum channels. Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
This commit is contained in:
parent
ff6f280b95
commit
653ea69927
@ -176,6 +176,8 @@ static int audio_comp_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
FAR struct audio_comp_priv_s *priv = (FAR struct audio_comp_priv_s *)dev;
|
||||
FAR struct audio_lowerhalf_s **lower = priv->lower;
|
||||
int ret = -ENOTTY;
|
||||
int max = UINT8_MAX;
|
||||
int min = 0;
|
||||
int i;
|
||||
|
||||
caps->ac_channels = UINT8_MAX;
|
||||
@ -200,9 +202,14 @@ static int audio_comp_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
break;
|
||||
}
|
||||
|
||||
if (caps->ac_channels > dup.ac_channels)
|
||||
if (max > (dup.ac_channels & 0x0f))
|
||||
{
|
||||
caps->ac_channels = dup.ac_channels;
|
||||
max = dup.ac_channels & 0x0f;
|
||||
}
|
||||
|
||||
if (min < (dup.ac_channels & 0xf0))
|
||||
{
|
||||
min = dup.ac_channels & 0xf0;
|
||||
}
|
||||
|
||||
caps->ac_format.hw &= dup.ac_format.hw;
|
||||
@ -210,6 +217,8 @@ static int audio_comp_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
|
||||
}
|
||||
}
|
||||
|
||||
caps->ac_channels = max | min;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,8 @@ struct audio_caps_s
|
||||
uint8_t ac_len; /* Length of the structure */
|
||||
uint8_t ac_type; /* Capabilities (device) type */
|
||||
uint8_t ac_subtype; /* Capabilities sub-type, if needed */
|
||||
uint8_t ac_channels; /* Number of channels (1, 2, 3, ... 8) */
|
||||
uint8_t ac_channels; /* Number of channels (1, 2, 3, ... 15) upper 4 bits for minimum channels,
|
||||
* lower 4 bits for maximum channels */
|
||||
uint8_t ac_chmap; /* Channel map, each ch for each bit,
|
||||
* zero means don't care */
|
||||
uint8_t reserved; /* Reserved for future use */
|
||||
|
Loading…
x
Reference in New Issue
Block a user