初版
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
#ifndef DECODER_NODE_MGR_H
|
||||
#define DECODER_NODE_MGR_H
|
||||
|
||||
#include "jlstream.h"
|
||||
#include "media/audio_base.h"
|
||||
#include "media/audio_splicing.h"
|
||||
#include "system/task.h"
|
||||
#include "effects/effects_adj.h"
|
||||
|
||||
struct decoder_hdl;
|
||||
|
||||
struct decoder_file_ops {
|
||||
void *file;
|
||||
int (*fread)(void *file, u8 *buf, int len);
|
||||
int (*fseek)(void *file, u32 fpos);
|
||||
};
|
||||
|
||||
struct decoder_get_fmt {
|
||||
struct decoder_file_ops fops;
|
||||
struct stream_fmt *fmt;
|
||||
};
|
||||
|
||||
|
||||
struct decoder_plug_ops {
|
||||
int coding_type;
|
||||
void *(*init)(struct decoder_hdl *dec_hdl);
|
||||
int (*run)(void *);
|
||||
int (*ioctl)(void *, int, int);
|
||||
void (*release)(void *);
|
||||
};
|
||||
struct convert_bit_wide {
|
||||
u8 *buf;//解码器位宽转换buf
|
||||
u16 len;
|
||||
u16 offset;
|
||||
};
|
||||
|
||||
struct decoder_flow_ctrl {
|
||||
u16 max_sleep;
|
||||
u16 frame_min_len;
|
||||
u16 frame_max_len;
|
||||
struct list_head frames;
|
||||
struct stream_frame *frame;
|
||||
};
|
||||
|
||||
struct decoder_dec_task {
|
||||
u8 frame_cnt;
|
||||
struct stream_thread *wakup_thread;
|
||||
OS_SEM dec_sem;
|
||||
const char *task_name;
|
||||
struct list_head file_frames;
|
||||
};
|
||||
|
||||
struct decoder_hdl {
|
||||
struct stream_node *node;
|
||||
void *decoder;
|
||||
int (*run)(void *);
|
||||
enum stream_scene scene;
|
||||
u8 start;
|
||||
u8 output_frame_cnt;
|
||||
u8 timestamp_flag;
|
||||
u8 frame_time;
|
||||
u8 pause;
|
||||
u8 dec_end;
|
||||
u8 no_data;
|
||||
u8 stop_dec;
|
||||
u8 channel_mode;
|
||||
u8 decoder_out_bit_wide;//0:16bit, 1:24bit 解码器实际输出位宽,如与decoder_node的oport_data_wide不一致时,decoder_node需做位宽转换
|
||||
u16 coding_type;
|
||||
|
||||
u32 cur_time;
|
||||
u32 timestamp;
|
||||
u32 file_len; //解码文件的长度
|
||||
u32 fpos;
|
||||
struct decoder_file_ops fops;
|
||||
|
||||
OS_MUTEX mutex;
|
||||
OS_MUTEX file_mutex;
|
||||
OS_SEM file_sem;
|
||||
struct jlstream_fade fade;
|
||||
struct audio_dec_breakpoint *breakpoint;
|
||||
struct decoder_flow_ctrl *flow_ctrl;
|
||||
struct decoder_dec_task *task;
|
||||
const struct decoder_plug_ops *plug;
|
||||
|
||||
struct node_port_data_wide data_wide;
|
||||
struct convert_bit_wide convert;
|
||||
};
|
||||
|
||||
#define REGISTER_DECODER_PLUG(plug) \
|
||||
const struct decoder_plug_ops plug sec(.decoder_plug)
|
||||
|
||||
int decoder_plug_output_data(void *_hdl, u8 *data, u16 len, u8 channel_mode, void *priv);
|
||||
|
||||
int decoder_plug_read_data(void *_hdl, u32 fpos, u8 *data, u16 len);
|
||||
|
||||
int decoder_plug_get_data_len(void *_hdl);
|
||||
|
||||
struct stream_frame *decoder_plug_pull_frame(void *_hdl);
|
||||
|
||||
void decoder_plug_free_frame(void *_hdl, struct stream_frame *frame);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef ENCODER_NODE_MGR_H
|
||||
#define ENCODER_NODE_MGR_H
|
||||
|
||||
#include "jlstream.h"
|
||||
#include "media/audio_base.h"
|
||||
|
||||
struct encoder_plug_ops {
|
||||
int coding_type;
|
||||
void *(*init)(void *priv);
|
||||
int (*run)(void *);
|
||||
int (*ioctl)(void *, int, int);
|
||||
void (*release)(void *);
|
||||
};
|
||||
|
||||
struct encoder_fmt {
|
||||
u8 quality;
|
||||
u8 complexity;
|
||||
u8 sw_hw_option;
|
||||
u8 ch_num;
|
||||
u8 format;
|
||||
u8 bit_width;
|
||||
u16 frame_dms;
|
||||
u32 bit_rate;
|
||||
u32 sample_rate;
|
||||
};
|
||||
|
||||
|
||||
enum change_file_step {
|
||||
SEAMLESS_OPEN_FILE,
|
||||
SEAMLESS_CHANGE_FILE,
|
||||
};
|
||||
|
||||
/*
|
||||
* 无缝录音配置, 支持配置录制多长时间(秒)后切换文件
|
||||
* advance_time: 提前多少秒调用change_file(priv, SEAMLESS_OPEN_FILE), 用于提前创建新文件
|
||||
* time: 单个文件录音时长(秒)
|
||||
*/
|
||||
struct seamless_recording {
|
||||
u8 advance_time;
|
||||
u16 time;
|
||||
void *priv;
|
||||
/*
|
||||
* 此回调函数在音频流任务中调用,不能执行耗时长的操作,否则可能导致音频播放卡顿
|
||||
*/
|
||||
int (*change_file)(void *priv, enum change_file_step step);
|
||||
};
|
||||
|
||||
#define REGISTER_ENCODER_PLUG(plug) \
|
||||
const struct encoder_plug_ops plug sec(.encoder_plug)
|
||||
|
||||
int encoder_plug_output_data(void *_hdl, u8 *data, u16 len);
|
||||
|
||||
int encoder_plug_read_data(void *_hdl, u8 *data, u16 len);
|
||||
|
||||
struct stream_frame *encoder_plug_pull_frame(void *_hdl);
|
||||
|
||||
struct stream_frame *encoder_plug_get_output_frame(void *_hdl, u16);
|
||||
|
||||
void encoder_plug_put_output_frame(void *_hdl, struct stream_frame *);
|
||||
|
||||
void encoder_plug_free_frame(void *_hdl, struct stream_frame *);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef JLDEMUXER_H
|
||||
#define JLDEMUXER_H
|
||||
|
||||
#include "jlstream.h"
|
||||
|
||||
|
||||
int jldemuxer_get_tone_file_fmt(struct stream_file_info *info, struct stream_fmt *fmt);
|
||||
|
||||
int jldemuxer_file_coding_type_filter(u8 *data, int len, int types[]);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,734 @@
|
||||
#ifndef JLSTREAM_H
|
||||
#define JLSTREAM_H
|
||||
|
||||
#include "generic/typedef.h"
|
||||
#include "generic/list.h"
|
||||
#include "node_uuid.h"
|
||||
#include "media/audio_base.h"
|
||||
#include "media/audio_def.h"
|
||||
#include "media/media_config.h"
|
||||
#include "system/task.h"
|
||||
#include "system/spinlock.h"
|
||||
#include "fs/resfile.h"
|
||||
|
||||
|
||||
#define __STREAM_CACHE_CODE __attribute__((section(".stream.text.cache.L2")))
|
||||
|
||||
#define STREAM_NODE_RUN_TIMER_DEBUG_EN 0
|
||||
|
||||
typedef void *jlstream_breaker_t;
|
||||
|
||||
struct stream_oport;
|
||||
struct stream_node;
|
||||
struct stream_snode;
|
||||
struct stream_note;
|
||||
struct jlstream;
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
#define SEEK_CUR 1 /* Seek from current position. */
|
||||
#define SEEK_END 2 /* Seek from end of file. */
|
||||
#endif
|
||||
|
||||
|
||||
#define NODE_IOC_OPEN_IPORT 0x00010000
|
||||
#define NODE_IOC_CLOSE_IPORT 0x00010001
|
||||
#define NODE_IOC_OPEN_OPORT 0x00010002
|
||||
#define NODE_IOC_CLOSE_OPORT 0x00010003
|
||||
|
||||
#define NODE_IOC_SET_FILE 0x00020000
|
||||
#define NODE_IOC_OPEN_FILE 0x00020001
|
||||
#define NODE_IOC_GET_FMT 0x00020002
|
||||
#define NODE_IOC_SET_FMT 0x00020003
|
||||
#define NODE_IOC_CLR_FMT 0x00020004
|
||||
#define NODE_IOC_GET_DELAY 0x00020005 // 获取缓存数据的延时
|
||||
#define NODE_IOC_SET_SCENE 0x00020006 // 设置数据流的场景
|
||||
#define NODE_IOC_SET_CHANNEL 0x00020007
|
||||
#define NODE_IOC_NEGOTIATE 0x00020008 // 各个节点参数协商
|
||||
#define NODE_IOC_FLUSH_OUT 0x00020009
|
||||
#define NODE_IOC_SET_TIME_STAMP 0x0002000a
|
||||
#define NODE_IOC_SYNCTS 0x0002000b
|
||||
#define NODE_IOC_NODE_CONFIG 0x0002000c
|
||||
#define NODE_IOC_SET_PRIV_FMT 0x0002000d //设置节点私有参数
|
||||
#define NODE_IOC_NAME_MATCH 0x0002000e
|
||||
#define NODE_IOC_SET_PARAM 0x0002000f
|
||||
#define NODE_IOC_GET_PARAM 0x00020010
|
||||
#define NODE_IOC_DECODER_PP 0x00020011 //解码暂停再重开
|
||||
#define NODE_IOC_DECODER_FF 0x00020012 //快进
|
||||
#define NODE_IOC_DECODER_FR 0x00020013 //快退
|
||||
#define NODE_IOC_DECODER_REPEAT 0x00020014 //无缝循环播放
|
||||
#define NODE_IOC_DECODER_DEST_PLAY 0x00020015 //跳到指定位置播放
|
||||
#define NODE_IOC_GET_CUR_TIME 0x00020016 //获取音乐播放当前时间
|
||||
#define NODE_IOC_GET_TOTAL_TIME 0x00020017 //获取音乐播放总时间
|
||||
#define NODE_IOC_GET_BP 0x00020018 //获取解码断点信息
|
||||
#define NODE_IOC_SET_BP 0x00020019 //设置解码断点信息
|
||||
#define NODE_IOC_SET_FILE_LEN 0x0002001a //设置解码文件长度信息
|
||||
#define NODE_IOC_SET_BP_A 0x0002001b //设置复读A点
|
||||
#define NODE_IOC_SET_BP_B 0x0002001c //设置复读B点
|
||||
#define NODE_IOC_SET_AB_REPEAT 0x0002001d //设置AB点复读模式
|
||||
#define NODE_IOC_GET_ODEV_CACHE 0x0002001e //获取输出设备的缓存采样数
|
||||
#define NODE_IOC_SET_BTADDR 0x0002001f
|
||||
#define NODE_IOC_SET_ENC_FMT 0x00020020
|
||||
#define NODE_IOC_GET_ENC_FMT 0x00020021
|
||||
#define NODE_IOC_GET_HEAD_INFO 0x00020022 //获取编码的头文件信息
|
||||
#define NODE_IOC_SET_TASK 0x00020023
|
||||
#define NODE_IOC_FSEEK 0x00020024
|
||||
#define NODE_IOC_SET_BIT_WIDE 0x00020025
|
||||
#define NODE_IOC_FLOW_CTRL_ENABLE 0x00020026
|
||||
#define NODE_IOC_GET_BTADDR 0x00020027
|
||||
#define NODE_IOC_GET_FRAME_SIZE 0x00020028
|
||||
#define NODE_IOC_SET_FRAME_SIZE 0x00020029
|
||||
#define NODE_IOC_SET_TS_PARM 0x0002002a
|
||||
#define NODE_IOC_SET_SLEEP 0x0002002b
|
||||
#define NODE_IOC_SET_SEAMLESS 0x0002002c
|
||||
#define NODE_IOC_ENC_RESET 0x0002002d
|
||||
#define NODE_IOC_FORCE_DUMP_PACKET 0x0002002e
|
||||
#define NODE_IOC_GET_MIXER_INFO 0x0002002f
|
||||
#define NODE_IOC_TWS_TX_SWITCH 0x00020030
|
||||
#define NODE_IOC_GET_ID3 0x00020031
|
||||
#define NODE_IOC_GET_ENC_TIME 0x00020032 //获取编码时间
|
||||
#define NODE_IOC_SET_SYNC_NETWORK 0x0002003b
|
||||
#define NODE_IOC_GET_PRIV_FMT 0x0002003c
|
||||
|
||||
#define NODE_IOC_START (0x00040000 | NODE_STA_RUN)
|
||||
#define NODE_IOC_PAUSE (0x00040000 | NODE_STA_PAUSE)
|
||||
#define NODE_IOC_STOP (0x00040000 | NODE_STA_STOP)
|
||||
#define NODE_IOC_SUSPEND (0x00040000 | NODE_STA_SUSPEND)
|
||||
|
||||
#define TIMESTAMP_US_DENOMINATOR 32
|
||||
|
||||
enum stream_event {
|
||||
STREAM_EVENT_NONE,
|
||||
STREAM_EVENT_INIT,
|
||||
STREAM_EVENT_LOAD_DECODER,
|
||||
STREAM_EVENT_LOAD_ENCODER,
|
||||
STREAM_EVENT_UNLOAD_DECODER,
|
||||
STREAM_EVENT_UNLOAD_ENCODER,
|
||||
|
||||
STREAM_EVENT_SUSPEND,
|
||||
STREAM_EVENT_READY,
|
||||
STREAM_EVENT_START,
|
||||
STREAM_EVENT_PAUSE,
|
||||
STREAM_EVENT_STOP,
|
||||
|
||||
STREAM_EVENT_CLOSE_PLAYER,
|
||||
STREAM_EVENT_CLOSE_RECODER,
|
||||
STREAM_EVENT_PREEMPTED,
|
||||
STREAM_EVENT_NEGOTIATE_FAILD,
|
||||
STREAM_EVENT_GET_PIPELINE_UUID,
|
||||
|
||||
STREAM_EVENT_GET_COEXIST_POLICY,
|
||||
STREAM_EVENT_INC_SYS_CLOCK,
|
||||
|
||||
STREAM_EVENT_GET_NODE_PARM,
|
||||
STREAM_EVENT_GET_EFF_ONLINE_PARM,
|
||||
|
||||
STREAM_EVENT_A2DP_ENERGY,
|
||||
|
||||
STREAM_EVENT_GET_SWITCH_CALLBACK,
|
||||
|
||||
STREAM_EVENT_GET_CVP_MODE,
|
||||
};
|
||||
|
||||
enum stream_scene : u8 {
|
||||
STREAM_SCENE_A2DP,
|
||||
STREAM_SCENE_ESCO,
|
||||
STREAM_SCENE_TWS_MUSIC, // TWS转发本地音频文件
|
||||
STREAM_SCENE_AI_VOICE,
|
||||
STREAM_SCENE_LINEIN, //linein 模式
|
||||
STREAM_SCENE_FM, //FM 模式
|
||||
STREAM_SCENE_TDM, //TDM 模式
|
||||
STREAM_SCENE_MUSIC, //本地音乐
|
||||
STREAM_SCENE_RECODER, //录音
|
||||
STREAM_SCENE_SPDIF,
|
||||
STREAM_SCENE_PC_SPK,
|
||||
STREAM_SCENE_PC_MIC,
|
||||
STREAM_SCENE_IIS,
|
||||
STREAM_SCENE_MUTI_CH_IIS,
|
||||
STREAM_SCENE_MIC, //mic 模式
|
||||
STREAM_SCENE_MIC_EFFECT,
|
||||
STREAM_SCENE_MIC_EFFECT2,
|
||||
STREAM_SCENE_HEARING_AID,
|
||||
STREAM_SCENE_DEV_FLOW,
|
||||
STREAM_SCENE_LE_AUDIO,//LE Audio Media
|
||||
STREAM_SCENE_LEA_CALL,//LE Audio CALL
|
||||
STREAM_SCENE_ADDA_LOOP,
|
||||
STREAM_SCENE_OPUS,
|
||||
STREAM_SCENE_WIRELESS_MIC, //16 wireless mic
|
||||
STREAM_SCENE_LOCAL_TWS,
|
||||
STREAM_SCENE_MIDI, //MIDI 琴解码
|
||||
|
||||
STREAM_SCENE_LOUDSPEAKER_IIS, //扩音器IIS
|
||||
STREAM_SCENE_LOUDSPEAKER_MIC, //扩音器MIC
|
||||
//最大32个场景,如果大于32个场景,需要把tone、ring、ket_tone场景号往后挪
|
||||
STREAM_SCENE_TONE = 0x20,
|
||||
STREAM_SCENE_RING = 0x60,
|
||||
STREAM_SCENE_KEY_TONE = 0xa0,
|
||||
STREAM_SCENE_NONE = 0xff,
|
||||
};
|
||||
|
||||
enum stream_coexist : u8 {
|
||||
STREAM_COEXIST_AUTO,
|
||||
STREAM_COEXIST_DISABLE,
|
||||
};
|
||||
|
||||
|
||||
enum stream_state : u8 {
|
||||
STREAM_STA_INIT,
|
||||
STREAM_STA_NEGOTIATE,
|
||||
STREAM_STA_READY,
|
||||
STREAM_STA_START,
|
||||
STREAM_STA_STOP,
|
||||
STREAM_STA_PLAY,
|
||||
|
||||
STREAM_STA_PAUSE = 0x10,
|
||||
STREAM_STA_PREEMPTED = 0x20,
|
||||
STREAM_STA_SUSPEND = 0x30,
|
||||
};
|
||||
|
||||
enum stream_node_state : u16 {
|
||||
NODE_STA_RUN = 0x0001,
|
||||
NODE_STA_PAUSE = 0x0002,
|
||||
NODE_STA_SUSPEND = 0x0004,
|
||||
NODE_STA_STOP = 0x0008,
|
||||
NODE_STA_PEND = 0x0010,
|
||||
NODE_STA_DEC_NO_DATA = 0x0020,
|
||||
NODE_STA_DEC_END = 0x0040,
|
||||
NODE_STA_DEC_PAUSE = 0x0080,
|
||||
NODE_STA_DEC_ERR = 0x00c0,
|
||||
NODE_STA_SOURCE_NO_DATA = 0x0100,
|
||||
NODE_STA_DEV_ERR = 0x0200,
|
||||
NODE_STA_ENC_END = 0x0400,
|
||||
NODE_STA_OUTPUT_TO_FAST = 0x0800, //解码输出太多主动挂起
|
||||
NODE_STA_OUTPUT_BLOCKED = 0x1000, //终端节点缓存满,数据写不进去
|
||||
NODE_STA_OUTPUT_SPLIT = 0x2000,
|
||||
};
|
||||
|
||||
enum stream_node_type : u8 {
|
||||
NODE_TYPE_SYNC = 0x01,
|
||||
NODE_TYPE_BYPASS = 0x03,
|
||||
NODE_TYPE_FLOW_CTRL = 0x04,
|
||||
NODE_TYPE_ASYNC = 0x10,
|
||||
NODE_TYPE_IRQ = 0x20,
|
||||
NODE_TYPE_SWITCH = 0x40,
|
||||
};
|
||||
|
||||
enum negotiation_state : u8 {
|
||||
NEGO_STA_CONTINUE = 0x01,
|
||||
NEGO_STA_ACCPTED = 0x02,
|
||||
NEGO_STA_SUSPEND = 0x04,
|
||||
NEGO_STA_DELAY = 0x08,
|
||||
NEGO_STA_ABORT = 0x10,
|
||||
NEGO_STA_SAMPLE_RATE_LOCK = 0x20,
|
||||
};
|
||||
|
||||
enum pcm_24bit_data_type : u8 {
|
||||
PCM_24BIT_DATA_4BYTE = 0,
|
||||
PCM_24BIT_DATA_3BYTE,
|
||||
};
|
||||
|
||||
struct stream_fmt {
|
||||
u8 Qval;
|
||||
u8 bit_wide; //数据流中数据的位宽。
|
||||
u8 dec_bit_wide; //解码需要配置的位宽。
|
||||
u8 pcm_24bit_type; //用于判断3byte_24bit数据或4byte_24bit数据
|
||||
u8 channel_mode;
|
||||
u8 chconfig_id; //声道Id, LDAC解码需要配置的参数,通过这个解析出声道类型。
|
||||
u16 frame_dms; //帧长时间,单位 deci-ms (ms/10)
|
||||
u16 codec_version; //数据编码类型的版本,同一种coding_type,可能存在不同的版本,LHDC 解码需要配置的参数。
|
||||
u32 bit_rate;
|
||||
u32 sample_rate;
|
||||
u32 coding_type;
|
||||
};
|
||||
|
||||
struct stream_enc_fmt {
|
||||
u8 channel;
|
||||
u8 bit_width;
|
||||
u16 frame_dms; //帧长时间,单位 deci-ms (ms/10)
|
||||
u32 sample_rate;
|
||||
u32 bit_rate;
|
||||
u32 coding_type;
|
||||
};
|
||||
|
||||
struct stream_file_ops {
|
||||
int (*read)(void *file, u8 *buf, int len);
|
||||
int (*seek)(void *file, int offset, int fromwhere);
|
||||
int (*write)(void *file, u8 *data, int len);
|
||||
int (*close)(void *file);
|
||||
int (*get_fmt)(void *file, struct stream_fmt *fmt);
|
||||
int (*get_name)(void *file, u8 *name, int len);
|
||||
};
|
||||
|
||||
struct stream_file_info {
|
||||
void *file;
|
||||
const char *fname;
|
||||
const struct stream_file_ops *ops;
|
||||
struct audio_dec_breakpoint *dbp;
|
||||
enum stream_scene scene;
|
||||
u32 coding_type;
|
||||
};
|
||||
|
||||
struct stream_dec_file {
|
||||
void *file;
|
||||
int (*fread)(void *file, u8 *buf, u32 fpos, int len, OS_SEM *sem);
|
||||
};
|
||||
|
||||
struct stream_get_fmt {
|
||||
struct stream_file_info *file_info;
|
||||
struct stream_fmt *fmt;
|
||||
};
|
||||
|
||||
struct stream_decoder_info {
|
||||
enum stream_scene scene;
|
||||
u8 frame_time;
|
||||
u32 coding_type;
|
||||
const char *task_name;
|
||||
};
|
||||
|
||||
struct stream_encoder_info {
|
||||
enum stream_scene scene;
|
||||
u32 coding_type;
|
||||
const char *task_name;
|
||||
};
|
||||
|
||||
/*
|
||||
* scene_a和scene_b指定的格式有冲突,scene_a抢占scene_b
|
||||
*/
|
||||
struct stream_coexist_policy {
|
||||
enum stream_scene scene_a;
|
||||
enum stream_scene scene_b;
|
||||
u32 coding_a;
|
||||
u32 coding_b;
|
||||
};
|
||||
|
||||
enum frame_flags : u16 {
|
||||
FRAME_FLAG_FLUSH_OUT = 0x01,
|
||||
FRAME_FLAG_FILL_ZERO = 0x03, //补0包
|
||||
FRAME_FLAG_FILL_PACKET = 0x05, //补数据包
|
||||
FRAME_FLAG_TIMESTAMP_ENABLE = 0x08, //时间戳有效
|
||||
FRAME_FLAG_RESET_TIMESTAMP_BIT = 0x10,
|
||||
FRAME_FLAG_RESET_TIMESTAMP = 0x11, //重设各节点的时间戳
|
||||
FRAME_FLAG_SET_DRIFT_BIT = 0x20,
|
||||
FRAME_FLAG_SET_D_SAMPLE_RATE = 0x21, //设置sampte_rate的delta
|
||||
FRAME_FLAG_UPDATE_TIMESTAMP = 0x40, //更新时间戳,驱动节点重设
|
||||
FRAME_FLAG_UPDATE_DRIFT_SAMPLE_RATE = 0x80,
|
||||
FRAME_FLAG_SYS_TIMESTAMP_ENABLE = 0x100, //数据帧使用系统时间戳
|
||||
FRAME_FLAG_PERIOD_SAMPLE = 0x200,
|
||||
FRAME_FLAG_UPDATE_INFO = FRAME_FLAG_UPDATE_TIMESTAMP | FRAME_FLAG_UPDATE_DRIFT_SAMPLE_RATE,
|
||||
|
||||
FRAME_FLAG_PULL_AGAIN = 0x1000 //frame被pull过之后被重新加回iport->frame
|
||||
};
|
||||
|
||||
enum audio_Qval : u8 {
|
||||
AUDIO_QVAL_16BIT = 15,
|
||||
AUDIO_QVAL_24BIT = 23,
|
||||
};
|
||||
|
||||
struct node_port_data_wide {
|
||||
u8 iport_data_wide;//DATA_BIT_WIDE_16BIT,DATA_BIT_WIDE_24BIT
|
||||
u8 oport_data_wide;//DATA_BIT_WIDE_16BIT,DATA_BIT_WIDE_24BIT
|
||||
} __attribute__((packed));
|
||||
|
||||
struct stream_bit_width {
|
||||
u8 bit_width;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct stream_frame {
|
||||
struct list_head entry;
|
||||
u8 bit_wide;
|
||||
u16 delay;
|
||||
u16 offset;
|
||||
u16 len;
|
||||
u16 size;
|
||||
s16 d_sample_rate;
|
||||
enum frame_flags flags;
|
||||
u32 timestamp;
|
||||
u32 fpos;
|
||||
u8 data[0];
|
||||
};
|
||||
|
||||
|
||||
struct stream_thread {
|
||||
u8 id;
|
||||
u8 debug;
|
||||
u8 start;
|
||||
u8 runing;
|
||||
u32 start_usec;
|
||||
char name[16];
|
||||
OS_SEM sem;
|
||||
OS_MUTEX mutex;
|
||||
struct jlstream *stream;
|
||||
struct stream_thread *next;
|
||||
};
|
||||
|
||||
struct stream_iport {
|
||||
struct list_head frames;
|
||||
|
||||
u8 id;
|
||||
|
||||
u16 max_len;
|
||||
|
||||
enum stream_node_state state;
|
||||
|
||||
#if STREAM_NODE_RUN_TIMER_DEBUG_EN
|
||||
u32 run_time; //usec
|
||||
#endif
|
||||
|
||||
void *private_data;
|
||||
|
||||
struct stream_node *node;
|
||||
|
||||
struct stream_oport *prev;
|
||||
|
||||
struct stream_iport *sibling;
|
||||
|
||||
void (*handle_frame)(struct stream_iport *, struct stream_note *note);
|
||||
};
|
||||
|
||||
|
||||
struct stream_oport {
|
||||
|
||||
s16 d_sample_rate;
|
||||
enum frame_flags flags;
|
||||
u8 id;
|
||||
u16 buffered_pcms;
|
||||
|
||||
struct stream_fmt fmt;
|
||||
|
||||
u32 offset;
|
||||
u32 timestamp;
|
||||
|
||||
struct stream_node *node;
|
||||
|
||||
struct stream_iport *next;
|
||||
|
||||
struct stream_oport *sibling;
|
||||
};
|
||||
|
||||
|
||||
struct stream_node_adapter {
|
||||
const char *name;
|
||||
|
||||
u16 uuid;
|
||||
|
||||
u8 ability_channel_in;
|
||||
u8 ability_channel_out;
|
||||
u8 ability_channel_convert;
|
||||
u8 ability_resample;
|
||||
u8 ability_bit_wide;
|
||||
|
||||
int (*bind)(struct stream_node *, u16 uuid);
|
||||
|
||||
int (*ioctl)(struct stream_iport *iport, int cmd, int arg);
|
||||
|
||||
void (*release)(struct stream_node *node);
|
||||
};
|
||||
|
||||
struct stream_node {
|
||||
|
||||
u8 subid;
|
||||
|
||||
u16 uuid;
|
||||
|
||||
u16 pipeline;
|
||||
|
||||
enum stream_node_type type;
|
||||
|
||||
enum stream_node_state state;
|
||||
|
||||
void *private_data;
|
||||
|
||||
struct stream_iport *iport;
|
||||
|
||||
struct stream_oport *oport;
|
||||
|
||||
OS_MUTEX mutex;
|
||||
|
||||
const struct stream_node_adapter *adapter;
|
||||
};
|
||||
|
||||
struct stream_snode {
|
||||
struct stream_node node;
|
||||
|
||||
struct jlstream *stream;
|
||||
};
|
||||
|
||||
enum {
|
||||
THREAD_TYPE_SOURCE = 0x01,
|
||||
THREAD_TYPE_DEC = 0x02,
|
||||
THREAD_TYPE_ENC = 0x04,
|
||||
THREAD_TYPE_OUTPUT = 0x08,
|
||||
};
|
||||
|
||||
|
||||
struct stream_note {
|
||||
|
||||
u8 output_time;
|
||||
u8 output_start;
|
||||
enum stream_node_state state;
|
||||
|
||||
int delay;
|
||||
int sleep;
|
||||
u32 jiffies;
|
||||
|
||||
struct jlstream *stream;
|
||||
struct stream_thread *thread;
|
||||
};
|
||||
|
||||
struct stream_ctrl {
|
||||
enum stream_state state;
|
||||
u16 fade_msec;
|
||||
u32 fade_timeout;
|
||||
OS_SEM sem;
|
||||
};
|
||||
|
||||
struct jlstream {
|
||||
struct list_head entry;
|
||||
|
||||
u8 id;
|
||||
u8 ref;
|
||||
u8 run_cnt;
|
||||
u8 delay;
|
||||
u8 incr_sys_clk;
|
||||
u8 thread_num;
|
||||
u8 output_time;
|
||||
u8 thread_policy_step;
|
||||
enum stream_state state;
|
||||
enum stream_state pp_state;
|
||||
enum stream_coexist coexist;
|
||||
|
||||
u16 max_delay;
|
||||
u16 dest_delay; // 目标缓存大小
|
||||
u16 timer;
|
||||
u16 thread_timer;
|
||||
enum stream_scene scene;
|
||||
|
||||
u32 end_jiffies;
|
||||
u32 coding_type;
|
||||
#if STREAM_NODE_RUN_TIMER_DEBUG_EN
|
||||
u32 run_usec;
|
||||
#endif
|
||||
|
||||
struct stream_snode *snode;
|
||||
|
||||
struct stream_ctrl ctrl;
|
||||
|
||||
struct stream_thread *thread;
|
||||
struct stream_thread *last_thread;
|
||||
|
||||
jlstream_breaker_t breaker;
|
||||
|
||||
void *callback_arg;
|
||||
const char *callback_task;
|
||||
void (*callback_func)(void *, int);
|
||||
};
|
||||
|
||||
|
||||
#define REGISTER_STREAM_NODE_ADAPTER(adapter) \
|
||||
const struct stream_node_adapter adapter sec(.stream_node_adapter)
|
||||
|
||||
#define PCM_SAMPLE_ONE_SECOND (1000000 * TIMESTAMP_US_DENOMINATOR)
|
||||
#define PCM_SAMPLE_TO_TIMESTAMP(frames, sample_rate) \
|
||||
((u64)(frames) * PCM_SAMPLE_ONE_SECOND / ((u32)sample_rate))
|
||||
|
||||
#define TIME_TO_PCM_SAMPLES(time, sample_rate) \
|
||||
(((u64)time * sample_rate / PCM_SAMPLE_ONE_SECOND) + (((u64)time * sample_rate) % PCM_SAMPLE_ONE_SECOND == 0 ? 0 : 1))
|
||||
|
||||
|
||||
void jlstream_lock();
|
||||
|
||||
void jlstream_unlock();
|
||||
|
||||
int jlstream_event_notify(enum stream_event, int arg);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 申请一个指定长度的frame
|
||||
*/
|
||||
struct stream_frame *jlstream_get_frame(struct stream_oport *, u16 len);
|
||||
|
||||
/*
|
||||
* 将frame推送给后级节点
|
||||
*/
|
||||
void jlstream_push_frame(struct stream_oport *, struct stream_frame *);
|
||||
|
||||
/*
|
||||
* 获取一个前级推送的frame
|
||||
*/
|
||||
struct stream_frame *jlstream_pull_frame(struct stream_iport *, struct stream_note *);
|
||||
|
||||
/*
|
||||
* 从前级推送的frame中读取指定长度数据
|
||||
*/
|
||||
int jlstream_pull_data(struct stream_iport *iport, u32 fpos, u8 *buf, int len);
|
||||
|
||||
|
||||
/*
|
||||
* 释放已经处理完数据的frame
|
||||
*/
|
||||
void jlstream_free_frame(struct stream_frame *frame);
|
||||
|
||||
/*
|
||||
* 释放所有缓存的frame
|
||||
*/
|
||||
void jlstream_free_iport_frames(struct stream_iport *iport);
|
||||
|
||||
|
||||
|
||||
void jlstream_frame_bypass(struct stream_iport *iport, struct stream_note *note);
|
||||
|
||||
|
||||
int jlstream_get_iport_data_len(struct stream_iport *iport);
|
||||
|
||||
int jlstream_get_iport_delay(struct stream_iport *iport);
|
||||
|
||||
int jlstream_get_iport_frame_num(struct stream_iport *iport);
|
||||
|
||||
void jlstream_wakeup_thread(struct jlstream *stream, struct stream_node *node, struct stream_thread *thread);
|
||||
|
||||
int stream_node_ioctl(struct stream_node *node, u16 uuid, int cmd, int arg);
|
||||
|
||||
int jlstream_node_ioctl(struct jlstream *stream, u16 uuid, int cmd, int arg);
|
||||
|
||||
int jlstream_ioctl(struct jlstream *jlstream, int cmd, int arg);
|
||||
|
||||
int jlstream_iport_ioctl(struct stream_iport *iport, int cmd, int arg);
|
||||
|
||||
|
||||
struct jlstream *jlstream_for_node(struct stream_node *node);
|
||||
|
||||
int jlstream_read_node_data(u16 uuid, u8 subid, u8 *buf);
|
||||
int jlstream_read_node_port_data_wide(u16 uuid, u8 subid, u8 *buf);
|
||||
|
||||
int jlstream_read_stream_crc();
|
||||
|
||||
int jlstream_get_delay(struct jlstream *stream);
|
||||
|
||||
|
||||
/*
|
||||
* 数据流创建和控制接口
|
||||
*/
|
||||
struct jlstream *jlstream_pipeline_parse(u16 pipeline, u16 source_uuid);
|
||||
struct jlstream *jlstream_pipeline_parse_by_node_name(u16 pipeline, const char *node_name);
|
||||
|
||||
void jlstream_set_scene(struct jlstream *stream, enum stream_scene scene);
|
||||
|
||||
void jlstream_set_coexist(struct jlstream *stream, enum stream_coexist coexist);
|
||||
|
||||
void jlstream_set_callback(struct jlstream *stream, void *arg,
|
||||
void (*callback)(void *, int));
|
||||
|
||||
|
||||
/*
|
||||
* 设置文件句柄和文件操作接口
|
||||
*/
|
||||
int jlstream_set_dec_file(struct jlstream *stream, void *file_hdl,
|
||||
const struct stream_file_ops *ops);
|
||||
|
||||
int jlstream_set_enc_file(struct jlstream *stream, void *file_hdl,
|
||||
const struct stream_file_ops *ops);
|
||||
|
||||
|
||||
int jlstream_add_thread(struct jlstream *stream, const char *thread_name);
|
||||
|
||||
/*
|
||||
* 启动数据流
|
||||
*/
|
||||
int jlstream_start(struct jlstream *stream);
|
||||
|
||||
|
||||
/*
|
||||
* 播放/暂停切换接口,fade_msec 为淡入/淡出时间
|
||||
*/
|
||||
int jlstream_pp_toggle(struct jlstream *stream, u16 fade_msec);
|
||||
|
||||
|
||||
/*
|
||||
*停止数据流,fade_msec 为淡出时间
|
||||
*/
|
||||
void jlstream_stop(struct jlstream *stream, u16 fade_msec);
|
||||
|
||||
|
||||
/*
|
||||
*释放数据流
|
||||
*/
|
||||
void jlstream_release(struct jlstream *stream);
|
||||
|
||||
|
||||
int jlstream_fade_out_32bit(int value, s16 step, s32 *data, int len, u8 channel);
|
||||
int jlstream_fade_out(int value, s16 step, s16 *data, int len, u8 channel);
|
||||
|
||||
int jlstream_fade_in(int value, s16 step, s16 *data, int len, u8 channel);
|
||||
int jlstream_fade_in_32bit(int value, s16 step, s32 *data, int len, u8 channel);
|
||||
|
||||
/*
|
||||
* 获取节点和设置节点参数接口
|
||||
*/
|
||||
void *jlstream_get_node(u16 node_uuid, const char *name);
|
||||
|
||||
int jlstream_set_node_param_s(void *node, void *param, u16 param_len);
|
||||
|
||||
int jlstream_get_node_param_s(void *node, void *param, u16 param_len);
|
||||
|
||||
void jlstream_put_node(void *);
|
||||
|
||||
int jlstream_set_node_param(u16 node_uuid, const char *name, void *param, u16 param_len);
|
||||
|
||||
int jlstream_get_node_param(u16 node_uuid, const char *name, void *param, u16 param_len);
|
||||
|
||||
int jlstream_read_bit_width(u16 uuid, u8 *buf);
|
||||
|
||||
int jlstream_is_contains_node_from(struct stream_node *node, u16 node_uuid);
|
||||
|
||||
/*
|
||||
* 数据淡入淡出接口
|
||||
*
|
||||
*/
|
||||
struct jlstream_fade {
|
||||
u8 in;
|
||||
u8 out;
|
||||
u8 channel;
|
||||
u8 bit_wide;
|
||||
s16 step;
|
||||
s16 value;
|
||||
};
|
||||
|
||||
/*
|
||||
* dir 0:淡出, 1:淡入
|
||||
*/
|
||||
void jlstream_fade_init(struct jlstream_fade *fade, int dir, u32 sample_rate,
|
||||
u8 channel, u16 msec);
|
||||
|
||||
enum stream_fade_result {
|
||||
STREAM_FADE_IN,
|
||||
STREAM_FADE_OUT,
|
||||
STREAM_FADE_IN_END,
|
||||
STREAM_FADE_OUT_END,
|
||||
STREAM_FADE_END,
|
||||
};
|
||||
|
||||
enum stream_fade_result jlstream_fade_data(struct jlstream_fade *fade, u8 *data, int len);
|
||||
|
||||
|
||||
|
||||
|
||||
void jlstream_del_node_from_thread(struct stream_node *node);
|
||||
|
||||
int jlstream_add_node_2_thread(struct stream_node *node, const char *task_name);
|
||||
|
||||
void jlstream_global_lock();
|
||||
void jlstream_global_unlock();
|
||||
bool jlstream_global_locked();
|
||||
|
||||
int jlstream_global_pause();
|
||||
int jlstream_global_resume();
|
||||
|
||||
jlstream_breaker_t jlstream_insert_breaker(struct jlstream *stream,
|
||||
u16 uuid_a, const char *name_a,
|
||||
u16 uuid_b, const char *name_b);
|
||||
|
||||
int jlstream_delete_breaker(jlstream_breaker_t breaker, bool restore);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
#ifndef NODE_UUID_H
|
||||
#define NODE_UUID_H
|
||||
|
||||
|
||||
#define NODE_UUID_SOURCE 0x1100
|
||||
#define NODE_UUID_DEMUXER 0x1200
|
||||
#define NODE_UUID_DECODER 0x1A85
|
||||
#define NODE_UUID_ENCODER 0x0A2C
|
||||
|
||||
#define NODE_UUID_TONE 0x768A
|
||||
#define NODE_UUID_RING 0xCADC
|
||||
#define NODE_UUID_KEY_TONE 0x8346
|
||||
#define NODE_UUID_EQ 0x737B
|
||||
#define NODE_UUID_SRC 0x1ECD
|
||||
#define NODE_UUID_MIXER 0xE62A
|
||||
#define NODE_UUID_DAC 0xDCCD
|
||||
#define NODE_UUID_CLASSD 0x5D98
|
||||
#define NODE_UUID_IIS0_TX 0x69A5
|
||||
#define NODE_UUID_IIS1_TX 0xF606
|
||||
#define NODE_UUID_IIS0_RX 0x6963
|
||||
#define NODE_UUID_IIS1_RX 0xF5C4
|
||||
#define NODE_UUID_ADC 0xD06D
|
||||
#define NODE_UUID_A2DP_RX 0xF975
|
||||
#define NODE_UUID_A2DP_TX 0xF9B7
|
||||
#define NODE_UUID_ESCO_RX 0x8458
|
||||
#define NODE_UUID_ESCO_TX 0x849A
|
||||
#define NODE_UUID_BT_AUDIO_SYNC 0xA576
|
||||
#define NODE_UUID_VOLUME_CTRLER 0x74E3
|
||||
#define NODE_UUID_MULTIPLEX 0x2C15
|
||||
#define NODE_UUID_UART_DUMP 0xE76E
|
||||
#define NODE_UUID_MUTE 0xD5E0
|
||||
#define NODE_UUID_PLC 0xED7F
|
||||
#define NODE_UUID_CVP_SMS_ANS 0xD0BC
|
||||
#define NODE_UUID_CVP_SMS_DNS 0xDBF5
|
||||
#define NODE_UUID_CVP_DMS_ANS 0x2115
|
||||
#define NODE_UUID_CVP_DMS_DNS 0x420E
|
||||
#define NODE_UUID_CVP_DMS_FLEXIBLE_ANS 0x90F9
|
||||
#define NODE_UUID_CVP_DMS_FLEXIBLE_DNS 0x68F2
|
||||
#define NODE_UUID_CVP_3MIC 0X0048
|
||||
#define NODE_UUID_CVP_DMS_HYBRID_DNS 0X5DF0
|
||||
#define NODE_UUID_CVP_DEVELOP 0X76EF
|
||||
#define NODE_UUID_AI_TX 0xDFDA
|
||||
#define NODE_UUID_AI_RX 0xDF98
|
||||
#define NODE_UUID_VIDEO_DEC 0X1E07
|
||||
#define NODE_UUID_NOISE_SUPPRESSOR 0x3BC9
|
||||
#define NODE_UUID_SURROUND_DEMO 0x3F20
|
||||
#define NODE_UUID_AUTOMUTE 0X86B9
|
||||
#define NODE_UUID_LINEIN 0X0624
|
||||
#define NODE_UUID_SPDIF 0XFB3B
|
||||
#define NODE_UUID_PC_SPK 0XD186
|
||||
#define NODE_UUID_PC_MIC 0XB711
|
||||
#define NODE_UUID_MUSIC 0x6FEC
|
||||
#define NODE_UUID_PDM_MIC 0XA09F
|
||||
#define NODE_UUID_CHANNLE_SWAP 0X36D7
|
||||
#define NODE_UUID_FM 0X7398
|
||||
#define NODE_UUID_SPATIAL_EFFECTS 0X83E1
|
||||
#define NODE_UUID_WRITE_FILE 0x23C1
|
||||
#define NODE_UUID_FILE_PACKAGE 0xE2CB
|
||||
#define NODE_UUID_LE_AUDIO_PCM 0xC4B7
|
||||
#define NODE_UUID_LE_AUDIO_TX 0xDEF2
|
||||
#define NODE_UUID_LE_AUDIO_RX 0xDEB0
|
||||
#define NODE_UUID_CAPTURE_SYNC 0xFF09
|
||||
#define NODE_UUID_SPDIF_MASTER 0x9412
|
||||
#define NODE_UUID_SWITCH 0x2357
|
||||
|
||||
/*通话CVP子模块UUID*/
|
||||
#define NODE_UUID_AEC 0xA9CE
|
||||
#define NODE_UUID_NLP 0xD3C9
|
||||
#define NODE_UUID_ANS 0x69BD
|
||||
#define NODE_UUID_DNS 0xBC6F
|
||||
#define NODE_UUID_AGC 0xD0D0
|
||||
|
||||
#define NODE_UUID_ENC 0xE2BB
|
||||
#define NODE_UUID_DMS_AEC 0x1EB2
|
||||
#define NODE_UUID_DMS_NLP 0xF4CA
|
||||
#define NODE_UUID_DMS_ANS 0x5721
|
||||
#define NODE_UUID_DMS_DNS 0x4C53
|
||||
#define NODE_UUID_DMS_GLOABL 0x62B2
|
||||
|
||||
#define NODE_UUID_SOUND_SPLITTER 0xD911//音频分流器
|
||||
#define NODE_UUID_VOCAL_TRACK_SYNTHESIS 0x503d//声道组合器
|
||||
#define NODE_UUID_VOCAL_TRACK_SEPARATION 0xA724//声道拆分器
|
||||
#define NODE_UUID_CROSSOVER 0xBF28//分频器3段
|
||||
#define NODE_UUID_CROSSOVER_2BAND 0x8D63//分频器2段
|
||||
#define NODE_UUID_WDRC 0xDEFE//WDRC
|
||||
#define NODE_UUID_GAIN 0xA904//16bit位宽增益控制
|
||||
#define NODE_UUID_VBASS 0xB0D5//虚拟低音
|
||||
#define NODE_UUID_STEROMIX 0xfb00//立体声左右声道按不同比例混合
|
||||
#define NODE_UUID_DYNAMIC_EQ 0x87A0//动态eq
|
||||
#define NODE_UUID_DYNAMIC_EQ_EXT_DETECTOR 0XA60B//动态eq,支持det使用不同的源头
|
||||
#define NODE_UUID_DYNAMIC_EQ_PRO 0x4731//动态eq pro
|
||||
#define NODE_UUID_DYNAMIC_EQ_PRO_EXT_DETECTOR 0x793c//动态eq pro ext
|
||||
#define NODE_UUID_SURROUND 0x8934//环绕声
|
||||
#define NODE_UUID_VOICE_CHANGER 0x7293//变声器,针对人声处理
|
||||
#define NODE_UUID_VOICE_CHANGER_ADV 0x320E//优化了某些场景的变声效果,相应资源消耗更多
|
||||
#define NODE_UUID_NOISEGATE 0xB7C4//门限噪声
|
||||
#define NODE_UUID_FREQUENCY_SHIFT 0x6195//移频啸叫抑制
|
||||
#define NODE_UUID_HOWLING_SUPPRESS 0xC482//陷波啸叫抑制
|
||||
#define NODE_UUID_PLATE_REVERB_ADVANCE 0x753 //高阶混响
|
||||
#define NODE_UUID_PLATE_REVERB 0x5101//混响
|
||||
#define NODE_UUID_ECHO 0x98a4//回声
|
||||
#define NODE_UUID_SPECTRUM 0xF538//频谱计算
|
||||
#define NODE_UUID_AUTOTUNE 0xc07a//电子音
|
||||
#define NODE_UUID_VOCAL_REMOVER 0x2F7A//人声消除,只支持立体声
|
||||
#define NODE_UUID_SPEAKER_EQ 0x3BE6//喇叭频响矫正
|
||||
#define NODE_UUID_BASS_TREBLE 0xcc8c//高低音
|
||||
#define NODE_UUID_ZERO_ACTIVE 0x2FE1//零数据产生器
|
||||
#define NODE_UUID_3BAND_MERGE 0x1B9D//3带合并
|
||||
#define NODE_UUID_2BAND_MERGE 0x665c//2带合并
|
||||
#define NODE_UUID_PITCH_SPEED 0x540e//变速变调,针对歌曲处理
|
||||
#define NODE_UUID_CONVERT 0x1aa6//饱和溢出位宽转换
|
||||
#define NODE_UUID_BIT_WIDTH_CONVERT 0x7DE5//位移方式位宽转换
|
||||
#define NODE_UUID_ENERGY_DETECT 0xA248//能量检测
|
||||
#define NODE_UUID_STEREO_WIDENER 0x88E5//立体声增强
|
||||
#define NODE_UUID_PLAY_SYNC 0x9B3B//播放同步
|
||||
#define NODE_UUID_HARMONIC_EXCITER 0x1B2A//谐波增强
|
||||
#define NODE_UUID_INDICATOR 0x48E2//分贝指示器
|
||||
#define NODE_UUID_CHORUS 0x6DD9//合唱
|
||||
#define NODE_UUID_CHANNEL_EXPANDER 0xDA15//声道扩展
|
||||
#define NODE_UUID_CHANNEL_MERGE 0xBF8E//声道合并
|
||||
#define NODE_UUID_WDRC_DETECTOR 0x9A58//支持外部数据源检测的wdrc
|
||||
#define NODE_UUID_WDRC_ADVANCE 0x4250//drc_advance
|
||||
#define NODE_UUID_PCM_DELAY 0xA8F4//延时模块,支持各声道独立设置
|
||||
#define NODE_UUID_AUTODUCK 0x6CE5//自动闪避<响应器>
|
||||
#define NODE_UUID_AUTODUCK_TRIGGER 0x7099//自动闪避<触发器>
|
||||
|
||||
#define NODE_UUID_EFFECT_DEV0 0xA4E1//第三方算法0
|
||||
#define NODE_UUID_EFFECT_DEV1 0xA4E2//第三方算法1
|
||||
#define NODE_UUID_EFFECT_DEV2 0xA4E3//第三方算法2
|
||||
#define NODE_UUID_EFFECT_DEV3 0xA4E4//第三方算法3
|
||||
#define NODE_UUID_EFFECT_DEV4 0xA4E5//第三方算法4
|
||||
|
||||
#define NODE_UUID_DATA_SATURATION 0x6B29//位宽饱和处理 24bit或16bit
|
||||
#define NODE_UUID_AUTOWAH 0x2F5E//自动哇
|
||||
#define NODE_UUID_PINGPONG_PCM_DELAY 0xF936//pingpong延时
|
||||
#define NODE_UUID_THREE_D 0x8c21 //three d
|
||||
#define NODE_UUID_LLNS 0x9FE //低延时降噪
|
||||
#define NODE_UUID_FADE 0x1BF5
|
||||
|
||||
#define NODE_UUID_SOURCE_DEV0 0x8FC4//自定义源节点0
|
||||
#define NODE_UUID_SOURCE_DEV1 0x8FC5//自定义源节点1
|
||||
|
||||
#define NODE_UUID_SINK_DEV0 0xB328//自定义输出节点0
|
||||
#define NODE_UUID_SINK_DEV1 0xB329//自定义输出节点1
|
||||
|
||||
#define NODE_UUID_ANC_DYNAMIC_GAIN 0x4A0E//ANC音乐动态增益
|
||||
|
||||
#define NODE_UUID_DNS_NOISE_SUPPRESSOR 0xAE
|
||||
|
||||
#define NODE_UUID_MDRC 0x74CB//多带DRC
|
||||
#define NODE_UUID_SOF_EQ 0x3845
|
||||
|
||||
#define NODE_UUID_LIMITER 0x4E5B//limiter
|
||||
#define NODE_UUID_MULTIBAND_LIMITER 0xF58A//多带limiter
|
||||
#define NODE_UUID_DATA_EXPORT 0xDE61//数据导出节点
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef SOURCE_NODE_MGR_H
|
||||
#define SOURCE_NODE_MGR_H
|
||||
|
||||
#include "jlstream.h"
|
||||
#include "media/audio_base.h"
|
||||
|
||||
enum {
|
||||
SRC_NODE_ERR_FILE_END = 1,
|
||||
};
|
||||
|
||||
|
||||
struct source_node_plug {
|
||||
u16 uuid;
|
||||
|
||||
u16 frame_size;
|
||||
|
||||
void *(*init)(void *, struct stream_node *node);
|
||||
|
||||
int (*read)(void *, u8 *buf, int len);
|
||||
|
||||
int (*seek)(void *, u32 pos);
|
||||
|
||||
enum stream_node_state(*get_frame)(void *, struct stream_frame **);
|
||||
|
||||
int (*ioctl)(void *, int cmd, int arg);
|
||||
|
||||
void (*release)(void *);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define REGISTER_SOURCE_NODE_PLUG(plug) \
|
||||
const struct source_node_plug plug sec(.source_node_plug)
|
||||
|
||||
struct stream_frame *source_plug_get_output_frame(void *, int len);
|
||||
|
||||
void source_plug_put_output_frame(void *, struct stream_frame *);
|
||||
|
||||
void source_plug_free_frame(void *, struct stream_frame *);
|
||||
|
||||
u16 get_source_node_plug_uuid(void *source_node);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
. = ALIGN(4);
|
||||
stream_node_adapter_begin = .;
|
||||
KEEP(*(.stream_node_adapter))
|
||||
stream_node_adapter_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
source_node_plug_begin = .;
|
||||
KEEP(*(.source_node_plug))
|
||||
source_node_plug_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
decoder_plug_begin = .;
|
||||
KEEP(*(.decoder_plug))
|
||||
decoder_plug_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
encoder_plug_begin = .;
|
||||
KEEP(*(.encoder_plug))
|
||||
encoder_plug_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
audio_package_begin = .;
|
||||
KEEP(*(.audio_package_handler))
|
||||
audio_package_end = .;
|
||||
Reference in New Issue
Block a user