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