1305
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
1 /* xmms-shn - a shorten (.shn) plugin for XMMS
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
2 * Copyright (C) 2000-2007 Jason Jordan <shnutils@freeshell.org>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
3 *
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
7 * (at your option) any later version.
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
8 *
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
12 * GNU General Public License for more details.
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
13 *
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
17 */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
18
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
19 /*
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
20 * $Id: shn.h,v 1.27 2007/03/23 05:49:48 jason Exp $
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
21 */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
22
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
23 #ifndef _SHN_H
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
24 #define _SHN_H
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
25
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
26 #include <pthread.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
27
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
28 #include <stdlib.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
29 #include <string.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
30 #include <stdio.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
31 #include <unistd.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
32 #include <sys/stat.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
33
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
34 #include <audacious/plugin.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
35 #include <audacious/vfs.h>
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
36
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
37 #ifdef HAVE_CONFIG_H
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
38 #include "config.h"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
39 #endif
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
40
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
41 #define shn_vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
42
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
43 #define min(a,b) (((a)<(b))?(a):(b))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
44
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
45 #define XMMS_SHN_VERSION_TAG "xmms-shn_v2"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
46
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
47 /* surely no headers will be this large. right? RIGHT? */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
48 #define OUT_BUFFER_SIZE 16384
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
49
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
50 #define BUF_SIZE 4096
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
51
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
52 #define ERROR_OUTPUT_DEVNULL 0
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
53 #define ERROR_OUTPUT_STDERR 1
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
54 #define ERROR_OUTPUT_WINDOW 2
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
55
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
56 #define SEEK_SUFFIX "skt"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
57
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
58 #define NO_SEEK_TABLE -1
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
59
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
60 #define SEEK_HEADER_SIGNATURE "SEEK"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
61 #define SEEK_TRAILER_SIGNATURE "SHNAMPSK"
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
62
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
63 #define SEEK_HEADER_SIZE 12
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
64 #define SEEK_TRAILER_SIZE 12
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
65 #define SEEK_ENTRY_SIZE 80
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
66 #define SEEK_RESOLUTION 25600
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
67
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
68 #define WAVE_RIFF (0x46464952) /* 'RIFF' in little-endian */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
69 #define WAVE_WAVE (0x45564157) /* 'WAVE' in little-endian */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
70 #define WAVE_FMT (0x20746d66) /* ' fmt' in little-endian */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
71 #define WAVE_DATA (0x61746164) /* 'data' in little-endian */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
72
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
73 #define AIFF_FORM (0x4D524F46) /* 'FORM' in little-endian */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
74
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
75 #define WAVE_FORMAT_UNKNOWN (0x0000)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
76 #define WAVE_FORMAT_PCM (0x0001)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
77 #define WAVE_FORMAT_ADPCM (0x0002)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
78 #define WAVE_FORMAT_IEEE_FLOAT (0x0003)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
79 #define WAVE_FORMAT_ALAW (0x0006)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
80 #define WAVE_FORMAT_MULAW (0x0007)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
81 #define WAVE_FORMAT_OKI_ADPCM (0x0010)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
82 #define WAVE_FORMAT_IMA_ADPCM (0x0011)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
83 #define WAVE_FORMAT_DIGISTD (0x0015)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
84 #define WAVE_FORMAT_DIGIFIX (0x0016)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
85 #define WAVE_FORMAT_DOLBY_AC2 (0x0030)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
86 #define WAVE_FORMAT_GSM610 (0x0031)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
87 #define WAVE_FORMAT_ROCKWELL_ADPCM (0x003b)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
88 #define WAVE_FORMAT_ROCKWELL_DIGITALK (0x003c)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
89 #define WAVE_FORMAT_G721_ADPCM (0x0040)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
90 #define WAVE_FORMAT_G728_CELP (0x0041)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
91 #define WAVE_FORMAT_MPEG (0x0050)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
92 #define WAVE_FORMAT_MPEGLAYER3 (0x0055)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
93 #define WAVE_FORMAT_G726_ADPCM (0x0064)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
94 #define WAVE_FORMAT_G722_ADPCM (0x0065)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
95
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
96 #define CD_BLOCK_SIZE (2352)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
97 #define CD_BLOCKS_PER_SEC (75)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
98 #define CD_MIN_BURNABLE_SIZE (705600)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
99 #define CD_CHANNELS (2)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
100 #define CD_SAMPLES_PER_SEC (44100)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
101 #define CD_BITS_PER_SAMPLE (16)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
102 #define CD_RATE (176400)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
103
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
104 #define CANONICAL_HEADER_SIZE (44)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
105
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
106 #define PROBLEM_NOT_CD_QUALITY (0x00000001)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
107 #define PROBLEM_CD_BUT_BAD_BOUND (0x00000002)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
108 #define PROBLEM_CD_BUT_TOO_SHORT (0x00000004)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
109 #define PROBLEM_HEADER_NOT_CANONICAL (0x00000008)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
110 #define PROBLEM_EXTRA_CHUNKS (0x00000010)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
111 #define PROBLEM_HEADER_INCONSISTENT (0x00000020)
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
112
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
113 #define PROB_NOT_CD(f) ((f.problems) & (PROBLEM_NOT_CD_QUALITY))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
114 #define PROB_BAD_BOUND(f) ((f.problems) & (PROBLEM_CD_BUT_BAD_BOUND))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
115 #define PROB_TOO_SHORT(f) ((f.problems) & (PROBLEM_CD_BUT_TOO_SHORT))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
116 #define PROB_HDR_NOT_CANONICAL(f) ((f.problems) & (PROBLEM_HEADER_NOT_CANONICAL))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
117 #define PROB_EXTRA_CHUNKS(f) ((f.problems) & (PROBLEM_EXTRA_CHUNKS))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
118 #define PROB_HDR_INCONSISTENT(f) ((f.problems) & (PROBLEM_HEADER_INCONSISTENT))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
119
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
120 typedef struct _shn_config
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
121 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
122 gint error_output_method;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
123 gchar *error_output_method_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
124 gchar *seek_tables_path;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
125 gchar *seek_tables_path_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
126 gchar *relative_seek_tables_path;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
127 gchar *relative_seek_tables_path_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
128 gboolean verbose;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
129 gchar *verbose_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
130 gboolean swap_bytes;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
131 gchar *swap_bytes_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
132 gboolean load_textfiles;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
133 gchar *load_textfiles_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
134 gchar *textfile_extensions;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
135 gchar *textfile_extensions_config_name;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
136 } shn_config;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
137
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
138 typedef struct _shn_decode_state
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
139 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
140 uchar *getbuf;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
141 uchar *getbufp;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
142 int nbitget;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
143 int nbyteget;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
144 ulong gbuffer;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
145 schar *writebuf;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
146 schar *writefub;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
147 int nwritebuf;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
148 } shn_decode_state;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
149
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
150 typedef struct _shn_seek_header
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
151 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
152 uchar data[SEEK_HEADER_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
153 slong version;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
154 ulong shnFileSize;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
155 } shn_seek_header;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
156
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
157 typedef struct _shn_seek_trailer
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
158 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
159 uchar data[SEEK_TRAILER_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
160 ulong seekTableSize;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
161 } shn_seek_trailer;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
162
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
163 typedef struct _shn_seek_entry
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
164 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
165 uchar data[SEEK_ENTRY_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
166 } shn_seek_entry;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
167
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
168 /* old way, kept for reference.
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
169 (changed because some compilers apparently don't support #pragma pack(1))
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
170
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
171 typedef struct _shn_seek_header
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
172 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
173 char signature[4];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
174 unsigned long version;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
175 unsigned long shnFileSize;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
176 } shn_seek_header;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
177
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
178 typedef struct _shn_seek_trailer
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
179 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
180 unsigned long seekTableSize;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
181 char signature[8];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
182 } shn_seek_trailer;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
183
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
184 typedef struct _shn_seek_entry
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
185 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
186 unsigned long shnSample;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
187 unsigned long shnByteOffset;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
188 unsigned long shnLastPosition;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
189 unsigned short shnByteGet;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
190 unsigned short shnBufferOffset;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
191 unsigned short shnBitOffset;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
192 unsigned long shnGBuffer;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
193 unsigned short shnBitShift;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
194 long cbuf0[3];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
195 long cbuf1[3];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
196 long offset0[4];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
197 long offset1[4];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
198 } shn_seek_entry;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
199 */
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
200
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
201 typedef struct _shn_wave_header
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
202 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
203 char *filename,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
204 m_ss[16];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
205
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
206 uint header_size;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
207
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
208 ushort channels,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
209 block_align,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
210 bits_per_sample,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
211 wave_format;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
212
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
213 ulong samples_per_sec,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
214 avg_bytes_per_sec,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
215 rate,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
216 length,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
217 data_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
218 total_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
219 chunk_size,
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
220 actual_size;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
221
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
222 double exact_length;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
223
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
224 int file_has_id3v2_tag;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
225 long id3v2_tag_size;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
226
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
227 ulong problems;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
228 } shn_wave_header;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
229
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
230 typedef struct _shn_vars
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
231 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
232 VFSFile *fd;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
233 int seek_to;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
234 int eof;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
235 int going;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
236 slong seek_table_entries;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
237 ulong seek_resolution;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
238 int bytes_in_buf;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
239 uchar buffer[OUT_BUFFER_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
240 int bytes_in_header;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
241 uchar header[OUT_BUFFER_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
242 int fatal_error;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
243 schar fatal_error_msg[BUF_SIZE];
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
244 int reading_function_code;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
245 ulong last_file_position;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
246 ulong last_file_position_no_really;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
247 ulong initial_file_position;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
248 ulong bytes_read;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
249 unsigned short actual_bitshift;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
250 int actual_maxnlpc;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
251 int actual_nmean;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
252 int actual_nchan;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
253 long seek_offset;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
254 InputPlayback *playback;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
255 } shn_vars;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
256
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
257 typedef struct _shn_file
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
258 {
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
259 shn_vars vars;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
260 shn_decode_state *decode_state;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
261 shn_wave_header wave_header;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
262 shn_seek_header seek_header;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
263 shn_seek_trailer seek_trailer;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
264 shn_seek_entry *seek_table;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
265 } shn_file;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
266
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
267 extern InputPlugin shn_ip;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
268 extern shn_file *shnfile;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
269 extern shn_config shn_cfg;
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
270
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
271 extern shn_seek_entry *shn_seek_entry_search(shn_seek_entry *,ulong,ulong,ulong,ulong);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
272 extern void shn_load_seek_table(shn_file *,char *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
273 extern void shn_unload(shn_file *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
274 extern void shn_display_about(void);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
275 extern void shn_display_configure(void);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
276 extern void shn_display_info(shn_file *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
277 extern int shn_verify_header(shn_file *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
278 extern int shn_filename_contains_a_dot(char *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
279 extern char *shn_get_base_filename(char *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
280 extern char *shn_get_base_directory(char *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
281 extern void shn_length_to_str(shn_file *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
282 extern ulong shn_uchar_to_ulong_le(uchar *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
283 extern slong shn_uchar_to_slong_le(uchar *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
284 extern ushort shn_uchar_to_ushort_le(uchar *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
285 extern char *shn_format_to_str(ushort);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
286 extern void shn_message_box(char *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
287 extern void shn_debug(char *, ...);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
288 extern void shn_error(char *, ...);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
289 extern void shn_error_fatal(shn_file *,char *, ...);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
290 extern void shn_snprintf(char *,int,char *, ...);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
291 extern VFSFile *shn_open_and_discard_id3v2_tag(char *,int *,long *);
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
292
|
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
293 #endif
|