annotate libmpdemux/demux_xmms_plugin.h @ 23757:6d1e09675a4f

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