|
PulseAudio
9.0
|
00001 #ifndef foomainloopapihfoo 00002 #define foomainloopapihfoo 00003 00004 /*** 00005 This file is part of PulseAudio. 00006 00007 Copyright 2004-2006 Lennart Poettering 00008 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB 00009 00010 PulseAudio is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as 00012 published by the Free Software Foundation; either version 2.1 of the 00013 License, or (at your option) any later version. 00014 00015 PulseAudio is distributed in the hope that it will be useful, but 00016 WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 00022 ***/ 00023 00024 #include <sys/time.h> 00025 00026 #include <pulse/cdecl.h> 00027 #include <pulse/version.h> 00028 00044 PA_C_DECL_BEGIN 00045 00047 typedef struct pa_mainloop_api pa_mainloop_api; 00048 00050 typedef enum pa_io_event_flags { 00051 PA_IO_EVENT_NULL = 0, 00052 PA_IO_EVENT_INPUT = 1, 00053 PA_IO_EVENT_OUTPUT = 2, 00054 PA_IO_EVENT_HANGUP = 4, 00055 PA_IO_EVENT_ERROR = 8 00056 } pa_io_event_flags_t; 00057 00059 typedef struct pa_io_event pa_io_event; 00061 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); 00063 typedef void (*pa_io_event_destroy_cb_t)(pa_mainloop_api*a, pa_io_event *e, void *userdata); 00064 00066 typedef struct pa_time_event pa_time_event; 00068 typedef void (*pa_time_event_cb_t)(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata); 00070 typedef void (*pa_time_event_destroy_cb_t)(pa_mainloop_api*a, pa_time_event *e, void *userdata); 00071 00073 typedef struct pa_defer_event pa_defer_event; 00075 typedef void (*pa_defer_event_cb_t)(pa_mainloop_api*a, pa_defer_event* e, void *userdata); 00077 typedef void (*pa_defer_event_destroy_cb_t)(pa_mainloop_api*a, pa_defer_event *e, void *userdata); 00078 00080 struct pa_mainloop_api { 00082 void *userdata; 00083 00085 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); 00087 void (*io_enable)(pa_io_event* e, pa_io_event_flags_t events); 00089 void (*io_free)(pa_io_event* e); 00091 void (*io_set_destroy)(pa_io_event *e, pa_io_event_destroy_cb_t cb); 00092 00094 pa_time_event* (*time_new)(pa_mainloop_api*a, const struct timeval *tv, pa_time_event_cb_t cb, void *userdata); 00096 void (*time_restart)(pa_time_event* e, const struct timeval *tv); 00098 void (*time_free)(pa_time_event* e); 00100 void (*time_set_destroy)(pa_time_event *e, pa_time_event_destroy_cb_t cb); 00101 00103 pa_defer_event* (*defer_new)(pa_mainloop_api*a, pa_defer_event_cb_t cb, void *userdata); 00105 void (*defer_enable)(pa_defer_event* e, int b); 00107 void (*defer_free)(pa_defer_event* e); 00109 void (*defer_set_destroy)(pa_defer_event *e, pa_defer_event_destroy_cb_t cb); 00110 00112 void (*quit)(pa_mainloop_api*a, int retval); 00113 }; 00114 00120 void pa_mainloop_api_once(pa_mainloop_api*m, void (*callback)(pa_mainloop_api*m, void *userdata), void *userdata); 00121 00122 PA_C_DECL_END 00123 00124 #endif