mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
extend rtpoll API to allow registration of arbitray functions to be executed in the event loop. Add priority system for specifying the order of these functions.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1816 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
cf3e9da9dd
commit
ef83a19525
11 changed files with 139 additions and 61 deletions
|
|
@ -322,7 +322,7 @@ static int build_pollfd(struct userdata *u) {
|
|||
if (u->alsa_rtpoll_item)
|
||||
pa_rtpoll_item_free(u->alsa_rtpoll_item);
|
||||
|
||||
u->alsa_rtpoll_item = pa_rtpoll_item_new(u->rtpoll, n);
|
||||
u->alsa_rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, n);
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, NULL);
|
||||
|
||||
if ((err = snd_pcm_poll_descriptors(u->pcm_handle, pollfd, n)) < 0) {
|
||||
|
|
@ -745,7 +745,7 @@ int pa__init(pa_module*m) {
|
|||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
u->alsa_rtpoll_item = NULL;
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
|
||||
snd_config_update_free_global();
|
||||
if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ static int build_pollfd(struct userdata *u) {
|
|||
if (u->alsa_rtpoll_item)
|
||||
pa_rtpoll_item_free(u->alsa_rtpoll_item);
|
||||
|
||||
u->alsa_rtpoll_item = pa_rtpoll_item_new(u->rtpoll, n);
|
||||
u->alsa_rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, n);
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, NULL);
|
||||
|
||||
if ((err = snd_pcm_poll_descriptors(u->pcm_handle, pollfd, n)) < 0) {
|
||||
|
|
@ -726,7 +726,7 @@ int pa__init(pa_module*m) {
|
|||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
u->alsa_rtpoll_item = NULL;
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
|
||||
snd_config_update_free_global();
|
||||
if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) {
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ static void sink_input_attach_cb(pa_sink_input *i) {
|
|||
pa_assert(o);
|
||||
|
||||
pa_assert(!o->rtpoll_item);
|
||||
o->rtpoll_item = pa_rtpoll_item_new_asyncmsgq(i->sink->rtpoll, o->asyncmsgq);
|
||||
o->rtpoll_item = pa_rtpoll_item_new_asyncmsgq(i->sink->rtpoll, PA_RTPOLL_NORMAL, o->asyncmsgq);
|
||||
}
|
||||
|
||||
/* Called from I/O thread context */
|
||||
|
|
@ -721,7 +721,7 @@ static int update_master(struct userdata *u, struct output *o) {
|
|||
pa_assert(!u->rtpoll);
|
||||
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
|
||||
pa_sink_set_rtpoll(u->sink, u->rtpoll);
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ int pa__init(pa_module*m) {
|
|||
m->userdata = u;
|
||||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
|
||||
if (!(u->sink = pa_sink_new(m->core, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
|
||||
pa_log("Failed to create sink.");
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ static int unsuspend(struct userdata *u) {
|
|||
|
||||
pa_assert(!u->rtpoll_item);
|
||||
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, 1);
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
|
||||
pollfd->fd = u->fd;
|
||||
pollfd->events = 0;
|
||||
|
|
@ -1167,8 +1167,8 @@ int pa__init(pa_module*m) {
|
|||
u->use_mmap = use_mmap;
|
||||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, 1);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
|
||||
pollfd->fd = fd;
|
||||
pollfd->events = 0;
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ int pa__init(pa_module*m) {
|
|||
pa_memchunk_reset(&u->memchunk);
|
||||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
|
||||
u->filename = pa_xstrdup(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_set_description(u->sink, t = pa_sprintf_malloc("Unix FIFO sink '%s'", u->filename));
|
||||
pa_xfree(t);
|
||||
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, 1);
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
|
||||
pollfd->fd = u->fd;
|
||||
pollfd->events = pollfd->revents = 0;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ int pa__init(pa_module*m) {
|
|||
pa_memchunk_reset(&u->memchunk);
|
||||
pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, u->thread_mq.inq);
|
||||
pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
|
||||
|
||||
u->filename = pa_xstrdup(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ int pa__init(pa_module*m) {
|
|||
pa_source_set_description(u->source, t = pa_sprintf_malloc("Unix FIFO source '%s'", u->filename));
|
||||
pa_xfree(t);
|
||||
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, 1);
|
||||
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
|
||||
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
|
||||
pollfd->fd = u->fd;
|
||||
pollfd->events = pollfd->revents = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue