src/ : Don't fake psf->bytewidth values.

This commit is contained in:
Erik de Castro Lopo 2012-02-20 20:53:39 +11:00
parent 8433e06043
commit f219c658e8
6 changed files with 8 additions and 20 deletions

View File

@ -1,3 +1,8 @@
2012-02-20 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/au.c src/flac.c src/g72x.c src/ogg_vorbis.c src/wav_w64.c
Don't fake psf->bytewidth values.
2012-02-19 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/string_test.c

View File

@ -211,8 +211,6 @@ au_write_header (SF_PRIVATE *psf, int calc_length)
psf->datalength = psf->filelength - psf->dataoffset ;
if (psf->dataend)
psf->datalength -= psf->filelength - psf->dataend ;
psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
} ;
encoding = au_format_to_encoding (SF_CODEC (psf->sf.format)) ;

View File

@ -656,15 +656,11 @@ flac_open (SF_PRIVATE *psf)
psf->datalength = psf->filelength ;
psf->dataoffset = 0 ;
psf->blockwidth = 0 ;
psf->bytewidth = 1 ;
psf->container_close = flac_close ;
psf->seek = flac_seek ;
psf->command = flac_command ;
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
switch (subformat)
{ case SF_FORMAT_PCM_S8 : /* 8-bit FLAC. */
case SF_FORMAT_PCM_16 : /* 16-bit FLAC. */
@ -821,9 +817,6 @@ flac_init (SF_PRIVATE *psf)
psf->write_double = flac_write_d2flac ;
} ;
psf->bytewidth = 1 ;
psf->blockwidth = psf->sf.channels ;
if (psf->filelength > psf->dataoffset)
psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ;
else

View File

@ -112,8 +112,6 @@ g72x_init (SF_PRIVATE * psf)
default : return SFE_UNIMPLEMENTED ;
} ;
psf->blockwidth = psf->bytewidth = 1 ;
psf->filelength = psf_get_filelen (psf) ;
if (psf->filelength < psf->dataoffset)
psf->filelength = psf->dataoffset ;
@ -505,7 +503,7 @@ g72x_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
pg72x = (G72x_PRIVATE*) psf->codec_data ;
sptr = ubuf.sbuf ;
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
while (len > 0)
{ writecount = (len >= bufferlen) ? bufferlen : len ;
for (k = 0 ; k < writecount ; k++)
@ -536,7 +534,7 @@ g72x_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ;
sptr = ubuf.sbuf ;
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
while (len > 0)
{ writecount = (len >= bufferlen) ? bufferlen : len ;
for (k = 0 ; k < writecount ; k++)
@ -568,7 +566,7 @@ g72x_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ;
sptr = ubuf.sbuf ;
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
while (len > 0)
{ writecount = (len >= bufferlen) ? bufferlen : len ;
for (k = 0 ; k < writecount ; k++)

View File

@ -528,9 +528,6 @@ ogg_vorbis_open (SF_PRIVATE *psf)
psf->strings.flags = SF_STR_ALLOW_START ;
} ;
psf->bytewidth = 1 ;
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
psf->seek = vorbis_seek ;
psf->command = vorbis_command ;

View File

@ -224,7 +224,6 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
else
psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->ima.bytespersec) ;
psf->bytewidth = 2 ;
psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->ima.extrabytes) ;
psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
break ;
@ -247,7 +246,6 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
else
psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
psf->bytewidth = 2 ;
psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->msadpcm.extrabytes) ;
psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->msadpcm.samplesperblock) ;
if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
@ -284,7 +282,6 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
else
psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->gsm610.bytespersec) ;
psf->bytewidth = 2 ;
psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->gsm610.extrabytes) ;
psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
break ;