1 /*
2  *   cdda - CD Digital Audio support
3  *
4  *   Copyright (C) 1993-2004  Ti Kan
5  *   E-mail: xmcd@amb.org
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 2 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 #ifndef __WR_GEN_H__
22 #define __WR_GEN_H__
23 
24 #ifndef lint
25 static char *_wr_gen_h_ident_ = "@(#)wr_gen.h	7.41 04/02/02";
26 #endif
27 
28 #ifdef CDDA_SUPPORTED
29 
30 /* Definitions used for the flags field of gen_desc_t */
31 #define GDESC_WRITEOUT	0x1	/* Force a write of an encoded audio buffer */
32 #define GDESC_ISPIPE	0x2	/* The output stream is to a pipe */
33 
34 /* Default buffer size for buffered file I/O */
35 #define GDESC_BUFSZ	(16 * 1024)
36 
37 /* Data structure used in most of the functions in this module */
38 typedef struct gen_desc {
39 	cd_state_t	*cdp;
40 	char		*path;
41 	int		fd;
42 	int		fmt;
43 	int		flags;
44 	mode_t		mode;
45 	size_t		datalen;
46 	pid_t		cpid;
47 	FILE		*fp;
48 	char		*buf;
49 	void		*aux;
50 } gen_desc_t;
51 
52 
53 /* Function prototypes */
54 extern char		*gen_esc_shellquote(gen_desc_t *, char *);
55 extern char		*gen_genre_cddb2id3(char *);
56 extern bool_t		gen_set_eid(cd_state_t *);
57 extern bool_t		gen_reset_eid(cd_state_t *);
58 extern gen_desc_t	*gen_open_file(cd_state_t *, char *, int, mode_t,
59 				       int, size_t);
60 extern bool_t		gen_close_file(gen_desc_t *);
61 extern gen_desc_t	*gen_open_pipe(cd_state_t *, char *, pid_t *,
62 				       int, size_t);
63 extern bool_t		gen_close_pipe(gen_desc_t *);
64 extern bool_t		gen_read_chunk(gen_desc_t *, byte_t *, size_t);
65 extern bool_t		gen_write_chunk(gen_desc_t *, byte_t *, size_t);
66 extern bool_t		gen_seek(gen_desc_t *, off_t, int);
67 #ifndef __VMS
68 extern bool_t		gen_ioctl(gen_desc_t *, int, void *);
69 #endif
70 extern void		gen_byteswap(byte_t *, byte_t *, size_t);
71 extern bool_t		gen_filefmt_be(int);
72 extern void		gen_chroute_att(int, int, sword16_t *, size_t);
73 extern void		gen_write_init(void);
74 
75 #endif	/* CDDA_SUPPORTED */
76 
77 #endif	/* __WR_GEN_H__ */
78 
79