Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions include/system/nxplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <mqueue.h>
#include <pthread.h>
#include <stdbool.h>

/****************************************************************************
* Pre-processor Definitions
Expand All @@ -40,12 +41,17 @@
* Public Type Declarations
****************************************************************************/

struct nxplayer_s;

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);
CODE int (*pre_parse)(FAR struct nxplayer_s *pplayer, int fd,
Comment thread
acassis marked this conversation as resolved.
Resolved
FAR uint32_t *samplerate,
FAR uint8_t *chans, FAR uint8_t *bps,
FAR int *subfmt);
CODE int (*fill_data)(FAR struct nxplayer_s *pplayer, int fd,
FAR struct ap_buffer_s *apb);
};

struct nxplayer_tone_s
Expand Down Expand Up @@ -92,6 +98,14 @@ struct nxplayer_s

FAR const struct nxplayer_dec_ops_s *ops;
struct nxplayer_tone_s tone;
uint32_t wav_data_remaining;
uint64_t wav_file_remaining;
uint64_t wav_header_size;
uint8_t wav_block_align;
int wav_error;
bool wav_playback;
bool wav_passthrough;
bool wav_fallback_ready;
};

typedef int (*nxplayer_func)(FAR struct nxplayer_s *pplayer, char *pargs);
Expand Down Expand Up @@ -539,8 +553,10 @@ int nxplayer_systemreset(FAR struct nxplayer_s *pplayer);
*
****************************************************************************/

int nxplayer_parse_mp3(int fd, FAR uint32_t *samplerate,
FAR uint8_t *chans, FAR uint8_t *bps);
int nxplayer_parse_mp3(FAR struct nxplayer_s *pplayer, int fd,
FAR uint32_t *samplerate,
FAR uint8_t *chans, FAR uint8_t *bps,
FAR int *subfmt);

/****************************************************************************
* Name: nxplayer_parse_sbc
Expand All @@ -556,8 +572,10 @@ int nxplayer_parse_mp3(int fd, FAR uint32_t *samplerate,
*
****************************************************************************/

int nxplayer_parse_sbc(int fd, FAR uint32_t *samplerate,
FAR uint8_t *chans, FAR uint8_t *bps);
int nxplayer_parse_sbc(FAR struct nxplayer_s *pplayer, int fd,
FAR uint32_t *samplerate,
FAR uint8_t *chans, FAR uint8_t *bps,
FAR int *subfmt);

/****************************************************************************
* Name: nxplayer_fill_mp3
Expand Down Expand Up @@ -587,7 +605,15 @@ int nxplayer_fill_mp3(int fd, FAR struct ap_buffer_s *apb);
*
****************************************************************************/

int nxplayer_fill_common(int fd, FAR struct ap_buffer_s *apb);
int nxplayer_fill_common(FAR struct nxplayer_s *pplayer, int fd,
FAR struct ap_buffer_s *apb);

#if defined(CONFIG_AUDIO_FORMAT_PCM) && \
defined(CONFIG_NXPLAYER_FMT_FROM_EXT)
extern const struct nxplayer_dec_ops_s g_wav_dec_ops;

bool nxplayer_is_wav_file(FAR const char *pfilename);
#endif

#ifdef __cplusplus
}
Expand Down
3 changes: 3 additions & 0 deletions system/nxplayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ if(CONFIG_SYSTEM_NXPLAYER)
target_sources(apps PRIVATE nxplayer.c)

set(CSRCS nxplayer.c nxplayer_common.c nxplayer_mp3.c nxplayer_sbc.c)
if(CONFIG_AUDIO_FORMAT_PCM AND CONFIG_NXPLAYER_FMT_FROM_EXT)
list(APPEND CSRCS nxplayer_wav.c)
endif()

target_sources(apps PRIVATE ${CSRCS})
endif()
6 changes: 6 additions & 0 deletions system/nxplayer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ CSRCS += nxplayer_common.c
CSRCS += nxplayer_mp3.c
CSRCS += nxplayer_sbc.c

ifneq ($(CONFIG_AUDIO_FORMAT_PCM),)
ifneq ($(CONFIG_NXPLAYER_FMT_FROM_EXT),)
CSRCS += nxplayer_wav.c
endif
endif

ifneq ($(CONFIG_NXPLAYER_COMMAND_LINE),)
PROGNAME = nxplayer
PRIORITY = SCHED_PRIORITY_DEFAULT
Expand Down
Loading
Loading