1 /* @(#)global.h	1.37 16/01/24 Copyright 1998-2004 Heiko Eissfeldt, Copyright 2004-2016 J. Schilling */
2 /*
3  * Global Variables
4  */
5 /*
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License, Version 1.0 only
8  * (the "License").  You may not use this file except in compliance
9  * with the License.
10  *
11  * See the file CDDL.Schily.txt in this distribution for details.
12  * A copy of the CDDL is also available via the Internet at
13  * http://www.opensource.org/licenses/cddl1.txt
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file CDDL.Schily.txt from this distribution.
17  */
18 
19 #ifdef  MD5_SIGNATURES
20 #include <schily/md5.h>
21 #endif
22 #ifdef	USE_PARANOIA
23 #include "cdda_paranoia.h"
24 #endif
25 
26 #define	outfp	global.out_fp
27 
28 typedef struct index_list {
29 	struct index_list	*next;
30 	int			frameoffset;
31 } index_list;
32 
33 typedef struct global {
34 
35 	char			*dev_name;		/* device name */
36 	char			*dev_opts;		/* SCG device options */
37 	char			*aux_name;		/* auxiliary cdrom device name */
38 	char			fname_base[200];	/* current file name base */
39 
40 	int			have_forked;		/* TRUE after we did fork */
41 	pid_t			child_pid;		/* return value from fork() */
42 	int			parent_died;		/* TRUE after we killed the parent */
43 	int			audio;			/* audio-out file desc */
44 	struct soundfile	*audio_out;		/* audio-out sound functions */
45 	int			cooked_fd;		/* cdrom-in file desc */
46 	int			no_file;		/* -N option */
47 	int			no_infofile;		/* -no-infofile option */
48 	int			no_textfile;		/* -no-textfile option */
49 	int			did_textfile;		/* flag: did create textfile */
50 	int			no_textdefaults;	/* -no-textdefaults option */
51 	int			no_cddbfile;		/* flag: do not create cddbfile */
52 	int			cuefile;		/* -cuefile option */
53 	int			no_hidden_track;	/* -no-hidden-track option */
54 	int			no_fork;		/* -no-fork option */
55 	int			interactive;		/* -interactive option */
56 	int			quiet;			/* -quiet option */
57 	int			verbose;		/* -v verbose level */
58 	int			scsi_silent;		/* SCSI silent flag */
59 	int			scsi_verbose;		/* SCSI verbose level */
60 	int			scsi_debug;		/* SCSI debug level */
61 	int			scsi_kdebug;		/* SCSI kernel debug level */
62 	int			scanbus;		/* -scanbus option */
63 
64 	uid_t			uid;
65 	uid_t			euid;
66 	BOOL			issetuid;
67 	long			sector_offset;
68 	long			start_sector;
69 	unsigned long		endtrack;
70 	BOOL			alltracks;
71 	BOOL			maxtrack;
72 	int			cd_index;
73 	int			littleendian;
74 	double			rectime;
75 	double			int_part;
76 	char			*user_sound_device;
77 	int			moreargs;
78 
79 	int			multiname;		/* multiple file names given */
80 	int			sh_bits;		/* sh_bits: sample bit shift */
81 	int			Remainder;
82 	int			SkippedSamples;
83 	int			OutSampleSize;
84 	int			need_big_endian;
85 	int			need_hostorder;
86 	int			channels;		/* output sound channels */
87 	unsigned long		iloop;			/* todo counter (frames) */
88 	unsigned long		nSamplesDoneInTrack;	/* written samples in current track */
89 	unsigned		overlap;		/* dynamic cdda2wav overlap */
90 	int			useroverlap;		/* -set-overlap # option */
91 	FILE			*out_fp;		/* -out-fd FILE * for messages */
92 	char			*buf;			/* The SCSI buffer */
93 	long			bufsize;		/* The size of the SCSI buffer */
94 	unsigned		nsectors;		/* -sectors-per-request option */
95 	unsigned		buffers;		/* -buffers-in-ring option */
96 	unsigned		shmsize;
97 	long			pagesize;
98 	int			in_lendian;
99 	int			outputendianess;
100 	int			findminmax;
101 	int			maxamp[2];
102 	int			minamp[2];
103 	unsigned		speed;
104 	int			userspeed;
105 	int			ismono;
106 	int			findmono;
107 	int			swapchannels;
108 	int			deemphasize;
109 	int			gui;
110 	long			playback_rate;
111 	int			target;			/* SCSI Id to be used */
112 	int			lun;			/* SCSI Lun to be used */
113 	UINT4			cddb_id;
114 	int			cddbp;
115 	char *			cddbp_server;
116 	char *			cddbp_port;
117 	unsigned		cddb_revision;
118 	int			cddb_year;
119 	char			cddb_genre[60];
120 	int			illleadout_cd;
121 	int			reads_illleadout;
122 	unsigned char		*cdindex_id;
123 	unsigned char		*copyright_message;	/* CD Extra specific */
124 
125 	unsigned char		*disctitle;		/* 0x80 Album Ttitle */
126 	unsigned char		*performer;		/* 0x81 Album Performer */
127 	unsigned char		*songwriter;		/* 0x82 Album Songwriter */
128 	unsigned char		*composer;		/* 0x83 Album Composer */
129 	unsigned char		*arranger;		/* 0x84 Album Arranger */
130 	unsigned char		*message;		/* 0x85 Album Message */
131 	unsigned char		*closed_info;		/* 0x8d Album Closed Info */
132 
133 	unsigned char		*tracktitle[100];	/* 0x80 Track Title */
134 	unsigned char		*trackperformer[100];	/* 0x81 Track Performer */
135 	unsigned char		*tracksongwriter[100];	/* 0x82 Track Songwriter */
136 	unsigned char		*trackcomposer[100];	/* 0x83 Track Composer */
137 	unsigned char		*trackarranger[100];	/* 0x84 Track Arranger */
138 	unsigned char		*trackmessage[100];	/* 0x85 Track Message */
139 	unsigned char		*trackclosed_info[100];	/* 0x8d Track Closed Info */
140 
141 	index_list		*trackindexlist[100];
142 
143 	int			paranoia_selected;
144 	long			paranoia_flags;
145 	int			paranoia_mode;
146 #ifdef	USE_PARANOIA
147 	cdrom_paranoia  	*cdp;
148 
149 	struct paranoia_parms_t {
150 		Ucbit	disable_paranoia:1;
151 		Ucbit	disable_extra_paranoia:1;
152 		Ucbit	disable_scratch_detect:1;
153 		Ucbit	disable_scratch_repair:1;
154 		Ucbit	enable_c2_check:1;
155 		int	retries;
156 		int	readahead;
157 		int	overlap;
158 		int	mindynoverlap;
159 		int	maxdynoverlap;
160 	} paranoia_parms;
161 #endif
162 
163 	int			md5offset;
164 	int			md5blocksize;
165 #ifdef	MD5_SIGNATURES
166 	int			md5count;
167 	int			md5size;
168 	MD5_CTX			*context;
169 	unsigned char		MD5_result[16];
170 #endif
171 
172 #ifdef	ECHO_TO_SOUNDCARD
173 	int			soundcard_fd;
174 #endif
175 	int			echo;
176 
177 	int			just_the_toc;
178 } global_t;
179 
180 extern global_t global;
181