diff --git a/ChangeLog b/ChangeLog index 15ccdf07..12a186f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-20 Erik de Castro Lopo + + * 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 * tests/string_test.c diff --git a/src/au.c b/src/au.c index d2ef78ba..bcd869a7 100644 --- a/src/au.c +++ b/src/au.c @@ -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)) ; diff --git a/src/flac.c b/src/flac.c index b4cb57d6..4f3fc34a 100644 --- a/src/flac.c +++ b/src/flac.c @@ -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 diff --git a/src/g72x.c b/src/g72x.c index 0382eadb..fec5d3f3 100644 --- a/src/g72x.c +++ b/src/g72x.c @@ -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++) diff --git a/src/ogg_vorbis.c b/src/ogg_vorbis.c index 09522da7..7ade80cd 100644 --- a/src/ogg_vorbis.c +++ b/src/ogg_vorbis.c @@ -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 ; diff --git a/src/wav_w64.c b/src/wav_w64.c index 51e12b53..cf0d3ef2 100644 --- a/src/wav_w64.c +++ b/src/wav_w64.c @@ -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 ;