mainloop-api.h

Go to the documentation of this file.
00001 #ifndef foomainloopapihfoo
00002 #define foomainloopapihfoo
00003 
00004 /* $Id: mainloop-api.h 1100 2006-07-18 18:51:35Z lennart $ */
00005 
00006 /***
00007   This file is part of PulseAudio.
00008  
00009   PulseAudio is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU Lesser General Public License as
00011   published by the Free Software Foundation; either version 2.1 of the
00012   License, or (at your option) any later version.
00013  
00014   PulseAudio is distributed in the hope that it will be useful, but
00015   WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017   Lesser General Public License for more details.
00018  
00019   You should have received a copy of the GNU Lesser General Public
00020   License along with PulseAudio; if not, write to the Free Software
00021   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022   USA.
00023 ***/
00024 
00025 #include <sys/time.h>
00026 #include <time.h>
00027 
00028 #include <pulse/cdecl.h>
00029 
00045 PA_C_DECL_BEGIN
00046 
00048 typedef struct pa_mainloop_api pa_mainloop_api;
00049 
00051 typedef enum pa_io_event_flags {
00052     PA_IO_EVENT_NULL = 0,     
00053     PA_IO_EVENT_INPUT = 1,    
00054     PA_IO_EVENT_OUTPUT = 2,   
00055     PA_IO_EVENT_HANGUP = 4,   
00056     PA_IO_EVENT_ERROR = 8     
00057 } pa_io_event_flags_t;
00058 
00060 typedef struct pa_io_event pa_io_event;
00062 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);
00064 typedef void (*pa_io_event_destroy_cb_t)(pa_mainloop_api*a, pa_io_event *e, void *userdata);
00065 
00067 typedef struct pa_time_event pa_time_event;
00069 typedef void (*pa_time_event_cb_t)(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata);
00071 typedef void (*pa_time_event_destroy_cb_t)(pa_mainloop_api*a, pa_time_event *e, void *userdata);
00072 
00074 typedef struct pa_defer_event pa_defer_event;
00076 typedef void (*pa_defer_event_cb_t)(pa_mainloop_api*a, pa_defer_event* e, void *userdata);
00078 typedef void (*pa_defer_event_destroy_cb_t)(pa_mainloop_api*a, pa_defer_event *e, void *userdata);
00079 
00081 struct pa_mainloop_api  {
00083     void *userdata;
00084 
00086     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);
00088     void (*io_enable)(pa_io_event* e, pa_io_event_flags_t events);
00090     void (*io_free)(pa_io_event* e);
00092     void (*io_set_destroy)(pa_io_event *e, pa_io_event_destroy_cb_t cb);
00093 
00095     pa_time_event* (*time_new)(pa_mainloop_api*a, const struct timeval *tv, pa_time_event_cb_t cb, void *userdata);
00097     void (*time_restart)(pa_time_event* e, const struct timeval *tv);
00099     void (*time_free)(pa_time_event* e);
00101     void (*time_set_destroy)(pa_time_event *e, pa_time_event_destroy_cb_t cb);
00102 
00104     pa_defer_event* (*defer_new)(pa_mainloop_api*a, pa_defer_event_cb_t cb, void *userdata);
00106     void (*defer_enable)(pa_defer_event* e, int b);
00108     void (*defer_free)(pa_defer_event* e);
00110     void (*defer_set_destroy)(pa_defer_event *e, pa_defer_event_destroy_cb_t cb);
00111 
00113     void (*quit)(pa_mainloop_api*a, int retval);
00114 };
00115 
00117 void pa_mainloop_api_once(pa_mainloop_api*m, void (*callback)(pa_mainloop_api*m, void *userdata), void *userdata);
00118 
00119 PA_C_DECL_END
00120 
00121 #endif

Generated on Wed May 30 19:36:31 2007 for PulseAudio by  doxygen 1.5.1