Developer World
Spresense SDK Library v2.6.0-556c296
audio_player_api.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/audio/audio_player_api.h
3 *
4 * Copyright 2018 Sony Semiconductor Solutions Corporation
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
36#ifndef __MODULES_INCLUDE_AUDIO_AUDIO_PLAYER_API_H
37#define __MODULES_INCLUDE_AUDIO_AUDIO_PLAYER_API_H
38
53/****************************************************************************
54 * Included Files
55 ****************************************************************************/
56
57#include <stdint.h>
58#include <stdbool.h>
59
63#include "memutils/message/MsgPacket.h"
64
65/****************************************************************************
66 * Pre-processor Definitions
67 ****************************************************************************/
68
69/* Enable player feature. */
70
71#define AS_FEATURE_PLAYER_ENABLE
72
73/* Need to enable mixer feature when player feature is enabled.
74 * Because player feature always use mixer feature.
75 */
76
77#define AS_FEATURE_OUTPUTMIX_ENABLE
78
84#define LENGTH_INIT_PLAYER (9)
85
88#define LENGTH_INIT_SUBPLAYER (LENGTH_INIT_PLAYER)
89
92#define LENGTH_PLAY_PLAYER (2)
93
96#define LENGTH_PLAY_SUBPLAYER (LENGTH_PLAY_PLAYER)
97
100#define LENGTH_STOP_PLAYER (2)
101
104#define LENGTH_STOP_SUBPLAYER (LENGTH_STOP_PLAYER)
105
108#define LENGTH_CLK_RECOVERY (2)
109
112#define LENGTH_SET_GAIN (2)
113
116#define LENGTH_SENDPOSTCMD (10)
117
120/****************************************************************************
121 * Public Types
122 ****************************************************************************/
123
126typedef enum
127{
131
135
139
143
147
151
153
156typedef enum
157{
158 AS_PLAYER_ID_0 = 0,
159
160 AS_PLAYER_ID_1,
161
162 AS_PLAYER_ID_NUM,
163
164} AsPlayerId;
165
168typedef enum
169{
173
177
181 AS_ACTPLAYER_NUM
183
186typedef enum
187{
193
199
205
209 AS_SETPLAYER_INPUTDEVICE_NUM
210
212
215typedef enum
216{
220
224
230 AS_SETPLAYER_OUTPUTDEVICE_NUM
232
235typedef enum
236{
240
244
248
251typedef enum
252{
256
260
262
265typedef enum
266{
267 AsNextNormalRequest = 0,
268 AsNextStopResRequest,
269
270} AsRequestNextType;
271
272/* for AsPlayerInputDeviceHdlrForRAM */
273
278typedef void (*AudioSimpleFifoReadDoneCallbackFunction)(uint32_t size);
279
282typedef struct
283{
290
296
301
304#if defined(__CC_ARM)
305#pragma anon_unions
306#endif
307
308typedef struct
309{
316
323
326 uint8_t reserved0;
327
330 uint8_t reserved1;
331
335
337
338typedef bool (*MediaPlayerCallback)(AsPlayerEvent evtype, uint32_t result, uint32_t sub_result);
339
340typedef struct
341{
345
348 MediaPlayerCallback cb;
349
351
352typedef struct
353{
360
364
368
371 uint8_t reserve0;
372
376
380
381#if !defined(__CC_ARM)
383#else
384} SetPlayerStsParam __attribute__((transparent_union));
385#endif
386
388typedef struct
389{
390 uint32_t reserve0;
392
395typedef void (*DecodeDoneCallback)(AsPcmDataParam param);
396
397typedef struct
398{
405
411 uint8_t bit_length;
412
418 uint8_t codec_type;
419
422 uint8_t reserved1;
423
430
433 char dsp_path[AS_AUDIO_DSP_PATH_LEN];
434
436
439typedef union
440{
446
452 {
453 MsgQueId id;
454 uint32_t identifier;
455 } msg;
456
458
459typedef struct
460{
467 uint8_t pcm_path;
468
476
478
481typedef struct
482{
488 uint8_t stop_mode;
490
493typedef struct
494{
499 uint8_t l_gain;
500
505 uint8_t r_gain;
507
510typedef struct
511{
517 uint8_t type;
518
520
523typedef struct
524{
529 uint8_t player_id;
530
531 union
532 {
533 AsActivatePlayer act_param;
534
541
547
553
554 AsRequestNextParam req_next_param;
555
561
567 };
569
572typedef struct
573{
576 uint8_t player;
577
580 uint8_t mng;
581
584 uint8_t mixer;
585
588 uint8_t dsp;
590
593typedef struct
594{
598
602
606
611
612
613typedef struct{
616 uint8_t es;
617
620 uint8_t pcm;
621
624 uint8_t dsp;
625
628 uint8_t src_work;
630
633typedef struct
634{
638
642
644
647typedef struct
648{
652
656
658
659/****************************************************************************
660 * Public Data
661 ****************************************************************************/
662
663/****************************************************************************
664 * Inline Functions
665 ****************************************************************************/
666
667/****************************************************************************
668 * Public Function Prototypes
669 ****************************************************************************/
670
682
695 FAR AsCreatePlayerParam_t *param,
696 AudioAttentionCb attcb);
697
699 FAR AsCreatePlayerParams_t *param,
700 AudioAttentionCb attcb);
701
702__attribute__((deprecated(
703 "\n \
704 \n Deprecated create API is used. \
705 \n Use \"AS_CreatePlayerMulti(AsPlayerId, \
706 \n AsCreatePlayerParam_t *, \
707 \n AudioAttentionCb)\". \
708 \n \
709 \n")))
711
713
724
735
746
757
768
779
790
799
808
809#endif /* __MODULES_INCLUDE_AUDIO_AUDIO_PLAYER_API_H */
Memory Handler API.
CXD5602 Audio Common Definitions.
CXD5602 Audio Object Layer API.
__attribute__((deprecated("\nDeprecated attention callback type is used. \ \nPlease use \"AudioAttentionCb\" as callback type. \ \n"))) int AS_CreateAudioManager(AudioSubSystemIDs ids
Activate AudioSubSystem[Deprecated] This API is to make it compatible with old application....
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:810
#define AS_AUDIO_DSP_PATH_LEN
Definition: audio_common_defs.h:693
AsStopPlayerStopMode
Definition: audio_player_api.h:236
AsSetActivatePlayer
Definition: audio_player_api.h:169
bool AS_StopPlayer(AsPlayerId id, FAR AsStopPlayerParam *stopparam)
Stop audio (sub)player.
bool AS_SetPlayerGain(AsPlayerId id, FAR AsSetGainParam *gainparam)
Set audio gain level of (sub)player.
AsPlayerId
Definition: audio_player_api.h:157
bool AS_checkAvailabilityMediaPlayer(AsPlayerId id)
Check availability of MediaPlayer.
bool AS_InitPlayer(AsPlayerId id, FAR AsInitPlayerParam *initparam)
Initialize audio (sub)player.
AsSetPlayerOutputDevice
Definition: audio_player_api.h:216
bool AS_CreatePlayerMulti(AsPlayerId id, FAR AsCreatePlayerParam_t *param, AudioAttentionCb attcb)
Create audio main player using memory pool in work area of src.
bool AS_CreatePlayer(AsPlayerId id, FAR AsCreatePlayerParam_t *param)
Create audio main player.
bool AS_PlayPlayer(AsPlayerId id, FAR AsPlayPlayerParam *playparam)
Play audio (sub)player.
AsPcmDataPath
Definition: audio_player_api.h:252
bool AS_ActivatePlayer(AsPlayerId id, FAR AsActivatePlayer *actparam)
Activate audio (sub)player.
bool AS_DeactivatePlayer(AsPlayerId id, FAR AsDeactivatePlayer *deactparam)
Deactivate (sub)player.
void(* DecodeDoneCallback)(AsPcmDataParam param)
Definition: audio_player_api.h:395
bool AS_RequestNextPlayerProcess(AsPlayerId id, FAR AsRequestNextParam *nextparam)
Request next process(decode) to (sub)player.
bool AS_DeletePlayer(AsPlayerId id)
Deactivate audio main player.
void(* AudioSimpleFifoReadDoneCallbackFunction)(uint32_t size)
Definition: audio_player_api.h:278
AsSetPlayerInputDevice
Definition: audio_player_api.h:187
AsPlayerEvent
Definition: audio_player_api.h:127
@ AS_STOPPLAYER_ESEND
Wait end of es.
Definition: audio_player_api.h:243
@ AS_STOPPLAYER_FORCIBLY
Forcibly stop at system failure.
Definition: audio_player_api.h:246
@ AS_STOPPLAYER_NORMAL
Normal stop (immediately stop)
Definition: audio_player_api.h:239
@ AS_ACTPLAYER_SUB
Activate sub player.
Definition: audio_player_api.h:176
@ AS_ACTPLAYER_MAIN
Activate main player.
Definition: audio_player_api.h:172
@ AS_ACTPLAYER_BOTH
Activate main & sub player.
Definition: audio_player_api.h:180
@ AS_SETPLAYER_OUTPUTDEVICE_SPHP
CXD5247 SP/HP.
Definition: audio_player_api.h:219
@ AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT
I2S Output.
Definition: audio_player_api.h:223
@ AS_SETPLAYER_OUTPUTDEVICE_A2DPFIFO
A2DP Media Packet FIFO.
Definition: audio_player_api.h:229
@ AsPcmDataReply
Decodec PCM data will be replied by callback.
Definition: audio_player_api.h:255
@ AsPcmDataTunnel
Decodec PCM data will be sent automatically.
Definition: audio_player_api.h:259
@ AS_SETPLAYER_INPUTDEVICE_I2SINPUT
I2S input.
Definition: audio_player_api.h:204
@ AS_SETPLAYER_INPUTDEVICE_EMMC
eMMC FileSystem
Definition: audio_player_api.h:192
@ AS_SETPLAYER_INPUTDEVICE_RAM
RAM.
Definition: audio_player_api.h:208
@ AS_SETPLAYER_INPUTDEVICE_A2DPFIFO
A2DP Media Packet FIFO.
Definition: audio_player_api.h:198
@ AsPlayerEventAct
Activate.
Definition: audio_player_api.h:130
@ AsPlayerEventSetGain
Set gain.
Definition: audio_player_api.h:150
@ AsPlayerEventInit
Init.
Definition: audio_player_api.h:134
@ AsPlayerEventDeact
Deactivate.
Definition: audio_player_api.h:146
@ AsPlayerEventPlay
Play.
Definition: audio_player_api.h:138
@ AsPlayerEventStop
Stop.
Definition: audio_player_api.h:142
Definition: audio_player_api.h:309
uint8_t reserved1
[in] reserved
Definition: audio_player_api.h:330
uint8_t output_device
[in] Select Player Output device
Definition: audio_player_api.h:322
uint8_t reserved0
[in] reserved
Definition: audio_player_api.h:326
uint8_t input_device
[in] Select Player Input device
Definition: audio_player_api.h:315
AsPlayerInputDeviceHdlrForRAM * ram_handler
[in] Set Player Input device handler, refer following.
Definition: audio_player_api.h:334
Definition: audio_player_api.h:341
AsActivatePlayerParam param
[in] MediaPlayer activation parameters
Definition: audio_player_api.h:344
Definition: audio_player_api.h:634
AsPlayerPoolId_old_t pool_id
[in] ID of memory pool for processing data
Definition: audio_player_api.h:641
AsPlayerMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_player_api.h:637
Definition: audio_player_api.h:648
AsPlayerMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_player_api.h:651
AsPlayerPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_player_api.h:655
Definition: audio_player_api.h:389
Definition: audio_player_api.h:398
uint8_t reserved1
[in] reserved
Definition: audio_player_api.h:422
uint8_t codec_type
[in] Select InitPlayer codec type
Definition: audio_player_api.h:418
uint8_t channel_number
[in] Select InitPlayer input channels
Definition: audio_player_api.h:404
uint32_t sampling_rate
[in] Select sampling rate of es data
Definition: audio_player_api.h:429
uint8_t bit_length
[in] Select InitPlayer input bit length
Definition: audio_player_api.h:411
[in] Decoded PCM notify message
Definition: audio_player_api.h:452
Definition: audio_common_defs.h:703
Definition: audio_player_api.h:460
AsPcmDataDest pcm_dest
[in] Decode done callback
Definition: audio_player_api.h:475
uint8_t pcm_path
[in] Decoded PCM data path
Definition: audio_player_api.h:467
Definition: audio_player_api.h:283
AudioSimpleFifoReadDoneCallbackFunction callback_function
[in] Set callback function, Call this function when SimpleFifo was read
Definition: audio_player_api.h:295
uint32_t notification_threshold_size
[in] Read size notification threshold
Definition: audio_player_api.h:299
void * simple_fifo_handler
[in] Set SimpleFifo handler
Definition: audio_player_api.h:289
Definition: audio_player_api.h:573
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_player_api.h:580
uint8_t mixer
[in] Message queue id of output mixer
Definition: audio_player_api.h:584
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_player_api.h:588
uint8_t player
[in] Message queue id of player
Definition: audio_player_api.h:576
Definition: audio_player_api.h:613
uint8_t pcm
[in] Memory pool id of pcm data
Definition: audio_player_api.h:620
uint8_t es
[in] Memory pool id of es data
Definition: audio_player_api.h:616
uint8_t dsp
[in] Memory pool id of dsp command data
Definition: audio_player_api.h:624
uint8_t src_work
[in] Memory pool id of src work area
Definition: audio_player_api.h:628
Definition: audio_player_api.h:594
MemMgrLite::PoolId dsp
[in] Memory pool id of dsp command data
Definition: audio_player_api.h:605
MemMgrLite::PoolId es
[in] Memory pool id of es data
Definition: audio_player_api.h:597
MemMgrLite::PoolId pcm
[in] Memory pool id of pcm data
Definition: audio_player_api.h:601
MemMgrLite::PoolId src_work
[in] Memory pool id of src work area
Definition: audio_player_api.h:609
Definition: audio_player_api.h:511
uint8_t type
[in] Request type
Definition: audio_player_api.h:517
Definition: audio_player_api.h:494
uint8_t l_gain
[in] Gain level Lch Percentage 0 - 200 %
Definition: audio_player_api.h:499
uint8_t r_gain
[in] Gain level Rch Percentage 0 - 200 %
Definition: audio_player_api.h:505
Definition: audio_player_api.h:482
uint8_t stop_mode
[in] Stop mode which indicates immediate or wait end of es
Definition: audio_player_api.h:488
Definition: MemMgrTypes.h:88
Definition: audio_player_api.h:524
AsSetGainParam set_gain_param
[in] for Adjust sound period (header.command_code==AUDCMD_CLKRECOVERY)
Definition: audio_player_api.h:560
AsDeactivatePlayer deact_param
[in] for deactivate player (header.command_code==AUDCMD_SETREADYSTATUS)
Definition: audio_player_api.h:566
uint8_t player_id
[in] target player id Use AsPlayerId enum type
Definition: audio_player_api.h:529
AsPlayPlayerParam play_param
[in] for PlayPlayer (header.command_code==AUDCMD_PLAYPLAYER)
Definition: audio_player_api.h:546
AsInitPlayerParam init_param
[in] for InitPlayer (header.command_code==AUDCMD_INITPLAYER) (Object Interface==AS_InitPlayer)
Definition: audio_player_api.h:540
AsStopPlayerParam stop_param
[in] for StopPlayer (header.command_code==AUDCMD_STOPPLAYER)
Definition: audio_player_api.h:552
Definition: audio_player_api.h:353
uint8_t post0_enable
[in] post DSP 0 enable
Definition: audio_player_api.h:363
uint8_t active_player
[in] Select activate player
Definition: audio_player_api.h:359
AsActivatePlayerParam player1
[in] Activation parameters for player1
Definition: audio_player_api.h:379
AsActivatePlayerParam player0
[in] Activation parameters for player0
Definition: audio_player_api.h:375
uint8_t post1_enable
[in] post DSP 1 enable
Definition: audio_player_api.h:367
uint8_t reserve0
[in] reserved
Definition: audio_player_api.h:371
Definition: audio_player_api.h:440
DecodeDoneCallback callback
[in] Decoded PCM notify callback
Definition: audio_player_api.h:445