[5692] | 1 | //scheduler.h: |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012 |
---|
| 5 | * |
---|
| 6 | * This file is part of libroar a part of RoarAudio, |
---|
| 7 | * a cross-platform sound system for both, home and professional use. |
---|
| 8 | * See README for details. |
---|
| 9 | * |
---|
| 10 | * This file is free software; you can redistribute it and/or modify |
---|
| 11 | * it under the terms of the GNU General Public License version 3 |
---|
| 12 | * as published by the Free Software Foundation. |
---|
| 13 | * |
---|
| 14 | * libroar is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this software; see the file COPYING. If not, write to |
---|
| 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
| 23 | * |
---|
| 24 | * NOTE for everyone want's to change something and send patches: |
---|
| 25 | * read README and HACKING! There a addition information on |
---|
| 26 | * the license of this document you need to read before you send |
---|
| 27 | * any patches. |
---|
| 28 | * |
---|
| 29 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 30 | * or libpulse*: |
---|
| 31 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
| 32 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 33 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | #ifndef _LIBROARSCHEDULER_H_ |
---|
| 37 | #define _LIBROARSCHEDULER_H_ |
---|
| 38 | |
---|
| 39 | #include "libroar.h" |
---|
| 40 | |
---|
| 41 | enum roar_scheduler_type { |
---|
| 42 | ROAR_SCHEDULER_NONE = 0, |
---|
| 43 | ROAR_SCHEDULER_VIO, |
---|
| 44 | ROAR_SCHEDULER_TIMEOUT, |
---|
| 45 | ROAR_SCHEDULER_PLUGIN, |
---|
| 46 | ROAR_SCHEDULER_PLUGINCONTAINER, |
---|
| 47 | ROAR_SCHEDULER_CPI_LISTEN, |
---|
| 48 | ROAR_SCHEDULER_CPI_CLIENT, |
---|
[5698] | 49 | ROAR_SCHEDULER_CPI_SERVICE, // listen for CPI registrations. |
---|
| 50 | // for future use. |
---|
| 51 | ROAR_SCHEDULER_CONNECTION, |
---|
| 52 | ROAR_SCHEDULER_VSS |
---|
[5692] | 53 | }; |
---|
| 54 | |
---|
[5694] | 55 | enum roar_scheduler_strategy { |
---|
| 56 | ROAR_SCHEDULER_STRATEGY_DEFAULT = -1, |
---|
| 57 | ROAR_SCHEDULER_STRATEGY_SELECT = 1, |
---|
| 58 | ROAR_SCHEDULER_STRATEGY_WAIT, |
---|
| 59 | ROAR_SCHEDULER_STRATEGY_SELECTORWAIT, |
---|
| 60 | ROAR_SCHEDULER_STRATEGY_WAITORSELECT, |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | #define ROAR_SCHEDULER_FLAG_DEFAULT -1 |
---|
[5692] | 64 | #define ROAR_SCHEDULER_FLAG_NONE 0x0000 |
---|
| 65 | #define ROAR_SCHEDULER_FLAG_FREE 0x0001 |
---|
[5698] | 66 | #define ROAR_SCHEDULER_FLAG_STUB 0x0002 |
---|
[5692] | 67 | |
---|
| 68 | struct roar_scheduler_source { |
---|
| 69 | enum roar_scheduler_type type; |
---|
| 70 | int flags; |
---|
| 71 | struct roar_dl_lhandle * lhandle; |
---|
| 72 | struct roar_vio_calls * vio; |
---|
| 73 | int (*cb)(struct roar_scheduler_source * source, void * userdata, int eventsa); |
---|
| 74 | void * userdata; |
---|
| 75 | union { |
---|
| 76 | void * vp; // dummy. |
---|
| 77 | int eventsq; |
---|
| 78 | struct roar_vio_selecttv timeout; |
---|
| 79 | struct roar_plugincontainer * container; |
---|
| 80 | struct { |
---|
| 81 | int proto; |
---|
| 82 | const struct roar_dl_proto * impl; |
---|
| 83 | int client; |
---|
| 84 | struct roar_buffer *obuffer; |
---|
| 85 | void * userdata; |
---|
| 86 | const struct roar_keyval * protopara; |
---|
| 87 | ssize_t protoparalen; |
---|
| 88 | } cpi; |
---|
[5698] | 89 | struct roar_connection * con; |
---|
| 90 | roar_vs_t * vss; |
---|
[5692] | 91 | } handle; |
---|
| 92 | }; |
---|
| 93 | |
---|
| 94 | struct roar_scheduler; |
---|
| 95 | |
---|
[5694] | 96 | struct roar_scheduler * roar_scheduler_new(int flags, enum roar_scheduler_strategy strategy); |
---|
[5692] | 97 | int roar_scheduler_ref(struct roar_scheduler * sched); |
---|
| 98 | int roar_scheduler_unref(struct roar_scheduler * sched); |
---|
| 99 | |
---|
| 100 | int roar_scheduler_iterate(struct roar_scheduler * sched); |
---|
| 101 | int roar_scheduler_run(struct roar_scheduler * sched); |
---|
| 102 | |
---|
| 103 | int roar_scheduler_source_add(struct roar_scheduler * sched, |
---|
| 104 | struct roar_scheduler_source * source); |
---|
| 105 | int roar_scheduler_source_del(struct roar_scheduler * sched, |
---|
| 106 | struct roar_scheduler_source * source); |
---|
| 107 | |
---|
| 108 | #endif |
---|
| 109 | |
---|
| 110 | //ll |
---|