annotate src/shnplug/shn.h @ 1627:abe9f63c4e8b

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