8528
|
1 /* XMMS - Cross-platform multimedia player
|
|
2 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
|
|
3 *
|
|
4 * Redistribution and use in source and binary forms, with or without
|
|
5 * modification, are permitted provided that the following conditions are
|
|
6 * met: 1. Redistributions of source code must retain the above copyright
|
|
7 * notice, this list of conditions and the following disclaimer. 2.
|
|
8 * Redistributions in binary form must reproduce the above copyright notice,
|
|
9 * this list of conditions and the following disclaimer in the documentation
|
|
10 * and/or other materials provided with the distribution.
|
|
11 *
|
|
12 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
13 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
15 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
16 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
17 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
18 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
19 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
20 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
21 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
22 * SUCH DAMAGE.
|
|
23 */
|
|
24 #ifndef PLUGIN_H
|
|
25 #define PLUGIN_H
|
|
26
|
|
27 typedef enum
|
|
28 {
|
|
29 FMT_U8, FMT_S8, FMT_U16_LE, FMT_U16_BE, FMT_U16_NE, FMT_S16_LE, FMT_S16_BE, FMT_S16_NE
|
|
30 }
|
|
31 AFormat;
|
|
32
|
|
33 typedef struct
|
|
34 {
|
|
35 void *handle; /* Filled in by xmms */
|
|
36 char *filename; /* Filled in by xmms */
|
|
37 char *description; /* The description that is shown in the preferences box */
|
|
38 void (*init) (void);
|
|
39 void (*about) (void); /* Show the about box */
|
|
40 void (*configure) (void); /* Show the configuration dialog */
|
|
41 void (*get_volume) (int *l, int *r);
|
|
42 void (*set_volume) (int l, int r); /* Set the volume */
|
|
43 int (*open_audio) (AFormat fmt, int rate, int nch); /* Open the device, if the device can't handle the given
|
|
44 parameters the plugin is responsible for downmixing
|
|
45 the data to the right format before outputting it */
|
|
46 void (*write_audio) (void *ptr, int length); /* The input plugin calls this to write data to the output
|
|
47 buffer */
|
|
48 void (*close_audio) (void); /* No comment... */
|
|
49 void (*flush) (int time); /* Flush the buffer and set the plugins internal timers to time */
|
|
50 void (*pause) (short paused); /* Pause or unpause the output */
|
|
51 int (*buffer_free) (void); /* Return the amount of data that can be written to the buffer,
|
|
52 two calls to this without a call to write_audio should make
|
|
53 the plugin output audio directly */
|
|
54 int (*buffer_playing) (void); /* Returns TRUE if the plugin currently is playing some audio,
|
|
55 otherwise return FALSE */
|
|
56 int (*output_time) (void); /* Return the current playing time */
|
|
57 int (*written_time) (void); /* Return the length of all the data that has been written to
|
|
58 the buffer */
|
|
59 }
|
|
60 OutputPlugin;
|
|
61
|
|
62 typedef struct
|
|
63 {
|
|
64 void *handle; /* Filled in by xmms */
|
|
65 char *filename; /* Filled in by xmms */
|
|
66 char *description; /* The description that is shown in the preferences box */
|
|
67 void (*init) (void); /* Called when the plugin is loaded */
|
|
68 void (*cleanup) (void); /* Called when the plugin is unloaded */
|
|
69 void (*about) (void); /* Show the about box */
|
|
70 void (*configure) (void); /* Show the configure box */
|
|
71 int (*mod_samples) (void *data, int length, AFormat fmt, int srate, int nch); /* Modify samples */
|
|
72 void (*query_format) (AFormat *fmt,int *rate, int *nch);
|
|
73 }
|
|
74 EffectPlugin;
|
|
75
|
|
76 typedef enum
|
|
77 {
|
|
78 INPUT_VIS_ANALYZER, INPUT_VIS_SCOPE, INPUT_VIS_VU, INPUT_VIS_OFF
|
|
79 }
|
|
80 InputVisType;
|
|
81
|
|
82 typedef struct
|
|
83 {
|
|
84 void *handle; /* Filled in by xmms */
|
|
85 char *filename; /* Filled in by xmms */
|
|
86 char *description; /* The description that is shown in the preferences box */
|
|
87 void (*init) (void); /* Called when the plugin is loaded */
|
|
88 void (*about) (void); /* Show the about box */
|
|
89 void (*configure) (void);
|
|
90 int (*is_our_file) (char *filename); /* Return 1 if the plugin can handle the file */
|
|
91 void *(*scan_dir) (char *dirname); /* Look in Input/cdaudio/cdaudio.c to see how */
|
|
92 /* to use this */
|
|
93 void (*play_file) (char *filename); /* Guess what... */
|
|
94 void (*stop) (void); /* Tricky one */
|
|
95 void (*pause) (short paused); /* Pause or unpause */
|
|
96 void (*seek) (int time); /* Seek to the specified time */
|
|
97 void (*set_eq) (int on, float preamp, float *bands); /* Set the equalizer, most plugins won't be able to do this */
|
|
98 int (*get_time) (void); /* Get the time, usually returns the output plugins output time */
|
|
99 void (*get_volume) (int *l, int *r); /* Input-plugin specific volume functions, just provide a NULL if */
|
|
100 void (*set_volume) (int l, int r); /* you want the output plugin to handle it */
|
|
101 void (*cleanup) (void); /* Called when xmms exit */
|
|
102 InputVisType (*get_vis_type) (void); /* OBSOLETE, DO NOT USE! */
|
|
103 void (*add_vis_pcm) (int time, AFormat fmt, int nch, int length, void *ptr); /* Send data to the visualization plugins
|
|
104 Preferably 512 samples/block */
|
|
105 void (*set_info) (char *title, int length, int rate, int freq, int nch); /* Fill in the stuff that is shown in the player window
|
|
106 set length to -1 if it's unknown. Filled in by xmms */
|
|
107 void (*set_info_text) (char *text); /* Show some text in the song title box in the main window,
|
|
108 call it with NULL as argument to reset it to the song title.
|
|
109 Filled in by xmms */
|
|
110 void (*get_song_info) (char *filename, char **title, int *length); /* Function to grab the title string */
|
|
111 void (*file_info_box) (char *filename); /* Bring up an info window for the filename passed in */
|
|
112 OutputPlugin *output; /* Handle to the current output plugin. Filled in by xmms */
|
|
113 }
|
|
114 InputPlugin;
|
|
115
|
|
116 /* So that input plugins can get the title formatting information */
|
|
117 char *xmms_get_gentitle_format(void);
|
|
118
|
|
119 /* So that output plugins can communicate with effect plugins */
|
|
120 EffectPlugin *get_current_effect_plugin(void);
|
|
121 int effects_enabled(void);
|
|
122
|
|
123 typedef struct
|
|
124 {
|
|
125 void *handle; /* Filled in by xmms */
|
|
126 char *filename; /* Filled in by xmms */
|
|
127 int xmms_session; /* The session ID for attaching to the control socket */
|
|
128 char *description; /* The description that is shown in the preferences box */
|
|
129 void (*init) (void); /* Called when the plugin is enabled */
|
|
130 void (*about) (void); /* Show the about box */
|
|
131 void (*configure) (void);
|
|
132 void (*cleanup) (void); /* Called when the plugin is disabled or when xmms exits */
|
|
133 }
|
|
134 GeneralPlugin;
|
|
135
|
|
136 typedef struct _VisPlugin
|
|
137 {
|
|
138 void *handle; /* Filled in by xmms */
|
|
139 char *filename; /* Filled in by xmms */
|
|
140 int xmms_session; /* The session ID for attaching to the control socket */
|
|
141 char *description; /* The description that is shown in the preferences box */
|
|
142 int num_pcm_chs_wanted; /* Numbers of PCM channels wanted in the call to render_pcm */
|
|
143 int num_freq_chs_wanted; /* Numbers of freq channels wanted in the call to render_freq */
|
|
144 void (*init)(void); /* Called when the plugin is enabled */
|
|
145 void (*cleanup)(void); /* Called when the plugin is disabled */
|
|
146 void (*about)(void); /* Show the about box */
|
|
147 void (*configure)(void); /* Show the configure box */
|
|
148 void (*disable_plugin)(struct _VisPlugin *); /* Call this with a pointer to your plugin to disable the plugin */
|
|
149 void (*playback_start)(void); /* Called when playback starts */
|
|
150 void (*playback_stop)(void); /* Called when playback stops */
|
|
151 void (*render_pcm)(short pcm_data[2][512]); /* Render the PCM data, don't do anything time consuming in here */
|
|
152 void (*render_freq)(short freq_data[2][256]); /* Render the freq data, don't do anything time consuming in here */
|
|
153 } VisPlugin;
|
|
154
|
|
155 #endif
|