AC63_BT_SDK/apps/common/audio/demo/audio_decoder_test.c

213 lines
6.4 KiB
C
Raw Normal View History

2025-02-18 15:40:42 +08:00
/*
****************************************************************
* AUDIO DECODER TEST
* File : audio_decoder_test.c
* By :
* Notes :
* before和after之间就是解码对应功能的处理
* before和after中分别翻转IO来卡一下处理时间
****************************************************************
*/
#include "media/includes.h"
#define DEC_IO_DEBUG_1(i,x) {JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT |= BIT(x);}
#define DEC_IO_DEBUG_0(i,x) {JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT &= ~BIT(x);}
/*
*********************************************************************
* Audio Decoder test output before
* Description:
* Arguments : *dec
* *buff buf
* len
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_out_before(struct audio_decoder *dec, void *buff, int len)
{
DEC_IO_DEBUG_1(C, 3);
}
/*
*********************************************************************
* Audio Decoder test output after
* Description:
* Arguments : *dec
* wlen
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_out_after(struct audio_decoder *dec, int wlen)
{
DEC_IO_DEBUG_0(C, 3);
}
/*
*********************************************************************
* Audio Decoder test read file before
* Description:
* Arguments : *dec
* len
* offset
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_read_before(struct audio_decoder *dec, int len, u32 offset)
{
DEC_IO_DEBUG_1(C, 2);
}
/*
*********************************************************************
* Audio Decoder test read file after
* Description:
* Arguments : *dec
* *data
* rlen
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_read_after(struct audio_decoder *dec, u8 *data, int rlen)
{
DEC_IO_DEBUG_0(C, 2);
}
/*
*********************************************************************
* Audio Decoder test get frame before
* Description:
* Arguments : *dec
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_get_frame_before(struct audio_decoder *dec)
{
DEC_IO_DEBUG_1(C, 2);
}
/*
*********************************************************************
* Audio Decoder test get frame after
* Description:
* Arguments : *dec
* *frame
* rlen
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_get_frame_after(struct audio_decoder *dec, u8 *frame, int rlen)
{
DEC_IO_DEBUG_0(C, 2);
}
/*
*********************************************************************
* Audio Decoder test fetch frame before
* Description:
* Arguments : *dec
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_fetch_before(struct audio_decoder *dec)
{
DEC_IO_DEBUG_1(C, 2);
}
/*
*********************************************************************
* Audio Decoder test fetch frame after
* Description:
* Arguments : *dec
* *frame
* rlen
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_fetch_after(struct audio_decoder *dec, u8 *frame, int rlen)
{
DEC_IO_DEBUG_0(C, 2);
}
/*
*********************************************************************
* Audio Decoder test run before
* Description:
* Arguments : *dec
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_run_before(struct audio_decoder *dec)
{
DEC_IO_DEBUG_1(C, 1);
}
/*
*********************************************************************
* Audio Decoder test run after
* Description:
* Arguments : *dec
* err
* Return : None.
* Note(s) : None.
*********************************************************************
*/
void audio_decoder_test_run_after(struct audio_decoder *dec, int err)
{
DEC_IO_DEBUG_0(C, 1);
}
/*
*
*
*
* */
#if 0
// 保存原来的数据流数据处理
static void *demo_data_handler_save;
// 数据流data_handler处理
static int demo_new_data_handler(struct audio_stream_entry *entry,
struct audio_data_frame *in,
struct audio_data_frame *out)
{
DEC_IO_DEBUG_1(C, 1);
// 调用原来的接口输出
int wlen = ((int (*)(struct audio_stream_entry *, struct audio_data_frame *, struct audio_data_frame *))demo_data_handler_save)(entry, in, out);
DEC_IO_DEBUG_0(C, 1);
return wlen;
}
void test_start(void)
{
#if 1
// 用变量保存原来的数据处理接口,然后重新赋值新的数据处理
// 这里以获取mix节点的数据为例
demo_data_handler_save = (void *)bt_a2dp_dec->mix_ch.entry.data_handler;
bt_a2dp_dec->mix_ch.entry.data_handler = demo_new_data_handler;
#endif
// 数据流串联
struct audio_stream_entry *entries[8] = {NULL};
u8 entry_cnt = 0;
entries[entry_cnt++] = &dec->dec.decoder.entry;
entries[entry_cnt++] = &dec->mix_ch.entry;
// ...
}
#endif