Debian Codegraph @

rplayd/spool.h

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 /* $Id: spool.h,v 1.3 1999/03/10 07:58:04 boyns Exp $ */
2
3 /*
4 * Copyright (C) 1993-99 Mark R. Boyns <[email protected]>
5 *
6 * This file is part of rplay.
7 *
8 * rplay is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * rplay is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with rplay; see the file COPYING. If not, write to the
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24
25
26 #ifndef _spool_h
27 #define _spool_h
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32 #include <sys/types.h>
33 #include "rplay.h"
34 #include "sound.h"
35 #include "buffer.h"
36
37 #define SPOOL_NULL 0 /* nothing */
38 #define SPOOL_PLAY 1 /* Spool entry is playing. */
39 #define SPOOL_PAUSE 2 /* Spool entry is plaused. */
40 #define SPOOL_WAIT 3 /* Spool entry is waiting for more data. */
41 #define SPOOL_NEXT 4 /* Current sound is done. */
42 #define SPOOL_SKIP 5 /* Current sound has been skipped. */
43
44 #define SPOOL_MIN_ID 1
45 #define SPOOL_MAX_ID 999
46
47 typedef struct _spool
48 {
49 struct _spool *next;
50 struct _spool *prev;
51 int id; /* unique spool id */
52 int state; /* state of spool entry */
53 time_t time; /* time since data was last read */
54 int curr_sound; /* current sound */
55 int curr_count; /* # times left to play curr_sound */
56 int list_count; /* # times left to play the sound list */
57 SOUND *sound[SOUND_LIST_SIZE]; /* list of sounds */
58 SINDEX *si; /* Index of the current sound. */
59 BUFFER *curr_buffer; /* Buffer of audio that's currently playing. */
60 BUFFER *next_buffer; /* Buffer of audio that will be played next. */
61 int offset; /* Position in the current audio file. */
62 unsigned char *ptr; /* Pointer to the current sample. */
63 unsigned char *ptr_end; /* The end of the current buffer. */
64 RPLAY *rp; /* RPLAY packet received */
65 RPLAY_ATTRS *curr_attrs; /* current rplay attributes */
66 struct sockaddr_in sin; /* client's address */
67 unsigned long sample_rate; /* sample rate of curr_sound */
68 double sample_index; /* Must use float to avoid rounding errors. */
69 double sample_factor; /* Factor to increase the sample index by. */
70 double oversample[2]; /* The current sample value when oversampling */
71 double oversample_inc[2]; /* The delta to increase the oversample with */
72 int (*to_native) (); /* Convert curr_sound samples to native. */
73 int skip_count; /* skip curr_sound */
74 int auto_pause; /* pause before play */
75 int notify_position; /* notify clients needing position information */
76 }
77 SPOOL;
78
79 extern SPOOL *spool;
80 extern int spool_size;
81 extern int spool_nplaying;
82 extern int spool_npaused;
83 extern int spool_prio;
84 extern int spool_needs_update;
85
86 #ifdef __STDC__
87 extern void spool_init ();
88 extern SPOOL *spool_create ();
89 extern void spool_destroy (SPOOL *sp);
90 extern int spool_match (RPLAY *match, void (*action) (SPOOL *), struct sockaddr_in sin);
91 extern SPOOL *spool_next (int priority);
92 extern void spool_ready (SOUND *sound);
93 extern void spool_remove (SOUND *sound);
94 extern BUFFER *spool_list_create ();
95 extern void spool_reset (SPOOL *sp);
96 extern void spool_setprio (void);
97 extern int spool_id (void);
98 extern void spool_stop (SPOOL *sp);
99 extern void spool_pause (SPOOL *sp);
100 extern void spool_continue (SPOOL *sp);
101 extern void spool_done (SPOOL *sp);
102 extern void spool_flow_pause (SPOOL *sp);
103 extern void spool_flow_continue (SPOOL *sp);
104 extern int spool_flow_insert (SPOOL *sp, BUFFER *b);
105 extern void spool_skip (SPOOL *sp, int count);
106 extern void spool_play (SPOOL *sp);
107 extern void spool_update (void);
108 extern int spool_process (char *buf, int nbytes);
109 extern SPOOL *spool_find (int id);
110 extern void spool_cleanup (void);
111 extern void spool_set_count (SPOOL *sp, int count);
112 extern void spool_set_list_count (SPOOL *sp, int count);
113 extern void spool_set_priority (SPOOL *sp, int priority);
114 extern void spool_set_sample_rate (SPOOL *sp, int sample_rate);
115 extern void spool_set_volume (SPOOL *sp, int volume);
116 extern void spool_set_client_data (SPOOL *sp, char *client_data);
117 extern SPOOL *spool_find_pid (int pid);
118 #else
119 extern void spool_init ();
120 extern SPOOL *spool_create ();
121 extern void spool_destroy ( /* SPOOL *sp */ );
122 extern int spool_match ( /* RPLAY *match, void (*action)(SPOOL *), struct sockaddr_in sin */ );
123 extern SPOOL *spool_next ( /* int priority */ );
124 extern void spool_ready ( /* SOUND *sound */ );
125 extern void spool_remove ( /* SOUND *sound */ );
126 extern BUFFER *spool_list_create ();
127 extern void spool_reset ( /* SPOOL *sp */ );
128 extern void spool_setprio ();
129 extern int spool_id ();
130 extern void spool_stop ( /* SPOOL *sp */ );
131 extern void spool_pause ( /* SPOOL *sp */ );
132 extern void spool_continue ( /* SPOOL *sp */ );
133 extern void spool_done ( /* SPOOL *sp */ );
134 extern void spool_flow_pause ( /* SPOOL *sp */ );
135 extern void spool_flow_continue ( /* SPOOL *sp */ );
136 extern int spool_flow_insert ( /* SPOOL *sp, BUFFER *b */ );
137 extern void spool_skip ( /* SPOOL *sp, int count */ );
138 extern void spool_play ( /* SPOOL *sp */ );
139 extern void spool_update ();
140 extern int spool_process ( /* char *buf, int nbytes */ );
141 extern SPOOL *spool_find ( /* int id */ );
142 extern void spool_cleanup ( /* void */ );
143 extern void spool_set_count ( /* SPOOL *sp, int count */ );
144 extern void spool_set_list_count ( /* SPOOL *sp, int count */ );
145 extern void spool_set_priority ( /* SPOOL *sp, int count */ );
146 extern void spool_set_sample_rate ( /* SPOOL *sp, int sample_rate */ );
147 extern void spool_set_volume ( /* SPOOL *sp, int volume */ );
148 extern void spool_set_client_data ( /* SPOOL *sp, char *client_data */ );
149 extern SPOOL *spool_find_pid ( /* int pid */ );
150 #endif
151
152 #endif /* _spool_h */