mainloop-api.h

Go to the documentation of this file.
00001 #ifndef foomainloopapihfoo
00002 #define foomainloopapihfoo
00003 
00004 /* $Id: mainloop-api.h 1426 2007-02-13 15:35:19Z ossman $ */
00005 
00006 /***
00007   This file is part of PulseAudio.
00008 
00009   Copyright 2004-2006 Lennart Poettering
00010   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
00011 
00012   PulseAudio is free software; you can redistribute it and/or modify
00013   it under the terms of the GNU Lesser General Public License as
00014   published by the Free Software Foundation; either version 2.1 of the
00015   License, or (at your option) any later version.
00016 
00017   PulseAudio is distributed in the hope that it will be useful, but
00018   WITHOUT ANY WARRANTY; without even the implied warranty of
00019   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00020   Lesser General Public License for more details.
00021 
00022   You should have received a copy of the GNU Lesser General Public
00023   License along with PulseAudio; if not, write to the Free Software
00024   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025   USA.
00026 ***/
00027 
00028 #include <sys/time.h>
00029 #include <time.h>
00030 
00031 #include <pulse/cdecl.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

Generated on Tue Apr 24 02:06:15 2012 for PulseAudio by  doxygen 1.4.7