KT25-0812_82A-UART/include_lib/media/audio_stream.h

149 lines
3.3 KiB
C
Raw Normal View History

2025-08-12 10:09:23 +00:00
#ifndef AUDIO_STREAM_H
#define AUDIO_STREAM_H
#include "generic/includes.h"
#include "media/audio_base.h"
#define AUDIO_STREAM_IOCTRL_CMD_CHECK_ACTIVE (1)
struct audio_stream_entry;
struct audio_frame_copy;
struct audio_data_frame {
u8 channel;
u8 stop;
u8 coding_type;
u8 data_sync;
u32 sample_rate;
u16 offset; //数据偏移
u16 data_len;
s16 *data;
};
struct audio_stream {
struct list_head input_cp_head;
struct audio_data_frame output;
struct audio_stream_entry *entry;
void *priv;
void (*resume)(void *priv);
/*void (*suspend)(void *priv);*/
};
struct audio_stream_group {
struct audio_stream_entry *entry;
};
struct audio_stream_entry {
u8 pass_by;
u16 offset;
struct audio_stream *stream;
struct audio_stream_entry *input;
struct audio_stream_entry *output;
struct audio_stream_entry *sibling;
struct audio_stream_group *group;
struct audio_frame_copy *frame_copy;
int (*prob_handler)(struct audio_stream_entry *, struct audio_data_frame *in);
int (*data_handler)(struct audio_stream_entry *, struct audio_data_frame *in,
struct audio_data_frame *out);
void (*data_process_len)(struct audio_stream_entry *, int len);
void (*data_clear)(struct audio_stream_entry *);
int (*ioctrl)(struct audio_stream_entry *, int cmd, int *param);
};
struct audio_frame_copy {
struct list_head head;
struct audio_data_frame frame;
struct audio_stream_entry entry;
};
/*
* resume:
*/
struct audio_stream *audio_stream_open(void *priv, void (*resume)(void *priv));
void audio_stream_add_first(struct audio_stream *stream,
struct audio_stream_entry *entry);
void audio_stream_add_head(struct audio_stream *stream,
struct audio_stream_entry *entry);
void audio_stream_add_tail(struct audio_stream *stream,
struct audio_stream_entry *entry);
void audio_stream_add_entry(struct audio_stream_entry *input,
struct audio_stream_entry *output);
void audio_stream_add_list(struct audio_stream *stream,
struct audio_stream_entry *entry[], int num);
void audio_stream_del_entry(struct audio_stream_entry *entry);
void audio_stream_del_list(struct audio_stream_entry *entry[], int num);
void audio_stream_group_add_entry(struct audio_stream_group *group,
struct audio_stream_entry *entry);
void audio_stream_group_del_entry(struct audio_stream_group *group,
struct audio_stream_entry *entry);
int audio_stream_group_entry_num(struct audio_stream_group *group);
/*
*
*/
int audio_stream_run(struct audio_stream_entry *from, struct audio_data_frame *);
/*
*
*/
int audio_stream_resume(struct audio_stream_entry *entry);
void audio_stream_clear_from(struct audio_stream_entry *entry);
void audio_stream_clear(struct audio_stream *stream);
void audio_stream_clear_by_entry(struct audio_stream_entry *entry);
/*
* true
*/
int audio_stream_check_active_from(struct audio_stream_entry *entry);
void audio_stream_close(struct audio_stream *);
#endif