chiark / gitweb /
automatically upgrade on startup if necessary
[disorder] / lib / plugin.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005, 2006 Richard Kettlewell
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 */
20
21#ifndef PLUGIN_H
22#define PLUGIN_H
23
24/* general ********************************************************************/
25
26struct plugin;
27
28typedef void *plugin_handle;
29typedef void function_t(void);
30
31const struct plugin *open_plugin(const char *name,
32 unsigned flags);
33#define PLUGIN_FATAL 0x0001 /* fatal() on error */
34/* Open a plugin. Returns a null pointer on error or a handle to it
35 * on success. */
36
37function_t *get_plugin_function(const struct plugin *handle,
38 const char *symbol);
39const void *get_plugin_object(const struct plugin *handle,
40 const char *symbol);
41/* Look up a function or an object in a plugin */
42
43/* track length computation ***************************************************/
44
62dc3748 45long tracklength(const char *plugin, const char *track, const char *path);
460b9539 46
47/* collection interface *******************************************************/
48
49void scan(const char *module, const char *root);
50/* write a list of path names below @root@ to standard output. */
51
52int check(const char *module, const char *root, const char *path);
53/* Recheck a track, given its root and path name. Return 1 if it
54 * exists, 0 if it does not exist and -1 if an error occurred. */
55
56/* notification interface *****************************************************/
57
58void notify_play(const char *track,
59 const char *submitter);
60/* we're going to play @track@. It was submitted by @submitter@
61 * (might be a null pointer) */
62
63void notify_scratch(const char *track,
64 const char *submitter,
65 const char *scratcher,
66 int seconds);
67/* @scratcher@ scratched @track@ after @seconds@. It was submitted by
68 * @submitter@ (might be a null pointer) */
69
70void notify_not_scratched(const char *track,
71 const char *submitter);
72/* @track@ (submitted by @submitter@, which might be a null pointer)
73 * was not scratched. */
74
75void notify_queue(const char *track,
76 const char *submitter);
77/* @track@ was queued by @submitter@ */
78
79void notify_queue_remove(const char *track,
80 const char *remover);
81/* @track@ removed from the queue by @remover@ (never a null pointer) */
82
83void notify_queue_move(const char *track,
84 const char *mover);
85/* @track@ moved in the queue by @mover@ (never a null pointer) */
86
87void notify_pause(const char *track,
88 const char *pauser);
89/* TRACK was paused by PAUSER (might be a null pointer) */
90
91void notify_resume(const char *track,
92 const char *resumer);
93/* TRACK was resumed by PAUSER (might be a null pointer) */
94
95/* track playing **************************************************************/
96
97unsigned long play_get_type(const struct plugin *pl);
98/* Get the type word for this plugin */
99
100void *play_prefork(const struct plugin *pl,
101 const char *track);
102/* Call the prefork function for PL and return the user data */
103
104void play_track(const struct plugin *pl,
105 const char *const *parameters,
106 int nparameters,
107 const char *path,
108 const char *track);
109/* play a track. Called inside a fork. */
110
111void play_cleanup(const struct plugin *pl, void *data);
112/* Call the cleanup function for PL if necessary */
113
114int play_pause(const struct plugin *pl, long *playedp, void *data);
115/* Pause track. */
116
117void play_resume(const struct plugin *pl, void *data);
118/* Resume track. */
119
120#endif /* PLUGIN_H */
121
122/*
123Local Variables:
124c-basic-offset:2
125comment-column:40
126End:
127*/