Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 95966
Collapse All | Expand All

(-)wavplay-1.4/file.c (-6 / +6 lines)
Lines 151-160 Link Here
151
	UInt32 dbytes;				/* Data byte count */
151
	UInt32 dbytes;				/* Data byte count */
152
						/* wavfile.c values : */
152
						/* wavfile.c values : */
153
	int channels;				/* Channels recorded in this wav file */
153
	int channels;				/* Channels recorded in this wav file */
154
	u_long samplerate;			/* Sampling rate */
154
	uint32_t samplerate;			/* Sampling rate */
155
	int sample_bits;			/* data bit size (8/12/16) */
155
	int sample_bits;			/* data bit size (8/12/16) */
156
	u_long samples;				/* The number of samples in this file */
156
	uint32_t samples;				/* The number of samples in this file */
157
	u_long datastart;			/* The offset to the wav data */
157
	uint32_t datastart;			/* The offset to the wav data */
158
158
159
	v_erf = erf;				/* Set error reporting function */
159
	v_erf = erf;				/* Set error reporting function */
160
160
Lines 299-308 Link Here
299
WavClose(WAVFILE *wfile,ErrFunc erf) {
299
WavClose(WAVFILE *wfile,ErrFunc erf) {
300
	int e = 0;				/* Returned error code */
300
	int e = 0;				/* Returned error code */
301
	int channels;				/* Channels recorded in this wav file */
301
	int channels;				/* Channels recorded in this wav file */
302
	u_long samplerate;			/* Sampling rate */
302
	uint32_t samplerate;			/* Sampling rate */
303
	int sample_bits;			/* data bit size (8/12/16) */
303
	int sample_bits;			/* data bit size (8/12/16) */
304
	u_long samples;				/* The number of samples in this file */
304
	uint32_t samples;				/* The number of samples in this file */
305
	u_long datastart;			/* The offset to the wav data */
305
	uint32_t datastart;			/* The offset to the wav data */
306
	long fpos;				/* File position in bytes */
306
	long fpos;				/* File position in bytes */
307
307
308
	v_erf = erf;				/* Set error reporting function */
308
	v_erf = erf;				/* Set error reporting function */
(-)wavplay-1.4/wavfile.c (-26 / +26 lines)
Lines 51-79 Link Here
51
#define		FALSE			0
51
#define		FALSE			0
52
52
53
typedef  struct
53
typedef  struct
54
{	u_long     dwSize ;
54
{	uint32_t     dwSize ;
55
	u_short    wFormatTag ;
55
	uint16_t    wFormatTag ;
56
	u_short    wChannels ;
56
	uint16_t    wChannels ;
57
	u_long     dwSamplesPerSec ;
57
	uint32_t     dwSamplesPerSec ;
58
	u_long     dwAvgBytesPerSec ;
58
	uint32_t     dwAvgBytesPerSec ;
59
	u_short    wBlockAlign ;
59
	uint16_t    wBlockAlign ;
60
	u_short    wBitsPerSample ;
60
	uint16_t    wBitsPerSample ;
61
} WAVEFORMAT ;
61
} WAVEFORMAT ;
62
62
63
typedef  struct
63
typedef  struct
64
{	char    	RiffID [4] ;
64
{	char    	RiffID [4] ;
65
	u_long    	RiffSize ;
65
	uint32_t    	RiffSize ;
66
	char    	WaveID [4] ;
66
	char    	WaveID [4] ;
67
	char    	FmtID  [4] ;
67
	char    	FmtID  [4] ;
68
	u_long    	FmtSize ;
68
	uint32_t    	FmtSize ;
69
	u_short   	wFormatTag ;
69
	uint16_t   	wFormatTag ;
70
	u_short   	nChannels ;
70
	uint16_t   	nChannels ;
71
	u_long		nSamplesPerSec ;
71
	uint32_t		nSamplesPerSec ;
72
	u_long		nAvgBytesPerSec ;
72
	uint32_t		nAvgBytesPerSec ;
73
	u_short		nBlockAlign ;
73
	uint16_t		nBlockAlign ;
74
	u_short		wBitsPerSample ;
74
	uint16_t		wBitsPerSample ;
75
	char		DataID [4] ;
75
	char		DataID [4] ;
76
	u_long		nDataBytes ;
76
	uint32_t		nDataBytes ;
77
} WAVE_HEADER ;
77
} WAVE_HEADER ;
78
78
79
/*=================================================================================================*/
79
/*=================================================================================================*/
Lines 115-123 Link Here
115
	va_end(ap);
115
	va_end(ap);
116
}
116
}
117
117
118
int  WaveWriteHeader (int wavefile, int channels, u_long samplerate, int sampbits, u_long samples, ErrFunc erf)
118
int  WaveWriteHeader (int wavefile, int channels, uint32_t samplerate, int sampbits, uint32_t samples, ErrFunc erf)
119
{ 	u_long		databytes ;
119
{ 	uint32_t		databytes ;
120
	u_short		blockalign ;
120
	uint16_t		blockalign ;
121
121
122
	v_erf = erf;				/* wwg: Set error reporting function */
122
	v_erf = erf;				/* wwg: Set error reporting function */
123
123
Lines 129-141 Link Here
129
	sampbits   = (sampbits == 16) ? 16 : 8 ;
129
	sampbits   = (sampbits == 16) ? 16 : 8 ;
130
130
131
	blockalign = ((sampbits == 16) ? 2 : 1) * channels ;
131
	blockalign = ((sampbits == 16) ? 2 : 1) * channels ;
132
	databytes  = samples * (u_long) blockalign ;
132
	databytes  = samples * (uint32_t) blockalign ;
133
133
134
	waveheader.RiffSize 	   = sizeof (WAVE_HEADER) + databytes - 8 ;
134
	waveheader.RiffSize 	   = sizeof (WAVE_HEADER) + databytes - 8 ;
135
	waveheader.wFormatTag      = PCM_WAVE_FORMAT ;
135
	waveheader.wFormatTag      = PCM_WAVE_FORMAT ;
136
	waveheader.nChannels       = channels ;
136
	waveheader.nChannels       = channels ;
137
	waveheader.nSamplesPerSec  = samplerate ;
137
	waveheader.nSamplesPerSec  = samplerate ;
138
	waveheader.nAvgBytesPerSec = samplerate * (u_long) blockalign ;
138
	waveheader.nAvgBytesPerSec = samplerate * (uint32_t) blockalign ;
139
	waveheader.nBlockAlign     = blockalign ;
139
	waveheader.nBlockAlign     = blockalign ;
140
	waveheader.wBitsPerSample  = sampbits ;
140
	waveheader.wBitsPerSample  = sampbits ;
141
	waveheader.nDataBytes      = databytes;
141
	waveheader.nDataBytes      = databytes;
Lines 148-158 Link Here
148
  return 0 ;
148
  return 0 ;
149
} ; /* WaveWriteHeader*/
149
} ; /* WaveWriteHeader*/
150
150
151
int  WaveReadHeader  (int wavefile, int* channels, u_long* samplerate, int* samplebits, u_long* samples, u_long* datastart,ErrFunc erf)
151
int  WaveReadHeader  (int wavefile, int* channels, uint32_t* samplerate, int* samplebits, uint32_t* samples, uint32_t* datastart,ErrFunc erf)
152
{	static  WAVEFORMAT  waveformat ;
152
{	static  WAVEFORMAT  waveformat ;
153
	static	char   buffer [ BUFFERSIZE ] ;		/* Function is not reentrant.*/
153
	static	char   buffer [ BUFFERSIZE ] ;		/* Function is not reentrant.*/
154
	char*   ptr ;
154
	char*   ptr ;
155
	u_long  databytes ;
155
	uint32_t  databytes ;
156
156
157
	v_erf = erf;					/* wwg: Set error reporting function */
157
	v_erf = erf;					/* wwg: Set error reporting function */
158
158
Lines 183-189 Link Here
183
	ptr += 4 ;	/* Move past "fmt ".*/
183
	ptr += 4 ;	/* Move past "fmt ".*/
184
	memcpy (&waveformat, ptr, sizeof (WAVEFORMAT)) ;
184
	memcpy (&waveformat, ptr, sizeof (WAVEFORMAT)) ;
185
185
186
	if (waveformat.dwSize < (sizeof (WAVEFORMAT) - sizeof (u_long))) {
186
	if (waveformat.dwSize < (sizeof (WAVEFORMAT) - sizeof (uint32_t))) {
187
		err("Bad format: Bad fmt size");			/* wwg: report error */
187
		err("Bad format: Bad fmt size");			/* wwg: report error */
188
		return  WR_BADFORMATSIZE ;
188
		return  WR_BADFORMATSIZE ;
189
	}
189
	}
Lines 201-207 Link Here
201
	}
201
	}
202
202
203
	ptr += 4 ;	/* Move past "data".*/
203
	ptr += 4 ;	/* Move past "data".*/
204
	memcpy (&databytes, ptr, sizeof (u_long)) ;
204
	memcpy (&databytes, ptr, sizeof (uint32_t)) ;
205
205
206
	/* Everything is now cool, so fill in output data.*/
206
	/* Everything is now cool, so fill in output data.*/
207
207
Lines 210-216 Link Here
210
	*samplebits = waveformat.wBitsPerSample ;
210
	*samplebits = waveformat.wBitsPerSample ;
211
	*samples    = databytes / waveformat.wBlockAlign ;
211
	*samples    = databytes / waveformat.wBlockAlign ;
212
	
212
	
213
	*datastart  = ((u_long) (ptr + 4)) - ((u_long) (&(buffer[0]))) ;
213
	*datastart  = ((uint32_t) (ptr + 4)) - ((uint32_t) (&(buffer[0]))) ;
214
214
215
	if (waveformat.dwSamplesPerSec != waveformat.dwAvgBytesPerSec / waveformat.wBlockAlign) {
215
	if (waveformat.dwSamplesPerSec != waveformat.dwAvgBytesPerSec / waveformat.wBlockAlign) {
216
		err("Bad file format");			/* wwg: report error */
216
		err("Bad file format");			/* wwg: report error */
(-)wavplay-1.4/wavfile.h (-2 / +4 lines)
Lines 27-32 Link Here
27
#ifndef _wavfile_h
27
#ifndef _wavfile_h
28
#define _wavfile_h "@(#)wavfile.h $Revision: 1.1.1.1 $"
28
#define _wavfile_h "@(#)wavfile.h $Revision: 1.1.1.1 $"
29
29
30
#include <stdint.h>
31
30
#define WW_BADOUTPUTFILE	1
32
#define WW_BADOUTPUTFILE	1
31
#define WW_BADWRITEHEADER	2
33
#define WW_BADWRITEHEADER	2
32
34
Lines 41-48 Link Here
41
#define WR_NODATACHUNK		10
43
#define WR_NODATACHUNK		10
42
#define WR_BADFORMATDATA	11
44
#define WR_BADFORMATDATA	11
43
45
44
extern int WaveWriteHeader(int wavefile,int channels,u_long samplerate,int sampbits,u_long samples,ErrFunc erf);
46
extern int WaveWriteHeader(int wavefile,int channels,uint32_t samplerate,int sampbits,uint32_t samples,ErrFunc erf);
45
extern int WaveReadHeader(int wavefile,int *channels,u_long *samplerate,int *samplebits,u_long *samples,u_long *datastart,ErrFunc erf);
47
extern int WaveReadHeader(int wavefile,int *channels,uint32_t *samplerate,int *samplebits,uint32_t *samples,uint32_t *datastart,ErrFunc erf);
46
48
47
#if 0
49
#if 0
48
extern char *WaveFileError(int error);
50
extern char *WaveFileError(int error);
(-)wavplay-1.4/xltwavplay.c (-1 / +1 lines)
Lines 387-393 Link Here
387
	char *pText = XmTextGetString(wRecRate);			/* Get contents */
387
	char *pText = XmTextGetString(wRecRate);			/* Get contents */
388
	unsigned long ul;
388
	unsigned long ul;
389
389
390
	if ( sscanf(pText,"%lu",&ul) != 1 ) {				/* Convert to u_long */
390
	if ( sscanf(pText,"%lu",&ul) != 1 ) {				/* Convert to uint32_t */
391
		if ( !*pText )
391
		if ( !*pText )
392
			ReportErrorf("No sampling rate has been specified.");
392
			ReportErrorf("No sampling rate has been specified.");
393
		else	ReportErrorf("Record sampling rate '%s' must be an integer.",pText);
393
		else	ReportErrorf("Record sampling rate '%s' must be an integer.",pText);

Return to bug 95966