Lines Matching refs:fdl
332 struct pa_alsa_fdlist *fdl = userdata; in io_cb() local
338 pa_assert(fdl); in io_cb()
339 pa_assert(fdl->mixer || fdl->hctl); in io_cb()
340 pa_assert(fdl->fds); in io_cb()
341 pa_assert(fdl->work_fds); in io_cb()
343 if (fdl->polled) in io_cb()
346 fdl->polled = true; in io_cb()
348 memcpy(fdl->work_fds, fdl->fds, sizeof(struct pollfd) * fdl->num_fds); in io_cb()
350 for (i = 0; i < fdl->num_fds; i++) { in io_cb()
351 if (e == fdl->ios[i]) { in io_cb()
353 fdl->work_fds[i].revents |= POLLIN; in io_cb()
355 fdl->work_fds[i].revents |= POLLOUT; in io_cb()
357 fdl->work_fds[i].revents |= POLLERR; in io_cb()
359 fdl->work_fds[i].revents |= POLLHUP; in io_cb()
364 pa_assert(i != fdl->num_fds); in io_cb()
366 if (fdl->hctl) in io_cb()
367 err = snd_hctl_poll_descriptors_revents(fdl->hctl, fdl->work_fds, fdl->num_fds, &revents); in io_cb()
369 err = snd_mixer_poll_descriptors_revents(fdl->mixer, fdl->work_fds, fdl->num_fds, &revents); in io_cb()
376 a->defer_enable(fdl->defer, 1); in io_cb()
379 if (fdl->hctl) in io_cb()
380 snd_hctl_handle_events(fdl->hctl); in io_cb()
382 snd_mixer_handle_events(fdl->mixer); in io_cb()
387 struct pa_alsa_fdlist *fdl = userdata; in defer_cb() local
393 pa_assert(fdl); in defer_cb()
394 pa_assert(fdl->mixer || fdl->hctl); in defer_cb()
396 a->defer_enable(fdl->defer, 0); in defer_cb()
398 if (fdl->hctl) in defer_cb()
399 n = snd_hctl_poll_descriptors_count(fdl->hctl); in defer_cb()
401 n = snd_mixer_poll_descriptors_count(fdl->mixer); in defer_cb()
413 if (num_fds != fdl->num_fds) { in defer_cb()
414 if (fdl->fds) in defer_cb()
415 pa_xfree(fdl->fds); in defer_cb()
416 if (fdl->work_fds) in defer_cb()
417 pa_xfree(fdl->work_fds); in defer_cb()
418 fdl->fds = pa_xnew0(struct pollfd, num_fds); in defer_cb()
419 fdl->work_fds = pa_xnew(struct pollfd, num_fds); in defer_cb()
422 memset(fdl->work_fds, 0, sizeof(struct pollfd) * num_fds); in defer_cb()
424 if (fdl->hctl) in defer_cb()
425 err = snd_hctl_poll_descriptors(fdl->hctl, fdl->work_fds, num_fds); in defer_cb()
427 err = snd_mixer_poll_descriptors(fdl->mixer, fdl->work_fds, num_fds); in defer_cb()
434 fdl->polled = false; in defer_cb()
436 if (memcmp(fdl->fds, fdl->work_fds, sizeof(struct pollfd) * num_fds) == 0) in defer_cb()
439 if (fdl->ios) { in defer_cb()
440 for (i = 0; i < fdl->num_fds; i++) in defer_cb()
441 a->io_free(fdl->ios[i]); in defer_cb()
443 if (num_fds != fdl->num_fds) { in defer_cb()
444 pa_xfree(fdl->ios); in defer_cb()
445 fdl->ios = NULL; in defer_cb()
449 if (!fdl->ios) in defer_cb()
450 fdl->ios = pa_xnew(pa_io_event*, num_fds); in defer_cb()
453 temp = fdl->work_fds; in defer_cb()
454 fdl->work_fds = fdl->fds; in defer_cb()
455 fdl->fds = temp; in defer_cb()
457 fdl->num_fds = num_fds; in defer_cb()
460 fdl->ios[i] = a->io_new(a, fdl->fds[i].fd, in defer_cb()
461 ((fdl->fds[i].events & POLLIN) ? PA_IO_EVENT_INPUT : 0) | in defer_cb()
462 ((fdl->fds[i].events & POLLOUT) ? PA_IO_EVENT_OUTPUT : 0), in defer_cb()
463 io_cb, fdl); in defer_cb()
467 struct pa_alsa_fdlist *fdl; in pa_alsa_fdlist_new() local
469 fdl = pa_xnew0(struct pa_alsa_fdlist, 1); in pa_alsa_fdlist_new()
471 return fdl; in pa_alsa_fdlist_new()
474 void pa_alsa_fdlist_free(struct pa_alsa_fdlist *fdl) { in pa_alsa_fdlist_free() argument
475 pa_assert(fdl); in pa_alsa_fdlist_free()
477 if (fdl->defer) { in pa_alsa_fdlist_free()
478 pa_assert(fdl->m); in pa_alsa_fdlist_free()
479 fdl->m->defer_free(fdl->defer); in pa_alsa_fdlist_free()
482 if (fdl->ios) { in pa_alsa_fdlist_free()
484 pa_assert(fdl->m); in pa_alsa_fdlist_free()
485 for (i = 0; i < fdl->num_fds; i++) in pa_alsa_fdlist_free()
486 fdl->m->io_free(fdl->ios[i]); in pa_alsa_fdlist_free()
487 pa_xfree(fdl->ios); in pa_alsa_fdlist_free()
490 if (fdl->fds) in pa_alsa_fdlist_free()
491 pa_xfree(fdl->fds); in pa_alsa_fdlist_free()
492 if (fdl->work_fds) in pa_alsa_fdlist_free()
493 pa_xfree(fdl->work_fds); in pa_alsa_fdlist_free()
495 pa_xfree(fdl); in pa_alsa_fdlist_free()
499 int pa_alsa_fdlist_set_handle(struct pa_alsa_fdlist *fdl, snd_mixer_t *mixer_handle, snd_hctl_t *hc… in pa_alsa_fdlist_set_handle() argument
500 pa_assert(fdl); in pa_alsa_fdlist_set_handle()
504 pa_assert(!fdl->m); in pa_alsa_fdlist_set_handle()
506 fdl->hctl = hctl_handle; in pa_alsa_fdlist_set_handle()
507 fdl->mixer = mixer_handle; in pa_alsa_fdlist_set_handle()
508 fdl->m = m; in pa_alsa_fdlist_set_handle()
509 fdl->defer = m->defer_new(m, defer_cb, fdl); in pa_alsa_fdlist_set_handle()