PulseAudio 0.9.22-5.mga1
|
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, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 USA. 00024 ***/ 00025 00026 #include <sys/time.h> 00027 #include <time.h> 00028 00029 #include <pulse/cdecl.h> 00030 #include <pulse/sample.h> 00031 #include <pulse/version.h> 00032 00048 PA_C_DECL_BEGIN 00049 00051 typedef struct pa_mainloop_api pa_mainloop_api; 00052 00054 typedef enum pa_io_event_flags { 00055 PA_IO_EVENT_NULL = 0, 00056 PA_IO_EVENT_INPUT = 1, 00057 PA_IO_EVENT_OUTPUT = 2, 00058 PA_IO_EVENT_HANGUP = 4, 00059 PA_IO_EVENT_ERROR = 8 00060 } pa_io_event_flags_t; 00061 00063 typedef struct pa_io_event pa_io_event; 00065 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); 00067 typedef void (*pa_io_event_destroy_cb_t)(pa_mainloop_api*a, pa_io_event *e, void *userdata); 00068 00070 typedef struct pa_time_event pa_time_event; 00072 typedef void (*pa_time_event_cb_t)(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata); 00074 typedef void (*pa_time_event_destroy_cb_t)(pa_mainloop_api*a, pa_time_event *e, void *userdata); 00075 00077 typedef struct pa_defer_event pa_defer_event; 00079 typedef void (*pa_defer_event_cb_t)(pa_mainloop_api*a, pa_defer_event* e, void *userdata); 00081 typedef void (*pa_defer_event_destroy_cb_t)(pa_mainloop_api*a, pa_defer_event *e, void *userdata); 00082 00084 struct pa_mainloop_api { 00086 void *userdata; 00087 00089 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); 00091 void (*io_enable)(pa_io_event* e, pa_io_event_flags_t events); 00093 void (*io_free)(pa_io_event* e); 00095 void (*io_set_destroy)(pa_io_event *e, pa_io_event_destroy_cb_t cb); 00096 00098 pa_time_event* (*time_new)(pa_mainloop_api*a, const struct timeval *tv, pa_time_event_cb_t cb, void *userdata); 00100 void (*time_restart)(pa_time_event* e, const struct timeval *tv); 00102 void (*time_free)(pa_time_event* e); 00104 void (*time_set_destroy)(pa_time_event *e, pa_time_event_destroy_cb_t cb); 00105 00107 pa_defer_event* (*defer_new)(pa_mainloop_api*a, pa_defer_event_cb_t cb, void *userdata); 00109 void (*defer_enable)(pa_defer_event* e, int b); 00111 void (*defer_free)(pa_defer_event* e); 00113 void (*defer_set_destroy)(pa_defer_event *e, pa_defer_event_destroy_cb_t cb); 00114 00116 void (*quit)(pa_mainloop_api*a, int retval); 00117 }; 00118 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