comparison decoders/oggtremor.c @ 591:8faf61a640f0 tip

Resynced fixes for unit conversion bugs in the Ogg Tremor decoder from SoundDecoder/ALmixer. Ogg Vorbis uses seconds and we multiply by 1000 to convert to milliseconds. But Ogg Tremor already uses milliseconds but I was still multiplying by 1000.
author Eric Wing <ewing . public |-at-| gmail . com>
date Thu, 25 Oct 2012 16:34:18 -0700
parents 1c8414cd5839
children
comparison
equal deleted inserted replaced
590:1c8414cd5839 591:8faf61a640f0
213 sample->actual.channels = (Uint8) info->channels; 213 sample->actual.channels = (Uint8) info->channels;
214 total_time = ov_time_total(vf, -1); 214 total_time = ov_time_total(vf, -1);
215 if (OV_EINVAL == total_time) 215 if (OV_EINVAL == total_time)
216 internal->total_time = -1; 216 internal->total_time = -1;
217 else 217 else
218 internal->total_time = (Sint32)(total_time * 1000.0 + 0.5); 218 internal->total_time = (Sint32)(total_time);
219 219
220 220
221 /* 221 /*
222 * Since we might have more than one logical bitstream in the OGG file, 222 * Since we might have more than one logical bitstream in the OGG file,
223 * and these bitstreams may be in different formats, we might be 223 * and these bitstreams may be in different formats, we might be
363 363
364 static int OGG_seek(Sound_Sample *sample, Uint32 ms) 364 static int OGG_seek(Sound_Sample *sample, Uint32 ms)
365 { 365 {
366 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; 366 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
367 OggVorbis_File *vf = (OggVorbis_File *) internal->decoder_private; 367 OggVorbis_File *vf = (OggVorbis_File *) internal->decoder_private;
368 double timepos = (((double) ms) / 1000.0); 368 /* Unlike Vorbis, Tremor uses integer milliseconds instead of double seconds. */
369 BAIL_IF_MACRO(ov_time_seek(vf, timepos) < 0, ERR_IO_ERROR, 0); 369 BAIL_IF_MACRO(ov_time_seek(vf, (ogg_int64_t)ms) < 0, ERR_IO_ERROR, 0);
370 return(1); 370 return(1);
371 } /* OGG_seek */ 371 } /* OGG_seek */
372 372
373 #endif /* SOUND_SUPPORTS_OGG */ 373 #endif /* SOUND_SUPPORTS_OGG */
374 374