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/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f150699d7a audio:add media session support for sim_alsa audio_ops_s
interface
f150699d7a is described below
commit f150699d7aed9046afcad7bdcc310c490fc7c037
Author: shipei <[email protected]>
AuthorDate: Wed Aug 16 19:51:48 2023 +0800
audio:add media session support for sim_alsa audio_ops_s interface
fix Compiler Warning:initialization of ‘int (*)(struct audio_lowerhalf_s *,
void *)’
from incompatible pointer type ‘int (*)(struct audio_lowerhalf_s *)’
[-Wincompatible-pointer-types]
Signed-off-by: shipei <[email protected]>
---
arch/sim/src/sim/posix/sim_alsa.c | 47 ++++++++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/arch/sim/src/sim/posix/sim_alsa.c
b/arch/sim/src/sim/posix/sim_alsa.c
index 0ffef89d67..366d74bfe8 100644
--- a/arch/sim/src/sim/posix/sim_alsa.c
+++ b/arch/sim/src/sim/posix/sim_alsa.c
@@ -79,11 +79,19 @@ static int sim_audio_getcaps(struct audio_lowerhalf_s *dev,
int type,
static int sim_audio_configure(struct audio_lowerhalf_s *dev,
void *session,
const struct audio_caps_s *caps);
+static int sim_audio_start(struct audio_lowerhalf_s *dev, void *session);
+#ifndef CONFIG_AUDIO_EXCLUDE_STOP
+static int sim_audio_stop(struct audio_lowerhalf_s *dev, void *session);
+#endif
+#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
+static int sim_audio_pause(struct audio_lowerhalf_s *dev, void *session);
+static int sim_audio_resume(struct audio_lowerhalf_s *dev, void *session);
+#endif
+static int sim_audio_reserve(struct audio_lowerhalf_s *dev, void **session);
+static int sim_audio_release(struct audio_lowerhalf_s *dev, void *session);
#else
static int sim_audio_configure(struct audio_lowerhalf_s *dev,
const struct audio_caps_s *caps);
-#endif
-static int sim_audio_shutdown(struct audio_lowerhalf_s *dev);
static int sim_audio_start(struct audio_lowerhalf_s *dev);
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
static int sim_audio_stop(struct audio_lowerhalf_s *dev);
@@ -92,13 +100,14 @@ static int sim_audio_stop(struct audio_lowerhalf_s *dev);
static int sim_audio_pause(struct audio_lowerhalf_s *dev);
static int sim_audio_resume(struct audio_lowerhalf_s *dev);
#endif
+static int sim_audio_reserve(struct audio_lowerhalf_s *dev);
+static int sim_audio_release(struct audio_lowerhalf_s *dev);
+#endif
+static int sim_audio_shutdown(struct audio_lowerhalf_s *dev);
static int sim_audio_enqueuebuffer(struct audio_lowerhalf_s *dev,
struct ap_buffer_s *apb);
static int sim_audio_ioctl(struct audio_lowerhalf_s *dev, int cmd,
unsigned long arg);
-static int sim_audio_reserve(struct audio_lowerhalf_s *dev);
-static int sim_audio_release(struct audio_lowerhalf_s *dev);
-
/****************************************************************************
* Private Data
****************************************************************************/
@@ -467,7 +476,11 @@ static int sim_audio_shutdown(struct audio_lowerhalf_s
*dev)
return 0;
}
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+static int sim_audio_start(struct audio_lowerhalf_s *dev, void *session)
+#else
static int sim_audio_start(struct audio_lowerhalf_s *dev)
+#endif
{
struct sim_audio_s *priv = (struct sim_audio_s *)dev;
struct audio_buf_desc_s buf_desc;
@@ -488,7 +501,11 @@ static int sim_audio_start(struct audio_lowerhalf_s *dev)
}
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+static int sim_audio_stop(struct audio_lowerhalf_s *dev, void *session)
+#else
static int sim_audio_stop(struct audio_lowerhalf_s *dev)
+#endif
{
struct sim_audio_s *priv = (struct sim_audio_s *)dev;
int ret;
@@ -532,7 +549,11 @@ static int sim_audio_stop(struct audio_lowerhalf_s *dev)
#endif
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+static int sim_audio_pause(struct audio_lowerhalf_s *dev, void *session)
+#else
static int sim_audio_pause(struct audio_lowerhalf_s *dev)
+#endif
{
struct sim_audio_s *priv = (struct sim_audio_s *)dev;
@@ -545,7 +566,11 @@ static int sim_audio_pause(struct audio_lowerhalf_s *dev)
return 0;
}
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+static int sim_audio_resume(struct audio_lowerhalf_s *dev, void *session)
+#else
static int sim_audio_resume(struct audio_lowerhalf_s *dev)
+#endif
{
struct sim_audio_s *priv = (struct sim_audio_s *)dev;
@@ -719,12 +744,20 @@ static int sim_audio_ioctl(struct audio_lowerhalf_s *dev,
int cmd,
return ret;
}
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+static int sim_audio_reserve(struct audio_lowerhalf_s *dev, void **session)
+#else
static int sim_audio_reserve(struct audio_lowerhalf_s *dev)
+#endif
{
return 0;
}
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+static int sim_audio_release(struct audio_lowerhalf_s *dev, void *session)
+#else
static int sim_audio_release(struct audio_lowerhalf_s *dev)
+#endif
{
return 0;
}
@@ -941,7 +974,11 @@ static void sim_audio_process(struct sim_audio_s *priv)
if (final)
{
snd_pcm_drain(priv->pcm);
+#ifdef CONFIG_AUDIO_MULTI_SESSION
+ sim_audio_stop(&priv->dev, NULL);
+#else
sim_audio_stop(&priv->dev);
+#endif
}
}