Debian Codegraph @

rplayd/spool.h

raw symbols ◀ ▶ SCIP
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 struct _spool;
48 typedef struct _spool SPOOL;
49
50 typedef struct _spool
51 {
52 struct _spool *next;
53 struct _spool *prev;
54 int id; /* unique spool id */
55 int state; /* state of spool entry */
56 time_t time; /* time since data was last read */
57 int curr_sound; /* current sound */
58 int curr_count; /* # times left to play curr_sound */
59 int list_count; /* # times left to play the sound list */
60 SOUND *sound[SOUND_LIST_SIZE]; /* list of sounds */
61 SINDEX *si; /* Index of the current sound. */
62 BUFFER *curr_buffer; /* Buffer of audio that's currently playing. */
63 BUFFER *next_buffer; /* Buffer of audio that will be played next. */
64 int offset; /* Position in the current audio file. */
65 unsigned char *ptr; /* Pointer to the current sample. */
66 unsigned char *ptr_end; /* The end of the current buffer. */
67 RPLAY *rp; /* RPLAY packet received */
68 RPLAY_ATTRS *curr_attrs; /* current rplay attributes */
69 struct sockaddr_in sin; /* client's address */
70 unsigned long sample_rate; /* sample rate of curr_sound */
71 double sample_index; /* Must use float to avoid rounding errors. */
72 double sample_factor; /* Factor to increase the sample index by. */
73 double oversample[2]; /* The current sample value when oversampling */
74 double oversample_inc[2]; /* The delta to increase the oversample with */
•75 int (*to_native) (SPOOL *, char *, int, int); /* Convert curr_sound samples to native. */
76 int skip_count; /* skip curr_sound */
77 int auto_pause; /* pause before play */
78 int notify_position; /* notify clients needing position information */
79 }
80 SPOOL;
81
82 extern SPOOL *spool;
83 extern int spool_size;
84 extern int spool_nplaying;
85 extern int spool_npaused;
86 extern int spool_prio;
87 extern int spool_needs_update;
88
89 #ifdef __STDC__
90 extern void spool_init ();
91 extern SPOOL *spool_create ();
92 extern void spool_destroy (SPOOL *sp);
93 extern int spool_match (RPLAY *match, void (*action) (SPOOL *), struct sockaddr_in sin);
94 extern SPOOL *spool_next (int priority);
95 extern void spool_ready (SOUND *sound);
96 extern void spool_remove (SOUND *sound);
97 extern BUFFER *spool_list_create ();
98 extern void spool_reset (SPOOL *sp);
99 extern void spool_setprio (void);
100 extern int spool_id (void);
101 extern void spool_stop (SPOOL *sp);
102 extern void spool_pause (SPOOL *sp);
103 extern void spool_continue (SPOOL *sp);
104 extern void spool_done (SPOOL *sp);
105 extern void spool_flow_pause (SPOOL *sp);
106 extern void spool_flow_continue (SPOOL *sp);
107 extern int spool_flow_insert (SPOOL *sp, BUFFER *b);
108 extern void spool_skip (SPOOL *sp, int count);
109 extern void spool_play (SPOOL *sp);
110 extern void spool_update (void);
111 extern int spool_process (char *buf, int nbytes);
112 extern SPOOL *spool_find (int id);
113 extern void spool_cleanup (void);
114 extern void spool_set_count (SPOOL *sp, int count);
115 extern void spool_set_list_count (SPOOL *sp, int count);
116 extern void spool_set_priority (SPOOL *sp, int priority);
117 extern void spool_set_sample_rate (SPOOL *sp, int sample_rate);
118 extern void spool_set_volume (SPOOL *sp, int volume);
119 extern void spool_set_client_data (SPOOL *sp, char *client_data);
120 extern SPOOL *spool_find_pid (int pid);
121 #else
122 extern void spool_init ();
123 extern SPOOL *spool_create ();
124 extern void spool_destroy ( /* SPOOL *sp */ );
125 extern int spool_match ( /* RPLAY *match, void (*action)(SPOOL *), struct sockaddr_in sin */ );
126 extern SPOOL *spool_next ( /* int priority */ );
127 extern void spool_ready ( /* SOUND *sound */ );
128 extern void spool_remove ( /* SOUND *sound */ );
129 extern BUFFER *spool_list_create ();
130 extern void spool_reset ( /* SPOOL *sp */ );
131 extern void spool_setprio ();
132 extern int spool_id ();
133 extern void spool_stop ( /* SPOOL *sp */ );
134 extern void spool_pause ( /* SPOOL *sp */ );
135 extern void spool_continue ( /* SPOOL *sp */ );
136 extern void spool_done ( /* SPOOL *sp */ );
137 extern void spool_flow_pause ( /* SPOOL *sp */ );
138 extern void spool_flow_continue ( /* SPOOL *sp */ );
139 extern int spool_flow_insert ( /* SPOOL *sp, BUFFER *b */ );
140 extern void spool_skip ( /* SPOOL *sp, int count */ );
141 extern void spool_play ( /* SPOOL *sp */ );
142 extern void spool_update ();
143 extern int spool_process ( /* char *buf, int nbytes */ );
144 extern SPOOL *spool_find ( /* int id */ );
145 extern void spool_cleanup ( /* void */ );
146 extern void spool_set_count ( /* SPOOL *sp, int count */ );
147 extern void spool_set_list_count ( /* SPOOL *sp, int count */ );
148 extern void spool_set_priority ( /* SPOOL *sp, int count */ );
149 extern void spool_set_sample_rate ( /* SPOOL *sp, int sample_rate */ );
150 extern void spool_set_volume ( /* SPOOL *sp, int volume */ );
151 extern void spool_set_client_data ( /* SPOOL *sp, char *client_data */ );
152 extern SPOOL *spool_find_pid ( /* int pid */ );
153 #endif
154
155 #endif /* _spool_h */