audio_dec.h 1.94 KB
#ifndef _AUDIO_DEC_H_
#define _AUDIO_DEC_H_

#include "hw_codec.h"

#define CO_PROCESSOR_MASK_BITS    0x03


typedef enum {
	DECODE_NONE = 0,

	DECODE_MP3,
	DECODE_WMA,

#if 1//def WAV_DEC
	DECODE_WAV,
#endif

	DECODE_SL_SLAVE,

	DECODE_SBC,

	DECODE_PCM_DOWNSAMPLE,

	DECODE_HFP,

	DECODE_PCM,
	DECODE_SPDIF,

#if 1//def DOLBY_AC3_DEC
	DECODE_DD_AC3,
#endif
	
#if 1//(defined(USB_SPEAKER) || defined(AOA_USB_AUDIO))
	DECODE_USB_SPEAKER,
#endif

	DECODE_LC3,

	DECODE_UNKNOW = 0xffff
}DECODE_ID;

enum {
	DECODE_SET,
	DECODE_FRAME,
	DECODE_INIT,
	DECODE_EXIT,
#if 0
	DECODE_BUFF_INIT,
	DECODE_EQ_SET,
	DECODE_VOLUME_SET,
	DECODE_SRC_INIT,
	MP3ENC_INIT,				/*in the decoding meantime, maybe encoding*/
	ID3_DEC
#endif
};

typedef enum {
	/****err code, Analyzed by each codec****/
	DECODE_ERR1,
	DECODE_ERR2,
	DECODE_ERR3,
	DECODE_ERR4,
	DECODE_ERR5,
	DECODE_ERR6,
	DECODE_ERR7,
	DECODE_ERR8,


	DECODE_SUCCESS = 0xFD,
	DECODE_END = 0xFE,
	DECODE_USER_EXIT = 0xFF,	
}DECODE_RETs;

typedef struct {
	char *dec_name;
	void (*init) (void);
//	void (*open) (void);
	void (*fini) (int reason);
//	void (*close) (void);
	int (*decode) (U8 **out,U16 *plen);
} DECODE_DEVICE;


extern volatile U8 wRequestDecodeFrameExit;
extern volatile U8 task_dec_cnt;

extern int decode_type;
extern U8 wCodecBusy;
extern U8 decoding_flag;

extern U8 ex_audio_stream_zero;

extern U16 dec_frame_size;


#ifdef AUDIO_24_BIT_OUTPUT
	#define SAMPLES2DMACOUNT(xSamples) (xSamples*2)
#else
	#define SAMPLES2DMACOUNT(xSamples) (xSamples)
#endif

#if (defined OPL_MODE_TWO_WAY || defined OPL_MODE_SINGLE_WAY)
#define TRANS_PART1_SAMPLES 160
#define TRANS_PART2_SAMPLES 80
#else
#define TRANS_PART1_SAMPLES 80
#define TRANS_PART2_SAMPLES 40
#endif
#define TRANS_PART1_COUNT SAMPLES2DMACOUNT(TRANS_PART1_SAMPLES)
#define TRANS_PART2_COUNT SAMPLES2DMACOUNT(TRANS_PART2_SAMPLES)

#define DMA_UNDERFLOW_DELAY_COUNT 32

void app_nav_spdif_stream_reinit (void);

void dec_direct_out_24bit( int *pBuf, U16 len );

#endif