localtws_decoder.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef LOCALTWS_DECODER_H
  2. #define LOCALTWS_DECODER_H
  3. #include "media/includes.h"
  4. enum {
  5. LOCALTWS_DEC_STATUS_STOP = 0, // 解码停止
  6. LOCALTWS_DEC_STATUS_PLAY, // 正在解码
  7. };
  8. struct localtws_decoder {
  9. u32 ch_num : 4; // 声道数
  10. u32 output_ch_num : 4; // 输出声道数
  11. u32 output_ch_type : 4; // 输出声道类型
  12. u32 status : 3; // 解码状态
  13. u32 read_en : 1; // 开始解码
  14. u32 tmp_pause : 1; // 被其他解码打断,临时暂停
  15. u32 need_get_fmt : 1; // 需要获取音频信息
  16. u32 sync_step : 3;
  17. u32 preempt_state : 4;
  18. u32 remain_flag : 1; // 输出剩余标记
  19. u32 fade_out : 1; // 淡出
  20. s16 fade_step; // 淡入淡出步进数
  21. s16 fade_value; // 淡入淡出记录值
  22. u32 fade_out_mute_points; // 淡出后静音点数
  23. u32 wait_time;
  24. int begin_delay_time;
  25. void *sync;
  26. u16 resume_timeout;
  27. // u16 drop_samples;
  28. u32 dec_type; // 解码类型
  29. u16 sample_rate; // 采样率
  30. u16 sbc_header_len; // sbc头部长度
  31. u8 *tws_ptr; // tws数据
  32. u32 tws_len; // tws数据长度
  33. u32 tws_ulen; // tws数据使用长度
  34. struct audio_decoder_task *decode_task; // 解码任务
  35. enum audio_channel ch_type; // 输出类型
  36. struct audio_decoder decoder; // 解码句柄
  37. u8(*tws_master)(void);
  38. };
  39. int localtws_decoder_open(struct localtws_decoder *, struct audio_decoder_task *decode_task);
  40. void localtws_decoder_close(struct localtws_decoder *dec);
  41. void localtws_decoder_set_output_channel(struct localtws_decoder *dec);
  42. void localtws_decoder_stream_sync_enable(struct localtws_decoder *dec,
  43. void *sync,
  44. int delay_time,
  45. u8(*master)(void));
  46. void localtws_decoder_resume_pre(void);
  47. #endif /*A2DP_DECODER_H*/