chiark / gitweb /
doxygen
[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
45long tracklength(const char *track, const char *path);
46/* compute the length of the track. @track@ is the UTF-8 name of the
47 * track, @path@ is the file system name (or 0 for tracks that don't
48 * exist in the filesystem). The return value should be a positive
49 * number of seconds, 0 for unknown or -1 if an error occurred. */
50
51/* collection interface *******************************************************/
52
53void scan(const char *module, const char *root);
54/* write a list of path names below @root@ to standard output. */
55
56int check(const char *module, const char *root, const char *path);
57/* Recheck a track, given its root and path name. Return 1 if it
58 * exists, 0 if it does not exist and -1 if an error occurred. */
59
60/* notification interface *****************************************************/
61
62void notify_play(const char *track,
63 const char *submitter);
64/* we're going to play @track@. It was submitted by @submitter@
65 * (might be a null pointer) */
66
67void notify_scratch(const char *track,
68 const char *submitter,
69 const char *scratcher,
70 int seconds);
71/* @scratcher@ scratched @track@ after @seconds@. It was submitted by
72 * @submitter@ (might be a null pointer) */
73
74void notify_not_scratched(const char *track,
75 const char *submitter);
76/* @track@ (submitted by @submitter@, which might be a null pointer)
77 * was not scratched. */
78
79void notify_queue(const char *track,
80 const char *submitter);
81/* @track@ was queued by @submitter@ */
82
83void notify_queue_remove(const char *track,
84 const char *remover);
85/* @track@ removed from the queue by @remover@ (never a null pointer) */
86
87void notify_queue_move(const char *track,
88 const char *mover);
89/* @track@ moved in the queue by @mover@ (never a null pointer) */
90
91void notify_pause(const char *track,
92 const char *pauser);
93/* TRACK was paused by PAUSER (might be a null pointer) */
94
95void notify_resume(const char *track,
96 const char *resumer);
97/* TRACK was resumed by PAUSER (might be a null pointer) */
98
99/* track playing **************************************************************/
100
101unsigned long play_get_type(const struct plugin *pl);
102/* Get the type word for this plugin */
103
104void *play_prefork(const struct plugin *pl,
105 const char *track);
106/* Call the prefork function for PL and return the user data */
107
108void play_track(const struct plugin *pl,
109 const char *const *parameters,
110 int nparameters,
111 const char *path,
112 const char *track);
113/* play a track. Called inside a fork. */
114
115void play_cleanup(const struct plugin *pl, void *data);
116/* Call the cleanup function for PL if necessary */
117
118int play_pause(const struct plugin *pl, long *playedp, void *data);
119/* Pause track. */
120
121void play_resume(const struct plugin *pl, void *data);
122/* Resume track. */
123
124#endif /* PLUGIN_H */
125
126/*
127Local Variables:
128c-basic-offset:2
129comment-column:40
130End:
131*/