system: nxplayer & nxrecorder: nxstyle fixes

nxstyle fixes for nxplayer & nxrecorder apps

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2020-04-21 17:32:44 +02:00 • committed by patacongo
parent 1697c64994
commit 2749e6467b
7 changed files with 558 additions and 391 deletions

View file

@ -82,7 +82,7 @@ namespace NxWM
struct SStartWindowMessage
{
enum EStartWindowMessageOpcodes msgId; /**< The message opcode */
enum EStartWindowMessageOpcodes msg_id; /**< The message opcode */
FAR void *instance; /**< Object instance. */
};

View file

@ -53,22 +53,23 @@
/****************************************************************************
* Public Type Declarations
****************************************************************************/
/* This structure describes the internal state of the NxPlayer */
struct nxplayer_s
{
int state; /* Current player state */
int devFd; /* File descriptor of active device */
mqd_t mq; /* Message queue for the playthread */
char mqname[16]; /* Name of our message queue */
pthread_t playId; /* Thread ID of the playthread */
int crefs; /* Number of references to the player */
sem_t sem; /* Thread sync semaphore */
int fd; /* File descriptor of open file */
int state; /* Current player state */
int dev_fd; /* File descriptor of active device */
mqd_t mq; /* Message queue for the playthread */
char mqname[16]; /* Name of our message queue */
pthread_t play_id; /* Thread ID of the playthread */
int crefs; /* Number of references to the player */
sem_t sem; /* Thread sync semaphore */
int fd; /* File descriptor of open file */
#ifdef CONFIG_NXPLAYER_INCLUDE_PREFERRED_DEVICE
char prefdevice[CONFIG_NAME_MAX]; /* Preferred audio device */
int prefformat; /* Formats supported by preferred device */
int preftype; /* Types supported by preferred device */
int prefformat; /* Formats supported by preferred device */
int preftype; /* Types supported by preferred device */
#endif
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
char mediadir[CONFIG_NAME_MAX]; /* Root media directory where media is located */
@ -88,7 +89,7 @@ struct nxplayer_s
#endif
};
typedef int (*nxplayer_func)(FAR struct nxplayer_s *pPlayer, char *pargs);
typedef int (*nxplayer_func)(FAR struct nxplayer_s *pplayer, char *pargs);
/****************************************************************************
* Public Data
@ -138,14 +139,14 @@ FAR struct nxplayer_s *nxplayer_create(void);
* frees all memory used by the context.
*
* Input Parameters:
* pPlayer Pointer to the NxPlayer context
* pplayer Pointer to the NxPlayer context
*
* Returned Value:
* None
*
****************************************************************************/
void nxplayer_release(FAR struct nxplayer_s *pPlayer);
void nxplayer_release(FAR struct nxplayer_s *pplayer);
/****************************************************************************
* Name: nxplayer_reference
@ -153,14 +154,14 @@ void nxplayer_release(FAR struct nxplayer_s *pPlayer);
* Increments the reference count to the player.
*
* Input Parameters:
* pPlayer Pointer to the NxPlayer context
* pplayer Pointer to the NxPlayer context
*
* Returned Value:
* None
*
****************************************************************************/
void nxplayer_reference(FAR struct nxplayer_s *pPlayer);
void nxplayer_reference(FAR struct nxplayer_s *pplayer);
/****************************************************************************
* Name: nxplayer_setdevice
@ -172,7 +173,7 @@ void nxplayer_reference(FAR struct nxplayer_s *pPlayer);
* playing an MP3 file, a WAV decoder device for a WAV file, etc.).
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* device - Pointer to pathname of the preferred device
*
* Returned Value:
@ -180,7 +181,7 @@ void nxplayer_reference(FAR struct nxplayer_s *pPlayer);
*
****************************************************************************/
int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer,
int nxplayer_setdevice(FAR struct nxplayer_s *pplayer,
FAR const char *device);
/****************************************************************************
@ -192,7 +193,7 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer,
* found in the /dev/audio directory will be used.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* filename - Pointer to pathname of the file to play
* filefmt - Format of audio in filename if known, AUDIO_FMT_UNDEF
* to let nxplayer_playfile() determine automatically.
@ -204,7 +205,7 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer,
*
****************************************************************************/
int nxplayer_playfile(FAR struct nxplayer_s *pPlayer,
int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
FAR const char *filename, int filefmt, int subfmt);
/****************************************************************************
@ -216,7 +217,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer,
* found in the /dev/audio directory will be used.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* filename - Pointer to pathname of the file to play
* nchannels channel num
* bpsampe bit width
@ -227,7 +228,7 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer,
*
****************************************************************************/
int nxplayer_playraw(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);
@ -237,7 +238,7 @@ int nxplayer_playraw(FAR struct nxplayer_s *pPlayer,
* Stops current playback.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and playback started.
@ -245,7 +246,7 @@ int nxplayer_playraw(FAR struct nxplayer_s *pPlayer,
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
int nxplayer_stop(FAR struct nxplayer_s *pPlayer);
int nxplayer_stop(FAR struct nxplayer_s *pplayer);
#endif
/****************************************************************************
@ -254,7 +255,7 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer);
* Pauses current playback.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and playback started.
@ -262,7 +263,7 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
int nxplayer_pause(FAR struct nxplayer_s *pPlayer);
int nxplayer_pause(FAR struct nxplayer_s *pplayer);
#endif
/****************************************************************************
@ -271,7 +272,7 @@ int nxplayer_pause(FAR struct nxplayer_s *pPlayer);
* Resumes current playback.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and playback started.
@ -279,7 +280,7 @@ int nxplayer_pause(FAR struct nxplayer_s *pPlayer);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
int nxplayer_resume(FAR struct nxplayer_s *pPlayer);
int nxplayer_resume(FAR struct nxplayer_s *pplayer);
#endif
/****************************************************************************
@ -294,7 +295,7 @@ int nxplayer_resume(FAR struct nxplayer_s *pPlayer);
* paused, non-playing state.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* subsample - Identifies the fast forward rate (in terms of sub-sampling,
* but does not explicitly require sub-sampling). See
* AUDIO_SUBSAMPLE_* definitions.
@ -305,7 +306,7 @@ int nxplayer_resume(FAR struct nxplayer_s *pPlayer);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_FFORWARD
int nxplayer_fforward(FAR struct nxplayer_s *pPlayer, uint8_t subsample);
int nxplayer_fforward(FAR struct nxplayer_s *pplayer, uint8_t subsample);
#endif
/****************************************************************************
@ -321,7 +322,7 @@ int nxplayer_fforward(FAR struct nxplayer_s *pPlayer, uint8_t subsample);
* AUDIO_SUBSAMPLE_NONE is not a valid argument to this function.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* subsample - Identifies the rewind rate (in terms of sub-sampling, but
* does not explicitly require sub-sampling). See
* AUDIO_SUBSAMPLE_* definitions.
@ -332,7 +333,7 @@ int nxplayer_fforward(FAR struct nxplayer_s *pPlayer, uint8_t subsample);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_REWIND
int nxplayer_rewind(FAR struct nxplayer_s *pPlayer, uint8_t subsample);
int nxplayer_rewind(FAR struct nxplayer_s *pplayer, uint8_t subsample);
#endif
/****************************************************************************
@ -342,7 +343,7 @@ int nxplayer_rewind(FAR struct nxplayer_s *pPlayer, uint8_t subsample);
* paused state or to the normal, forward play state.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* paused - True: return to the paused state, False: return to the 1X
* forward play state.
*
@ -352,7 +353,7 @@ int nxplayer_rewind(FAR struct nxplayer_s *pPlayer, uint8_t subsample);
****************************************************************************/
#if !defined(CONFIG_AUDIO_EXCLUDE_FFORWARD) || !defined(CONFIG_AUDIO_EXCLUDE_REWIND)
int nxplayer_cancel_motion(FAR struct nxplayer_s *pPlayer, bool paused);
int nxplayer_cancel_motion(FAR struct nxplayer_s *pplayer, bool paused);
#endif
/****************************************************************************
@ -363,7 +364,7 @@ int nxplayer_cancel_motion(FAR struct nxplayer_s *pPlayer, bool paused);
* 1%.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* volume - Volume level to set in 1/10th percent increments
*
* Returned Value:
@ -372,7 +373,7 @@ int nxplayer_cancel_motion(FAR struct nxplayer_s *pPlayer, bool paused);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
int nxplayer_setvolume(FAR struct nxplayer_s *pPlayer, uint16_t volume);
int nxplayer_setvolume(FAR struct nxplayer_s *pplayer, uint16_t volume);
#endif
/****************************************************************************
@ -383,7 +384,7 @@ int nxplayer_setvolume(FAR struct nxplayer_s *pPlayer, uint16_t volume);
* 1%.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* balance - Balance level to set in 1/10th percent increments
*
* Returned Value:
@ -393,7 +394,7 @@ int nxplayer_setvolume(FAR struct nxplayer_s *pPlayer, uint16_t volume);
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
#ifndef CONFIG_AUDIO_EXCLUDE_BALANCE
int nxplayer_setbalance(FAR struct nxplayer_s *pPlayer, uint16_t balance);
int nxplayer_setbalance(FAR struct nxplayer_s *pplayer, uint16_t balance);
#endif
#endif
@ -403,7 +404,7 @@ int nxplayer_setbalance(FAR struct nxplayer_s *pPlayer, uint16_t balance);
* Sets the root media directory for non-path qualified file searches.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* mediadir - Pointer to pathname of the media directory
*
* Returned Value:
@ -411,7 +412,7 @@ int nxplayer_setbalance(FAR struct nxplayer_s *pPlayer, uint16_t balance);
*
****************************************************************************/
void nxplayer_setmediadir(FAR struct nxplayer_s *pPlayer,
void nxplayer_setmediadir(FAR struct nxplayer_s *pplayer,
FAR const char *mediadir);
/****************************************************************************
@ -421,7 +422,7 @@ void nxplayer_setmediadir(FAR struct nxplayer_s *pPlayer,
* represented in one percent increments, so the range is 0-100.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* equalization - Pointer to array of equalizer settings of size
* CONFIG_AUDIO_EQUALIZER_NBANDS bytes. Each byte
* represents the setting for one band in the range of
@ -433,7 +434,7 @@ void nxplayer_setmediadir(FAR struct nxplayer_s *pPlayer,
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_EQUALIZER
int nxplayer_setequalization(FAR struct nxplayer_s *pPlayer,
int nxplayer_setequalization(FAR struct nxplayer_s *pplayer,
FAR uint8_t *equalization);
#endif
@ -444,7 +445,7 @@ int nxplayer_setequalization(FAR struct nxplayer_s *pPlayer,
* increments, so the range is 0-100.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* bass - Bass level to set in one percent increments
*
* Returned Value:
@ -453,7 +454,7 @@ int nxplayer_setequalization(FAR struct nxplayer_s *pPlayer,
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_TONE
int nxplayer_setbass(FAR struct nxplayer_s *pPlayer, uint8_t bass);
int nxplayer_setbass(FAR struct nxplayer_s *pplayer, uint8_t bass);
#endif
/****************************************************************************
@ -463,7 +464,7 @@ int nxplayer_setbass(FAR struct nxplayer_s *pPlayer, uint8_t bass);
* increments, so the range is 0-100.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
* treble - Treble level to set in one percent increments
*
* Returned Value:
@ -472,7 +473,7 @@ int nxplayer_setbass(FAR struct nxplayer_s *pPlayer, uint8_t bass);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_TONE
int nxplayer_settreble(FAR struct nxplayer_s *pPlayer, uint8_t treble);
int nxplayer_settreble(FAR struct nxplayer_s *pplayer, uint8_t treble);
#endif
/****************************************************************************
@ -482,7 +483,7 @@ int nxplayer_settreble(FAR struct nxplayer_s *pPlayer, uint8_t treble);
* registered audio devices.
*
* Input Parameters:
* pPlayer - Pointer to the context to initialize
* pplayer - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and playback started.
@ -490,7 +491,7 @@ int nxplayer_settreble(FAR struct nxplayer_s *pPlayer, uint8_t treble);
****************************************************************************/
#ifdef CONFIG_NXPLAYER_INCLUDE_SYSTEM_RESET
int nxplayer_systemreset(FAR struct nxplayer_s *pPlayer);
int nxplayer_systemreset(FAR struct nxplayer_s *pplayer);
#endif
#undef EXTERN

View file

@ -54,21 +54,22 @@
struct nxrecorder_s
{
int state; /* Current recorder state */
int devFd; /* File descriptor of active device */
mqd_t mq; /* Message queue for the recordthread */
char mqname[16]; /* Name of our message queue */
pthread_t recordId; /* Thread ID of the recordthread */
int crefs; /* Number of references to the recorder */
sem_t sem; /* Thread sync semaphore */
int fd; /* File descriptor of open file */
int state; /* Current recorder state */
int dev_fd; /* File descriptor of active device */
mqd_t mq; /* Message queue for the recordthread */
char mqname[16]; /* Name of our message queue */
pthread_t record_id; /* Thread ID of the recordthread */
int crefs; /* Number of references to the recorder */
sem_t sem; /* Thread sync semaphore */
int fd; /* File descriptor of open file */
char device[CONFIG_NAME_MAX]; /* Preferred audio device */
#ifdef CONFIG_AUDIO_MULTI_SESSION
FAR void *session; /* Session assignment from device */
FAR void *session; /* Session assignment from device */
#endif
};
typedef int (*nxrecorder_func)(FAR struct nxrecorder_s *pRecorder, char *pargs);
typedef int (*nxrecorder_func)(FAR struct nxrecorder_s *precorder,
char *pargs);
/****************************************************************************
* Public Data
@ -118,14 +119,14 @@ FAR struct nxrecorder_s *nxrecorder_create(void);
* frees all memory used by the context.
*
* Input Parameters:
* pRecorder Pointer to the NxRecorder context
* precorder Pointer to the NxRecorder context
*
* Returned Value:
* None
*
****************************************************************************/
void nxrecorder_release(FAR struct nxrecorder_s *pRecorder);
void nxrecorder_release(FAR struct nxrecorder_s *precorder);
/****************************************************************************
* Name: nxrecorder_reference
@ -133,14 +134,14 @@ void nxrecorder_release(FAR struct nxrecorder_s *pRecorder);
* Increments the reference count to the recorder.
*
* Input Parameters:
* pRecorder Pointer to the NxRecorder context
* precorder Pointer to the NxRecorder context
*
* Returned Value:
* None
*
****************************************************************************/
void nxrecorder_reference(FAR struct nxrecorder_s *pRecorder);
void nxrecorder_reference(FAR struct nxrecorder_s *precorder);
/****************************************************************************
* Name: nxrecorder_setdevice
@ -152,7 +153,7 @@ void nxrecorder_reference(FAR struct nxrecorder_s *pRecorder);
* recording an MP3 file, a WAV decoder device for a WAV file, etc.).
*
* Input Parameters:
* pRecorder - Pointer to the context to initialize
* precorder - Pointer to the context to initialize
* device - Pointer to pathname of the preferred device
*
* Returned Value:
@ -160,7 +161,7 @@ void nxrecorder_reference(FAR struct nxrecorder_s *pRecorder);
*
****************************************************************************/
int nxrecorder_setdevice(FAR struct nxrecorder_s *pRecorder,
int nxrecorder_setdevice(FAR struct nxrecorder_s *precorder,
FAR const char *device);
/****************************************************************************
@ -172,7 +173,7 @@ int nxrecorder_setdevice(FAR struct nxrecorder_s *pRecorder,
* found in the /dev/audio directory will be used.
*
* Input Parameters:
* pRecorder - Pointer to the context to initialize
* precorder - Pointer to the context to initialize
* filename - Pointer to pathname of the file to record
* nchannels - channels num
* bpsampe - bit width
@ -184,7 +185,7 @@ int nxrecorder_setdevice(FAR struct nxrecorder_s *pRecorder,
*
****************************************************************************/
int nxrecorder_recordraw(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);
@ -194,7 +195,7 @@ int nxrecorder_recordraw(FAR struct nxrecorder_s *pRecorder,
* Stops current recordback.
*
* Input Parameters:
* pRecorder - Pointer to the context to initialize
* precorder - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and recordback started.
@ -202,7 +203,7 @@ int nxrecorder_recordraw(FAR struct nxrecorder_s *pRecorder,
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
int nxrecorder_stop(FAR struct nxrecorder_s *pRecorder);
int nxrecorder_stop(FAR struct nxrecorder_s *precorder);
#endif
/****************************************************************************
@ -211,7 +212,7 @@ int nxrecorder_stop(FAR struct nxrecorder_s *pRecorder);
* Pauses current recordback.
*
* Input Parameters:
* pRecorder - Pointer to the context to initialize
* precorder - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and recordback started.
@ -219,7 +220,7 @@ int nxrecorder_stop(FAR struct nxrecorder_s *pRecorder);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
int nxrecorder_pause(FAR struct nxrecorder_s *pRecorder);
int nxrecorder_pause(FAR struct nxrecorder_s *precorder);
#endif
/****************************************************************************
@ -228,7 +229,7 @@ int nxrecorder_pause(FAR struct nxrecorder_s *pRecorder);
* Resumes current recordback.
*
* Input Parameters:
* pRecorder - Pointer to the context to initialize
* precorder - Pointer to the context to initialize
*
* Returned Value:
* OK if file found, device found, and recordback started.
@ -236,7 +237,7 @@ int nxrecorder_pause(FAR struct nxrecorder_s *pRecorder);
****************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
int nxrecorder_resume(FAR struct nxrecorder_s *pRecorder);
int nxrecorder_resume(FAR struct nxrecorder_s *precorder);
#endif
#undef EXTERN