📄 dvb_music.h
字号:
#ifndef __DVB_MUSIC_H__
#define __DVB_MUSIC_H__
#include "dvb_type.h"
#include "dvb_sys.h"
#define TEST_PLAYER_FROM_ARRAY
/*******************************************************************************************/
#define DVB_MUSIC_SRC_DEV_NULL (0xFFFFFF)// Test Only
#define DVB_MUSIC_RING_BUFFER_SIZE (0x10000)
#define DVB_MUSIC_READ_DATA_LEN (0x200)
#define DVB_MUSIC_FILL_FIFO_LEN (0x20)
#define DVB_MUSIC_SRC_DEV_FILE_SYSTEM 1
#define DVB_MUSIC_SRC_DEV_ARRAY 0
/*******************************************************************************************/
typedef enum
{
EN_MUSICPLAYER_INIT_FAIL,
EN_MUSICPLAYER_INIT_MESSAGEQ_FAIL, /*!< some thing wrong */
EN_MUSICPLAYER_INIT_TASK_FAIL,
EN_MUSICPLAYER_NO_ERROR /*!< no error */
}EN_MUSICPLAYER_STATUS;
typedef enum
{
EN_MUSICPLAYER_TASK_COMMAND_NONE = 0,
EN_MUSICPLAYER_TASK_COMMAND_INIT,
#ifdef TEST_PLAYER_FROM_ARRAY
EN_MUSICPLAYER_TASK_COMMAND_INIT_ARRAY,
EN_MUSICPLAYER_TASK_COMMAND_START_ARRAY,
#endif
EN_MUSICPLAYER_TASK_COMMAND_START,
EN_MUSICPLAYER_TASK_COMMAND_STOP,
EN_MUSICPLAYER_TASK_COMMAND_PAUSE,
EN_MUSICPLAYER_TASK_COMMAND_UNPAUSE,
EN_MUSICPLAYER_TASK_COMMAND_TERM
} EN_MUSICPLAYER_TASK_CMD;
/*******************************************************************************************/
typedef EN_DRV_RESULT (*MUSIC_DECODE_READ_DATA_NOTIFY)(u8* pu8Buffer, u32 u32Offset, u32 u32ReadLen);
typedef enum
{
EN_MUSIC_STATUS_UN_INIT,
EN_MUSIC_STATUS_STOP,
EN_MUSIC_STATUS_PLAY,
EN_MUSIC_STATUS_PAUSE,
} EN_MUSIC_STATUS;
typedef enum
{
EN_MUSIC_FILETYPE_MP3,
EN_MUSIC_FILETYPE_WMA,
EN_MUSIC_FILETYPE_OGG,
EN_MUSIC_FILETYPE_AAC,
EN_MUSIC_FILETYPE_AMR,
EN_MUSIC_FILETYPE_AWB,
EN_MUSIC_FILETYPE_AC3
}EN_MUSIC_FILETYPE;
/*******************************************************************************************/
//(xbjiang 015)>>
void DVB_MUSIC_Set_Current_Playing_File(u32 u32FileIndex);
u32 DVB_MUSIC_Get_Current_Playing_File(void);
//(xbjiang 015)<<
EN_MUSICPLAYER_STATUS MusicPlayerServiceInit(void);
/*! \fn EN_MUSICPLAYER_STATUS MusicPlayerServiceInit(void);
\brief Initial player service
\return status defined in EN_MUSICPLAYER_STATUS
*/
bool8 MusicPlayer_DecodeInit(u32 u32SrcDev);
/*! \fn bool8 MusicPlayer_DecodeInit(u32 u32SrcDev);
\brief Initital music decode module
\param u32SrcDev (Input) which kind of music source(From dram or FS)
\return TRUE if success
*/
bool8 DVB_MusicPlayer_Init(void);
/*! \fn bool8 DVB_MusicPlayer_Init(void);
\brief Initial player for music source from FS
\param None
\return TRUE if success
*/
bool8 DVB_MusicPlayer_Start(u32 u32FileIndex, bool8 b8ChangePriority);
/*! \fn bool8 DVB_MusicPlayer_Start(u32 u32FileIndex);
\brief Issue start command to player to play music
\param u32FileIndex (Input) file index to be played
\param b8ChangePriority (Input) Enable or disable change priority of player task for slideshow with music play
\return TRUE if success
*/
bool8 DVB_MusicPlayer_Pause(bool8 b8Enable);
/*! \fn bool8 DVB_MusicPlayer_Pause(bool8 b8Enable);
\brief Issue puase/unpuase command to player to puase/unpuase play music
\param b8Enable (Input) pause state to be set
\return TRUE if success
*/
bool8 DVB_MusicPlayer_Stop(void);
/*! \fn bool8 DVB_MusicPlayer_Stop(void);
\brief Issue stop command to player to stop playing music
\param None
\return TRUE if success
*/
bool8 DVB_MusicPlayer_Term(void);
/*! \fn bool8 DVB_MusicPlayer_Term(void);
\brief Issue terminate command to player to terminate play music
\param None
\return TRUE if success
*/
#if 0
bool8 DVB_MusicPlayer_DelFile(u32 u32FileIndex);
/*! \fn bool8 DVB_MusicPlayer_DelFile(u32 u32FileIndex);
\brief Delete file according fileindex
\param u32FileIndex (Input) which file to be deleted
\return TRUE if success
*/
bool8 DVB_MusicPlayer_SetHeader(u16 u16FileIndex);
/*! \fn bool8 DVB_MusicPlayer_SetHeader(u16 u16FileIndex);
\brief This function has not been ported
\param u32SectorIndex (Input)
\return TRUE if success
*/
bool8 DVB_MusicPlayer_GetHeader(u16 u16FileIndex);
/*! \fn bool8 DVB_MusicPlayer_GetHeader(u16 u16FileIndex);
\brief This function has not been ported
\param u32SectorIndex (Input)
\return TRUE if success
*/
#endif
void DVB_MusicPlayer_SetDeviceType(EN_DEVICE_TYPE enDeviceType);
/*! \fn void DVB_MusicPlayer_SetDeviceType(EN_DEVICE_TYPE enDeviceType);
\brief set device type to player
\param enDeviceType (Input) device type
\return None
*/
#if 0
u16* DVB_MusicPlayer_GetDireName(u32 u32FileIndex, u8 *pu8DirName);
/*! \fn void DVB_MusicPlayer_GetDireName(u32 u32FileIndex, u8 *pu8DirName);
\brief Get music dirtory name according to u32FileIndex
\param u32FileIndex (Input) target directory index
\param pu8DirName (Output) pointer to a directory name
\return None
*/
#endif
u16* DVB_MusicPlayer_GetFileName(u32 u32FileIndex, u8 *pu8FileName);
/*! \fn void DVB_MusicPlayer_GetFileName(u32 u32FileIndex, u8 *pu8FileName);
\brief Get filename with file index
\param u32FileIndex (Input) target file index
\param pu8FileName (Output) pointer to a file name
\return None
*/
EN_DEVICE_TYPE DVB_MusicPlayer_GetDeviceType(void);
/*! \fn EN_DEVICE_TYPE DVB_MusicPlayer_GetDeviceType(void);
\brief Get device type from player
\param None
\return device type defined in EN_DEVICE_TYPE
*/
u32 DVB_MusicPlayer_GetFileCount(void);
/*! \fn u32 DVB_MusicPlayer_GetFileCount(void);
\brief Get file count under current directory
\param None
\return file counts
*/
#if 0
u32 DVB_MusicPlayer_GetDirCount(void);
/*! \fn u32 DVB_MusicPlayer_GetDirCount(void);
\brief Get directory counts under current directory
\param None
\return directory counts
*/
#endif
//Callback function to moving data
EN_DRV_RESULT DVB_MusicPlayer_ReadFsData(u8* pu8Puffer, u32 u32Offset, u32 u32ReadLen);
/*! \fn EN_DRV_RESULT DVB_MusicPlayer_ReadFsData(u8* pu8Puffer, u32 u32Offset, u32 u32ReadLen);
\brief Callback function to move data from FS
\param pu8Puffer (Input) target address to be move to
\param u32Offset (Input) offset from start address of music buffer
\param u32ReadLen (Input)data size to be read
\return DRV_OK if success
*/
EN_DRV_RESULT DVB_MusicPlayer_ReadArrayData(u8* pu8Puffer, u32 u32Offset, u32 u32ReadLen);
/*! \fn EN_DRV_RESULT DVB_MusicPlayer_ReadArrayData(u8* pu8Puffer, u32 u32Offset, u32 u32ReadLen);
\brief Callback function to move data from dram
\param pu8Puffer (Input) target address to be move to
\param u32Offset (Input) offset from start address of music buffer
\param u32ReadLen (Input)data size to be read
\return DRV_OK if success
*/
#ifdef TEST_PLAYER_FROM_ARRAY
bool8 DVB_MusicPlayer_InitForArray(void);
/*! \fn bool8 DVB_MusicPlayer_InitForArray(void);
\brief Initial player for music source from dram
\param None
\return TRUE if success
*/
bool8 DVB_MusicPlayer_StartArray(u8 * pu8StartAddr,u32 u32length,bool8 b8ChangePriority);
/*! \fn bool8 DVB_MusicPlayer_StartArray(u8 * pu8StartAddr,u32 u32length,bool8 b8ChangePriority);
\brief Issue start command to player to play music from dram
\param pu8StartAddr (Input) pointer of start address to be played
\param u32length (Input) data length
\param b8ChangePriority (Input) Enable or disable change priority of player task for slideshow with music play
\return TRUE if success
*/
#endif
void DVB_MUSIC_Set_Filetype(EN_MUSIC_FILETYPE enFiletype);
EN_MUSIC_FILETYPE DVB_MUSIC_Get_Filetype(void);
bool8 DVB_MUSIC_DecodeInit(MUSIC_DECODE_READ_DATA_NOTIFY pfReadDataNotify, u32 u32RingBufferSize, u32 u32ReadDataLen, u32 u32FillFifoLen);
/*! \fn bool8 DVB_MUSIC_DecodeInit(MUSIC_DECODE_READ_DATA_NOTIFY pfReadDataNotify, u32 u32RingBufferSize, u32 u32ReadDataLen, u32 u32FillFifoLen);
\brief Initial mp3 decode module. This api is relative to DVB_MUSIC_DecodeTerm. Is is to say after calling to DVB_MUSIC_DecodeTerm() you have to initial mp3 module again by this API
\param pfReadDataNotify (Input) callback function to read data into ringbuffer
\param u32RingBufferSize (Input)the Ringbuffer size
\param u32ReadDataLen (Input) data size to read data into ringbuffer each time
\param u32FillFifoLen (Input) data size to read data into acfifo from ringbuffer each time
\return TRUE if success
*/
bool8 DVB_MUSIC_DecodeStart(u8 *pu8buffer,u32 u32buffLen);
/*! \fn bool8 DVB_MUSIC_DecodeStart(u8 *pu8buffer,u32 u32buffLen);
\brief
\param *pu8buffer (Input) start address where to read data in
\param u32buffLen (Input) the buffer length
\return TRUE if success
*/
bool8 DVB_MUSIC_DecodeStop(void);
/*! \fn bool8 DVB_MUSIC_DecodeStop(void);
\brief Stop the mp3 decode
\param None
\return TRUE if success
*/
bool8 DVB_MUSIC_DecodePause(bool8 b8Pause);
/*! \fn bool8 DVB_MUSIC_DecodePause(bool8 b8Pause);
\brief Tell DSP to pause the mp3 decode
\param b8Pause (Input) pause state
\return TRUE if success
*/
bool8 DVB_MUSIC_DecodeProcess(void);
/*! \fn bool8 DVB_MUSIC_DecodeProcess(void);
\brief Process to fill data to ringbuffer and acfifo
\param None
\return TRUE if success
*/
bool8 DVB_MUSIC_DecodeTerm(void);
/*! \fn bool8 DVB_MUSIC_DecodeTerm(void);
\brief Terminate mp3 decode and restore back normal AV decode
\param None
\return TRUE if success
*/
EN_MUSIC_STATUS DVB_MUSIC_DecodeGetStatus(void);
/*! \fn EN_MUSIC_STATUS DVB_MUSIC_DecodeGetStatus(void);
\brief Get mp3 decode status
\param None
\return status defined in EN_MUSIC_STATUS
*/
u32 DVB_MUSIC_DecodeGetProgress(void);
/*! \fn u32 DVB_MUSIC_DecodeGetProgress(void);
\brief Get mp3 decode progress
\param None
\return current progress
*/
void DVB_MUSIC_DecodeTime(u32 *pu32TotalTime, u32 *pu32CurrentTime);
/*! \fn void DVB_MUSIC_DecodeTime(u32 *pu32TotalTime, u32 *pu32CurrentTime);
\brief Get mp3 decode total time and current time, if 0 means no value can be used
\param pu32TotalTime (Output) Total Time, pu32CurrentTime (Output) Current Time
\return none
*/
bool8 DVB_Music_Get_Bitrate(u32 u32FileIndex);
/*******************************************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -