You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/09/27 07:35:59 UTC
[incubator-nuttx-apps] branch master updated: nxplayer&nxrecoder:
add channel map support
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new a375f64 nxplayer&nxrecoder: add channel map support
a375f64 is described below
commit a375f64f8187908519db86bac57869cdf1527305
Author: licheng <ch...@bestechnic.com>
AuthorDate: Sat Sep 12 15:19:01 2020 +0800
nxplayer&nxrecoder: add channel map support
Change-Id: I5e5534e7330d816533a6894cf3cd8c4e19984c6f
Signed-off-by: ligd <li...@xiaomi.com>
---
include/system/nxplayer.h | 3 ++-
include/system/nxrecorder.h | 4 ++--
system/nxplayer/nxplayer.c | 15 ++++++++++-----
system/nxplayer/nxplayer_main.c | 7 +++++--
system/nxrecorder/nxrecorder.c | 4 +++-
system/nxrecorder/nxrecorder_main.c | 7 +++++--
6 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/include/system/nxplayer.h b/include/system/nxplayer.h
index d2a12fe..8f0493b 100644
--- a/include/system/nxplayer.h
+++ b/include/system/nxplayer.h
@@ -222,6 +222,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
* nchannels channel num
* bpsampe bit width
* samprate sample rate
+ * chmap channel map
*
* Returned Value:
* OK if file found, device found, and playback started.
@@ -230,7 +231,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
int nxplayer_playraw(FAR struct nxplayer_s *pplayer,
FAR const char *filename, uint8_t nchannels,
- uint8_t bpsamp, uint32_t samprate);
+ uint8_t bpsamp, uint32_t samprate, uint8_t chmap);
/****************************************************************************
* Name: nxplayer_stop
diff --git a/include/system/nxrecorder.h b/include/system/nxrecorder.h
index f71c46d..7a4ad39 100644
--- a/include/system/nxrecorder.h
+++ b/include/system/nxrecorder.h
@@ -163,7 +163,7 @@ int nxrecorder_setdevice(FAR struct nxrecorder_s *precorder,
* nchannels - channels num
* bpsampe - bit width
* samprate - sample rate
- *
+ * chmap channel map
*
* Returned Value:
* OK if file found, device found, and recordback started.
@@ -172,7 +172,7 @@ int nxrecorder_setdevice(FAR struct nxrecorder_s *precorder,
int nxrecorder_recordraw(FAR struct nxrecorder_s *precorder,
FAR const char *filename, uint8_t nchannels,
- uint8_t bpsamp, uint32_t samprate);
+ uint8_t bpsamp, uint32_t samprate, uint8_t chmap);
/****************************************************************************
* Name: nxrecorder_stop
diff --git a/system/nxplayer/nxplayer.c b/system/nxplayer/nxplayer.c
index 24b4660..bb178f3 100644
--- a/system/nxplayer/nxplayer.c
+++ b/system/nxplayer/nxplayer.c
@@ -1768,7 +1768,8 @@ int nxplayer_stop(FAR struct nxplayer_s *pplayer)
* determined by nxplayer_playfile()
* nchannels channels num (raw data playback needed)
* bpsamp bits pre sample (raw data playback needed)
- * samplrate samplre rate (raw data playback needed)
+ * samprate samplre rate (raw data playback needed)
+ * chmap channel map (raw data playback needed)
*
* Returns:
* OK File is being played
@@ -1783,7 +1784,8 @@ int nxplayer_stop(FAR struct nxplayer_s *pplayer)
static int nxplayer_playinternal(FAR struct nxplayer_s *pplayer,
FAR const char *pfilename, int filefmt,
int subfmt, uint8_t nchannels,
- uint8_t bpsamp, uint32_t samprate)
+ uint8_t bpsamp, uint32_t samprate,
+ uint8_t chmap)
{
struct mq_attr attr;
struct sched_param sparam;
@@ -1917,6 +1919,7 @@ static int nxplayer_playinternal(FAR struct nxplayer_s *pplayer,
cap_desc.caps.ac_len = sizeof(struct audio_caps_s);
cap_desc.caps.ac_type = AUDIO_TYPE_OUTPUT;
cap_desc.caps.ac_channels = nchannels;
+ cap_desc.caps.ac_chmap = chmap;
cap_desc.caps.ac_controls.hw[0] = samprate;
cap_desc.caps.ac_controls.b[3] = samprate >> 16;
cap_desc.caps.ac_controls.b[2] = bpsamp;
@@ -2026,7 +2029,8 @@ err_out_nodev:
int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
FAR const char *pfilename, int filefmt, int subfmt)
{
- return nxplayer_playinternal(pplayer, pfilename, filefmt, subfmt, 0, 0, 0);
+ return nxplayer_playinternal(pplayer, pfilename, filefmt,
+ subfmt, 0, 0, 0, 0);
}
/****************************************************************************
@@ -2043,6 +2047,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
* nchannels channel num
* bpsampe bit width
* samprate sample rate
+ * chmap channel map
*
* Returns:
* OK File is being played
@@ -2055,7 +2060,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
int nxplayer_playraw(FAR struct nxplayer_s *pplayer,
FAR const char *pfilename, uint8_t nchannels,
- uint8_t bpsamp, uint32_t samprate)
+ uint8_t bpsamp, uint32_t samprate, uint8_t chmap)
{
if (nchannels == 0)
{
@@ -2073,7 +2078,7 @@ int nxplayer_playraw(FAR struct nxplayer_s *pplayer,
}
return nxplayer_playinternal(pplayer, pfilename, AUDIO_FMT_PCM, 0,
- nchannels, bpsamp, samprate);
+ nchannels, bpsamp, samprate, chmap);
}
/****************************************************************************
diff --git a/system/nxplayer/nxplayer_main.c b/system/nxplayer/nxplayer_main.c
index be1d8f6..1188734 100644
--- a/system/nxplayer/nxplayer_main.c
+++ b/system/nxplayer/nxplayer_main.c
@@ -329,13 +329,16 @@ static int nxplayer_cmd_playraw(FAR struct nxplayer_s *pplayer, char *parg)
int channels = 0;
int bpsamp = 0;
int samprate = 0;
+ int chmap = 0;
char filename[128];
- sscanf(parg, "%s %d %d %d", filename, &channels, &bpsamp, &samprate);
+ sscanf(parg, "%s %d %d %d", filename, &channels, &bpsamp,
+ &samprate, &chmap);
/* Try to play the file specified */
- ret = nxplayer_playraw(pplayer, filename, channels, bpsamp, samprate);
+ ret = nxplayer_playraw(pplayer, filename, channels,
+ bpsamp, samprate, chmap);
/* nxplayer_playfile returned values:
*
diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c
index cd75438..ded4ae9 100644
--- a/system/nxrecorder/nxrecorder.c
+++ b/system/nxrecorder/nxrecorder.c
@@ -749,6 +749,7 @@ int nxrecorder_stop(FAR struct nxrecorder_s *precorder)
* nchannels channel num
* bpsampe bit width
* samprate sample rate
+ * chmap channel map
*
* Returns:
* OK File is being recorded
@@ -761,7 +762,7 @@ int nxrecorder_stop(FAR struct nxrecorder_s *precorder)
int nxrecorder_recordraw(FAR struct nxrecorder_s *precorder,
FAR const char *pfilename, uint8_t nchannels,
- uint8_t bpsamp, uint32_t samprate)
+ uint8_t bpsamp, uint32_t samprate, uint8_t chmap)
{
struct mq_attr attr;
struct sched_param sparam;
@@ -826,6 +827,7 @@ int nxrecorder_recordraw(FAR struct nxrecorder_s *precorder,
cap_desc.caps.ac_len = sizeof(struct audio_caps_s);
cap_desc.caps.ac_type = AUDIO_TYPE_INPUT;
cap_desc.caps.ac_channels = nchannels ? nchannels : 2;
+ cap_desc.caps.ac_chmap = chmap;
cap_desc.caps.ac_controls.hw[0] = samprate ? samprate : 48000;
cap_desc.caps.ac_controls.b[3] = samprate >> 16;
cap_desc.caps.ac_controls.b[2] = bpsamp ? bpsamp : 16;
diff --git a/system/nxrecorder/nxrecorder_main.c b/system/nxrecorder/nxrecorder_main.c
index 4352f96..15f741b 100644
--- a/system/nxrecorder/nxrecorder_main.c
+++ b/system/nxrecorder/nxrecorder_main.c
@@ -178,9 +178,11 @@ static int nxrecorder_cmd_recordraw(FAR struct nxrecorder_s *precorder,
int channels = 0;
int bpsamp = 0;
int samprate = 0;
+ int chmap = 0;
char filename[128];
- sscanf(parg, "%s %d %d %d", filename, &channels, &bpsamp, &samprate);
+ sscanf(parg, "%s %d %d %d %d", filename, &channels, &bpsamp,
+ &samprate, &chmap);
/* Try to record the file specified */
@@ -188,7 +190,8 @@ static int nxrecorder_cmd_recordraw(FAR struct nxrecorder_s *precorder,
filename,
channels,
bpsamp,
- samprate);
+ samprate,
+ chmap);
/* nxrecorder_recordfile returned values:
*