■ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, struct pa_sample_spec *ss, uint32_t *periods, snd_pcm_uframes_t *buffer_size)
https://i.cnblogs.com/posts/edit-done;postId=13058429
■ int pa_create_io_sources(snd_pcm_t *pcm_handle,
struct pa_mainloop_api* m,
void ***io_sources,
unsigned *n_io_sources,
void (*cb)(struct pa_mainloop_api*a, void *id, int fd, enum pa_mainloop_api_io_events events, void *userdata),
void *userdata)
通过pcm_handle获取pollfd,然后将pollfd注册到poll的pollfd, 当事件发生时,在mainloop中调用cb。
poll
https://www.cnblogs.com/renhl/p/13057425.html
■ void pa_free_io_sources(struct pa_mainloop_api* m, void **io_sources, unsigned n_io_sources)
将注册到poll的pollfd取消