2013-10-27 14:23:01 +01:00
|
|
|
/****************************************************************************
|
2016-07-01 14:48:22 +02:00
|
|
|
* apps/include/system/nxplayer.h
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-07-24 16:28:10 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-07-01 14:48:22 +02:00
|
|
|
#ifndef __APPS_INCLUDE_SYSTEM_NXPLAYER_H
|
2020-01-31 16:18:05 +01:00
|
|
|
#define __APPS_INCLUDE_SYSTEM_NXPLAYER_H
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2020-12-31 10:09:14 +01:00
|
|
|
#include <mqueue.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <semaphore.h>
|
|
|
|
|
2013-10-27 14:23:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Declarations
|
|
|
|
****************************************************************************/
|
2020-04-21 17:32:44 +02:00
|
|
|
|
2022-11-30 02:27:36 +01:00
|
|
|
struct nxplayer_dec_ops_s
|
|
|
|
{
|
|
|
|
int format;
|
|
|
|
CODE int (*pre_parse)(int fd, FAR uint32_t *samplerate,
|
|
|
|
FAR uint8_t *chans, FAR uint8_t *bps);
|
|
|
|
CODE int (*fill_data)(int fd, FAR struct ap_buffer_s *apb);
|
|
|
|
};
|
|
|
|
|
2014-07-24 16:28:10 +02:00
|
|
|
/* This structure describes the internal state of the NxPlayer */
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
struct nxplayer_s
|
|
|
|
{
|
2020-04-21 17:32:44 +02:00
|
|
|
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 */
|
2013-10-27 14:23:01 +01:00
|
|
|
#ifdef CONFIG_NXPLAYER_INCLUDE_PREFERRED_DEVICE
|
|
|
|
char prefdevice[CONFIG_NAME_MAX]; /* Preferred audio device */
|
2020-04-21 17:32:44 +02:00
|
|
|
int prefformat; /* Formats supported by preferred device */
|
|
|
|
int preftype; /* Types supported by preferred device */
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_NXPLAYER_INCLUDE_MEDIADIR
|
|
|
|
char mediadir[CONFIG_NAME_MAX]; /* Root media directory where media is located */
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_AUDIO_MULTI_SESSION
|
2020-02-23 05:51:44 +01:00
|
|
|
FAR void *session; /* Session assignment from device */
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
|
|
|
uint16_t volume; /* Volume as a whole percentage (0-100) */
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_BALANCE
|
|
|
|
uint16_t balance; /* Balance as a whole % (0=left off, 100=right off) */
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_TONE
|
|
|
|
uint16_t treble; /* Treble as a whole % */
|
|
|
|
uint16_t bass; /* Bass as a whole % */
|
|
|
|
#endif
|
2022-11-30 02:27:36 +01:00
|
|
|
|
|
|
|
FAR const struct nxplayer_dec_ops_s *ops;
|
2013-10-27 14:23:01 +01:00
|
|
|
};
|
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
typedef int (*nxplayer_func)(FAR struct nxplayer_s *pplayer, char *pargs);
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2014-07-24 02:21:08 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2013-10-27 14:23:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_create
|
|
|
|
*
|
2013-10-27 14:45:16 +01:00
|
|
|
* Allocates and Initializes a NxPlayer context that is passed to all
|
|
|
|
* nxplayer routines. The player MUST be destroyed using the
|
2013-10-27 14:23:01 +01:00
|
|
|
* nxplayer_destroy() routine since the context is reference counted.
|
|
|
|
* The context can be used in a mode where the caller creates the
|
|
|
|
* context, starts a file playing, and then forgets about the context
|
2013-10-27 14:45:16 +01:00
|
|
|
* and it will self free. This is because the nxplayer_playfile
|
2013-10-27 14:23:01 +01:00
|
|
|
* will also create a reference to the context, so the client calling
|
|
|
|
* nxplayer_destroy() won't actually de-allocate anything. The freeing
|
|
|
|
* will occur after the playthread has completed.
|
|
|
|
*
|
2020-02-23 05:51:44 +01:00
|
|
|
* Alternately, the caller can create the object and hold on to it, then
|
2013-10-27 14:23:01 +01:00
|
|
|
* the context will persist until the original creator destroys it.
|
|
|
|
*
|
|
|
|
* Input Parameters: None
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* Pointer to created NxPlayer context or NULL if error.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
FAR struct nxplayer_s *nxplayer_create(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_release
|
|
|
|
*
|
|
|
|
* Reduces the reference count to the player and if it reaches zero,
|
|
|
|
* frees all memory used by the context.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer Pointer to the NxPlayer context
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
|
|
|
* None
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
void nxplayer_release(FAR struct nxplayer_s *pplayer);
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_reference
|
|
|
|
*
|
|
|
|
* Increments the reference count to the player.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer Pointer to the NxPlayer context
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
|
|
|
* None
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
void nxplayer_reference(FAR struct nxplayer_s *pplayer);
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_setdevice
|
|
|
|
*
|
2013-10-27 14:45:16 +01:00
|
|
|
* Sets the preferred Audio device to use with the instance of the
|
2013-10-27 14:23:01 +01:00
|
|
|
* nxplayer. Without a preferred device set, the nxplayer will search
|
2013-10-27 14:45:16 +01:00
|
|
|
* the audio subsystem to find a suitable device depending on the
|
|
|
|
* type of audio operation requested (i.e. an MP3 decoder device when
|
2013-10-27 14:23:01 +01:00
|
|
|
* playing an MP3 file, a WAV decoder device for a WAV file, etc.).
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* device - Pointer to pathname of the preferred device
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if context initialized successfully, error code otherwise.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_setdevice(FAR struct nxplayer_s *pplayer,
|
2014-07-24 23:06:54 +02:00
|
|
|
FAR const char *device);
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_playfile
|
|
|
|
*
|
|
|
|
* Plays the specified media file (from the filesystem) using the
|
|
|
|
* Audio system. If a preferred device has been set, that device
|
2013-10-27 14:45:16 +01:00
|
|
|
* will be used for the playback, otherwise the first suitable device
|
2013-10-27 14:23:01 +01:00
|
|
|
* found in the /dev/audio directory will be used.
|
2013-10-27 14:45:16 +01:00
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* filename - Pointer to pathname of the file to play
|
2013-10-27 14:45:16 +01:00
|
|
|
* filefmt - Format of audio in filename if known, AUDIO_FMT_UNDEF
|
2013-10-27 14:23:01 +01:00
|
|
|
* to let nxplayer_playfile() determine automatically.
|
2013-10-28 19:11:52 +01:00
|
|
|
* subfmt - Sub-Format of audio in filename if known, AUDIO_FMT_UNDEF
|
|
|
|
* to let nxplayer_playfile() determine automatically.
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_playfile(FAR struct nxplayer_s *pplayer,
|
2014-07-24 23:06:54 +02:00
|
|
|
FAR const char *filename, int filefmt, int subfmt);
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2018-08-27 16:04:48 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_playraw
|
|
|
|
*
|
|
|
|
* Plays the specified media file (from the filesystem) using the
|
|
|
|
* Audio system. If a preferred device has been set, that device
|
|
|
|
* will be used for the playback, otherwise the first suitable device
|
|
|
|
* found in the /dev/audio directory will be used.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2018-08-27 16:04:48 +02:00
|
|
|
* filename - Pointer to pathname of the file to play
|
|
|
|
* nchannels channel num
|
|
|
|
* bpsampe bit width
|
|
|
|
* samprate sample rate
|
2020-09-12 09:19:01 +02:00
|
|
|
* chmap channel map
|
2018-08-27 16:04:48 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_playraw(FAR struct nxplayer_s *pplayer,
|
2018-08-27 16:04:48 +02:00
|
|
|
FAR const char *filename, uint8_t nchannels,
|
2020-09-12 09:19:01 +02:00
|
|
|
uint8_t bpsamp, uint32_t samprate, uint8_t chmap);
|
2018-08-27 16:04:48 +02:00
|
|
|
|
2013-10-27 14:23:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_stop
|
|
|
|
*
|
|
|
|
* Stops current playback.
|
2013-10-27 14:45:16 +01:00
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_stop(FAR struct nxplayer_s *pplayer);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_pause
|
|
|
|
*
|
|
|
|
* Pauses current playback.
|
2013-10-27 14:45:16 +01:00
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_pause(FAR struct nxplayer_s *pplayer);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_resume
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Resumes current playback.
|
2013-10-27 14:45:16 +01:00
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_resume(FAR struct nxplayer_s *pplayer);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
2014-07-24 16:28:10 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_fforward
|
|
|
|
*
|
|
|
|
* Selects to fast forward in the audio data stream. The fast forward
|
|
|
|
* operation can be cancelled by simply selected no sub-sampling with
|
2014-07-27 20:26:03 +02:00
|
|
|
* the AUDIO_SUBSAMPLE_NONE argument returning to normal 1x forward play.
|
2014-07-24 16:28:10 +02:00
|
|
|
*
|
|
|
|
* The preferred way to cancel a fast forward operation is via
|
|
|
|
* nxplayer_cancel_motion() that provides the option to also return to
|
|
|
|
* paused, non-playing state.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2014-07-24 16:28:10 +02:00
|
|
|
* subsample - Identifies the fast forward rate (in terms of sub-sampling,
|
2014-07-27 20:26:03 +02:00
|
|
|
* but does not explicitly require sub-sampling). See
|
|
|
|
* AUDIO_SUBSAMPLE_* definitions.
|
2014-07-24 16:28:10 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if fast forward operation successful.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2014-07-24 16:28:10 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_FFORWARD
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_fforward(FAR struct nxplayer_s *pplayer, uint8_t subsample);
|
2014-07-24 16:28:10 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_rewind
|
|
|
|
*
|
|
|
|
* Selects to rewind in the audio data stream. The rewind operation must
|
2014-07-27 20:26:03 +02:00
|
|
|
* be cancelled with nxplayer_cancel_motion. This function may be called
|
|
|
|
* multiple times to change rewind rate.
|
2014-07-24 16:28:10 +02:00
|
|
|
*
|
|
|
|
* NOTE that cancellation of the rewind operation differs from
|
|
|
|
* cancellation of the fast forward operation because we must both restore
|
|
|
|
* the sub-sampling rate to 1x and also return to forward play.
|
2014-07-27 20:26:03 +02:00
|
|
|
* AUDIO_SUBSAMPLE_NONE is not a valid argument to this function.
|
2014-07-24 16:28:10 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2014-07-24 16:28:10 +02:00
|
|
|
* subsample - Identifies the rewind rate (in terms of sub-sampling, but
|
2014-07-27 20:26:03 +02:00
|
|
|
* does not explicitly require sub-sampling). See
|
|
|
|
* AUDIO_SUBSAMPLE_* definitions.
|
2014-07-24 16:28:10 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if rewind operation successfully initiated.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2014-07-24 16:28:10 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_REWIND
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_rewind(FAR struct nxplayer_s *pplayer, uint8_t subsample);
|
2014-07-24 16:28:10 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_cancel_motion
|
|
|
|
*
|
|
|
|
* Cancel a rewind or fast forward operation and return to either the
|
|
|
|
* paused state or to the normal, forward play state.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2014-07-24 16:28:10 +02:00
|
|
|
* paused - True: return to the paused state, False: return to the 1X
|
|
|
|
* forward play state.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if rewind operation successfully cancelled.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2014-07-24 16:28:10 +02:00
|
|
|
|
|
|
|
#if !defined(CONFIG_AUDIO_EXCLUDE_FFORWARD) || !defined(CONFIG_AUDIO_EXCLUDE_REWIND)
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_cancel_motion(FAR struct nxplayer_s *pplayer, bool paused);
|
2014-07-24 16:28:10 +02:00
|
|
|
#endif
|
|
|
|
|
2013-10-27 14:23:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_setvolume
|
|
|
|
*
|
|
|
|
* Sets the playback volume. The volume is represented in 1/10th of a
|
|
|
|
* percent increments, so the range is 0-1000. A value of 10 would mean
|
2013-10-27 14:45:16 +01:00
|
|
|
* 1%.
|
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* volume - Volume level to set in 1/10th percent increments
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_setvolume(FAR struct nxplayer_s *pplayer, uint16_t volume);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_setbalance
|
|
|
|
*
|
|
|
|
* Sets the playback balance. The balance is represented in 1/10th of a
|
|
|
|
* percent increments, so the range is 0-1000. A value of 10 would mean
|
2013-10-27 14:45:16 +01:00
|
|
|
* 1%.
|
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* balance - Balance level to set in 1/10th percent increments
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_BALANCE
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_setbalance(FAR struct nxplayer_s *pplayer, uint16_t balance);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_setmediadir
|
|
|
|
*
|
|
|
|
* Sets the root media directory for non-path qualified file searches.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* mediadir - Pointer to pathname of the media directory
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
|
|
|
* None
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2020-04-21 17:32:44 +02:00
|
|
|
void nxplayer_setmediadir(FAR struct nxplayer_s *pplayer,
|
2014-07-24 23:06:54 +02:00
|
|
|
FAR const char *mediadir);
|
2013-10-27 14:23:01 +01:00
|
|
|
|
2014-07-24 16:28:10 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_setequalization
|
|
|
|
*
|
|
|
|
* Sets the level on each band of an equalizer. Each band setting is
|
|
|
|
* represented in one percent increments, so the range is 0-100.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2014-07-24 16:28:10 +02:00
|
|
|
* 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
|
|
|
|
* 0-100.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if equalization was set correctly.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2014-07-24 16:28:10 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_EQUALIZER
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_setequalization(FAR struct nxplayer_s *pplayer,
|
2014-07-24 16:28:10 +02:00
|
|
|
FAR uint8_t *equalization);
|
|
|
|
#endif
|
|
|
|
|
2013-10-27 14:23:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_setbass
|
|
|
|
*
|
|
|
|
* Sets the playback bass level. The bass is represented in one percent
|
2013-10-27 14:45:16 +01:00
|
|
|
* increments, so the range is 0-100.
|
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* bass - Bass level to set in one percent increments
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
|
|
|
* OK if the bass level was set successfully
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_TONE
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_setbass(FAR struct nxplayer_s *pplayer, uint8_t bass);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_settreble
|
|
|
|
*
|
|
|
|
* Sets the playback treble level. The bass is represented in one percent
|
2013-10-27 14:45:16 +01:00
|
|
|
* increments, so the range is 0-100.
|
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
* treble - Treble level to set in one percent increments
|
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
|
|
|
* OK if the treble level was set successfully
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_AUDIO_EXCLUDE_TONE
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_settreble(FAR struct nxplayer_s *pplayer, uint8_t treble);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_systemreset
|
|
|
|
*
|
|
|
|
* Performs an audio system reset, including a hardware reset on all
|
|
|
|
* registered audio devices.
|
2013-10-27 14:45:16 +01:00
|
|
|
*
|
2013-10-27 14:23:01 +01:00
|
|
|
* Input Parameters:
|
2020-04-21 17:32:44 +02:00
|
|
|
* pplayer - Pointer to the context to initialize
|
2013-10-27 14:23:01 +01:00
|
|
|
*
|
2014-07-24 16:28:10 +02:00
|
|
|
* Returned Value:
|
2013-10-27 14:23:01 +01:00
|
|
|
* OK if file found, device found, and playback started.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-10-27 14:23:01 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_NXPLAYER_INCLUDE_SYSTEM_RESET
|
2020-04-21 17:32:44 +02:00
|
|
|
int nxplayer_systemreset(FAR struct nxplayer_s *pplayer);
|
2013-10-27 14:23:01 +01:00
|
|
|
#endif
|
|
|
|
|
2022-11-30 02:27:36 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_parse_mp3
|
|
|
|
*
|
|
|
|
* Performs pre-process when play mp3 file.
|
|
|
|
* Parse samplerate, channels, bps.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* pplayer - Pointer to the context to initialize
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if file parsed successfully.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nxplayer_parse_mp3(int fd, FAR uint32_t *samplerate,
|
|
|
|
FAR uint8_t *chans, FAR uint8_t *bps);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_fill_mp3
|
|
|
|
*
|
|
|
|
* Performs read mp3 frame to apb buffer
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* pplayer - Pointer to the context to initialize
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if file read successfully.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nxplayer_fill_mp3(int fd, FAR struct ap_buffer_s *apb);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxplayer_fill_pcm
|
|
|
|
*
|
|
|
|
* Performs read pcm file to apb buffer
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* pplayer - Pointer to the context to initialize
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if file read successfully.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nxplayer_fill_pcm(int fd, FAR struct ap_buffer_s *apb);
|
|
|
|
|
2014-07-24 02:21:08 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-07-01 14:48:22 +02:00
|
|
|
#endif /* __APPS_INCLUDE_SYSTEM_NXPLAYER_H */
|