comparison decoders/ogg.c @ 327:aa7f6a110971

Added seek implementation.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 20 May 2002 06:46:43 +0000
parents c97be6e1bd27
children cbb15ecf423a
comparison
equal deleted inserted replaced
326:1b33baef9bf9 327:aa7f6a110971
205 SNDDBG(("OGG: number of logical bitstreams == (%ld).\n", ov_streams(vf))); 205 SNDDBG(("OGG: number of logical bitstreams == (%ld).\n", ov_streams(vf)));
206 SNDDBG(("OGG: serial number == (%ld).\n", ov_serialnumber(vf, -1))); 206 SNDDBG(("OGG: serial number == (%ld).\n", ov_serialnumber(vf, -1)));
207 SNDDBG(("OGG: total seconds of sample == (%f).\n", ov_time_total(vf, -1))); 207 SNDDBG(("OGG: total seconds of sample == (%f).\n", ov_time_total(vf, -1)));
208 208
209 internal->decoder_private = vf; 209 internal->decoder_private = vf;
210 sample->flags = SOUND_SAMPLEFLAG_NONE; 210 sample->flags = SOUND_SAMPLEFLAG_CANSEEK;
211 sample->actual.rate = (Uint32) info->rate; 211 sample->actual.rate = (Uint32) info->rate;
212 sample->actual.channels = (Uint8) info->channels; 212 sample->actual.channels = (Uint8) info->channels;
213 213
214 /* 214 /*
215 * Since we might have more than one logical bitstream in the OGG file, 215 * Since we might have more than one logical bitstream in the OGG file,
278 } /* OGG_rewind */ 278 } /* OGG_rewind */
279 279
280 280
281 static int OGG_seek(Sound_Sample *sample, Uint32 ms) 281 static int OGG_seek(Sound_Sample *sample, Uint32 ms)
282 { 282 {
283 BAIL_MACRO("!!! FIXME: Not implemented", 0); 283 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
284 OggVorbis_File *vf = (OggVorbis_File *) internal->decoder_private;
285 double timepos = (((double) ms) / 1000.0);
286 BAIL_IF_MACRO(ov_time_seek(vf, timepos) < 0, ERR_IO_ERROR, 0);
287 return(1);
284 } /* OGG_seek */ 288 } /* OGG_seek */
285 289
286 #endif /* SOUND_SUPPORTS_OGG */ 290 #endif /* SOUND_SUPPORTS_OGG */
287 291
288 292