PulseAudio  14.0
mainloop-api.h
Go to the documentation of this file.
1 #ifndef foomainloopapihfoo
2 #define foomainloopapihfoo
3 
4 /***
5  This file is part of PulseAudio.
6 
7  Copyright 2004-2006 Lennart Poettering
8  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 
10  PulseAudio is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as
12  published by the Free Software Foundation; either version 2.1 of the
13  License, or (at your option) any later version.
14 
15  PulseAudio is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
22 ***/
23 
24 #include <sys/time.h>
25 
26 #include <pulse/cdecl.h>
27 #include <pulse/version.h>
28 
51 PA_C_DECL_BEGIN
52 
54 typedef struct pa_mainloop_api pa_mainloop_api;
55 
57 typedef enum pa_io_event_flags {
64 
66 typedef struct pa_io_event pa_io_event;
68 typedef void (*pa_io_event_cb_t)(pa_mainloop_api*ea, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata);
70 typedef void (*pa_io_event_destroy_cb_t)(pa_mainloop_api*a, pa_io_event *e, void *userdata);
71 
73 typedef struct pa_time_event pa_time_event;
75 typedef void (*pa_time_event_cb_t)(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata);
77 typedef void (*pa_time_event_destroy_cb_t)(pa_mainloop_api*a, pa_time_event *e, void *userdata);
78 
80 typedef struct pa_defer_event pa_defer_event;
82 typedef void (*pa_defer_event_cb_t)(pa_mainloop_api*a, pa_defer_event* e, void *userdata);
84 typedef void (*pa_defer_event_destroy_cb_t)(pa_mainloop_api*a, pa_defer_event *e, void *userdata);
85 
89  void *userdata;
90 
92  pa_io_event* (*io_new)(pa_mainloop_api*a, int fd, pa_io_event_flags_t events, pa_io_event_cb_t cb, void *userdata);
96  void (*io_free)(pa_io_event* e);
99 
101  pa_time_event* (*time_new)(pa_mainloop_api*a, const struct timeval *tv, pa_time_event_cb_t cb, void *userdata);
103  void (*time_restart)(pa_time_event* e, const struct timeval *tv);
108 
112  void (*defer_enable)(pa_defer_event* e, int b);
117 
119  void (*quit)(pa_mainloop_api*a, int retval);
120 };
121 
127 void pa_mainloop_api_once(pa_mainloop_api*m, void (*callback)(pa_mainloop_api*m, void *userdata), void *userdata);
128 
129 PA_C_DECL_END
130 
131 #endif
pa_defer_event_cb_t
void(* pa_defer_event_cb_t)(pa_mainloop_api *a, pa_defer_event *e, void *userdata)
A defer event callback prototype.
Definition: mainloop-api.h:82
pa_mainloop_api::userdata
void * userdata
A pointer to some private, arbitrary data of the main loop implementation.
Definition: mainloop-api.h:89
pa_time_event_destroy_cb_t
void(* pa_time_event_destroy_cb_t)(pa_mainloop_api *a, pa_time_event *e, void *userdata)
A time event destroy callback prototype.
Definition: mainloop-api.h:77
pa_defer_event
struct pa_defer_event pa_defer_event
An opaque deferred event source object.
Definition: mainloop-api.h:80
pa_mainloop_api_once
void pa_mainloop_api_once(pa_mainloop_api *m, void(*callback)(pa_mainloop_api *m, void *userdata), void *userdata)
Run the specified callback function once from the main loop using an anonymous defer event.
pa_mainloop_api
An abstract mainloop API vtable.
Definition: mainloop-api.h:87
pa_time_event_cb_t
void(* pa_time_event_cb_t)(pa_mainloop_api *a, pa_time_event *e, const struct timeval *tv, void *userdata)
A time event callback prototype.
Definition: mainloop-api.h:75
PA_IO_EVENT_ERROR
@ PA_IO_EVENT_ERROR
Error event.
Definition: mainloop-api.h:62
pa_mainloop_api::io_free
void(* io_free)(pa_io_event *e)
Free a IO event source object.
Definition: mainloop-api.h:96
pa_io_event
struct pa_io_event pa_io_event
An opaque IO event source object.
Definition: mainloop-api.h:66
pa_mainloop_api::time_restart
void(* time_restart)(pa_time_event *e, const struct timeval *tv)
Restart a running or expired timer event source with a new Unix time.
Definition: mainloop-api.h:103
pa_mainloop_api::io_enable
void(* io_enable)(pa_io_event *e, pa_io_event_flags_t events)
Enable or disable IO events on this object.
Definition: mainloop-api.h:94
PA_IO_EVENT_OUTPUT
@ PA_IO_EVENT_OUTPUT
Output event.
Definition: mainloop-api.h:60
pa_io_event_cb_t
void(* pa_io_event_cb_t)(pa_mainloop_api *ea, pa_io_event *e, int fd, pa_io_event_flags_t events, void *userdata)
An IO event callback prototype.
Definition: mainloop-api.h:68
pa_mainloop_api::time_set_destroy
void(* time_set_destroy)(pa_time_event *e, pa_time_event_destroy_cb_t cb)
Set a function that is called when the timer event source is destroyed.
Definition: mainloop-api.h:107
PA_IO_EVENT_HANGUP
@ PA_IO_EVENT_HANGUP
Hangup event.
Definition: mainloop-api.h:61
pa_defer_event_destroy_cb_t
void(* pa_defer_event_destroy_cb_t)(pa_mainloop_api *a, pa_defer_event *e, void *userdata)
A defer event destroy callback prototype.
Definition: mainloop-api.h:84
pa_mainloop_api::time_free
void(* time_free)(pa_time_event *e)
Free a deferred timer event source object.
Definition: mainloop-api.h:105
pa_io_event_flags
pa_io_event_flags
A bitmask for IO events.
Definition: mainloop-api.h:57
pa_io_event_destroy_cb_t
void(* pa_io_event_destroy_cb_t)(pa_mainloop_api *a, pa_io_event *e, void *userdata)
A IO event destroy callback prototype.
Definition: mainloop-api.h:70
pa_mainloop_api::defer_enable
void(* defer_enable)(pa_defer_event *e, int b)
Enable or disable a deferred event source temporarily.
Definition: mainloop-api.h:112
pa_time_event
struct pa_time_event pa_time_event
An opaque timer event source object.
Definition: mainloop-api.h:73
pa_mainloop_api::defer_free
void(* defer_free)(pa_defer_event *e)
Free a deferred event source object.
Definition: mainloop-api.h:114
pa_io_event_flags_t
enum pa_io_event_flags pa_io_event_flags_t
A bitmask for IO events.
pa_mainloop_api::io_set_destroy
void(* io_set_destroy)(pa_io_event *e, pa_io_event_destroy_cb_t cb)
Set a function that is called when the IO event source is destroyed.
Definition: mainloop-api.h:98
pa_mainloop_api::quit
void(* quit)(pa_mainloop_api *a, int retval)
Exit the main loop and return the specified retval.
Definition: mainloop-api.h:119
pa_mainloop_api::defer_set_destroy
void(* defer_set_destroy)(pa_defer_event *e, pa_defer_event_destroy_cb_t cb)
Set a function that is called when the deferred event source is destroyed.
Definition: mainloop-api.h:116
PA_IO_EVENT_NULL
@ PA_IO_EVENT_NULL
No event.
Definition: mainloop-api.h:58
PA_IO_EVENT_INPUT
@ PA_IO_EVENT_INPUT
Input event.
Definition: mainloop-api.h:59