Mercurial > SDL_sound_CoreAudio
comparison decoders/shn.c @ 233:15a3b1a1291c
Kludged implementation of the rewind method.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sat, 19 Jan 2002 20:02:55 +0000 |
parents | c9772a9f5271 |
children | 12a9c2e0b00f |
comparison
equal
deleted
inserted
replaced
232:34000a50353b | 233:15a3b1a1291c |
---|---|
109 Uint8 *getbufp; | 109 Uint8 *getbufp; |
110 Uint32 gbuffer; | 110 Uint32 gbuffer; |
111 Uint8 *backBuffer; | 111 Uint8 *backBuffer; |
112 Uint32 backBufferSize; | 112 Uint32 backBufferSize; |
113 Uint32 backBufLeft; | 113 Uint32 backBufLeft; |
114 Uint32 start_pos; | |
114 } shn_t; | 115 } shn_t; |
115 | 116 |
116 | 117 |
117 static const Uint32 mask_table[] = | 118 static const Uint32 mask_table[] = |
118 { | 119 { |
661 | 662 |
662 goto shn_open_puke; | 663 goto shn_open_puke; |
663 return(0); | 664 return(0); |
664 } /* if */ | 665 } /* if */ |
665 | 666 |
667 shn->start_pos = SDL_RWtell(rw); | |
668 | |
666 shn = (shn_t *) malloc(sizeof (shn_t)); | 669 shn = (shn_t *) malloc(sizeof (shn_t)); |
667 if (shn == NULL) | 670 if (shn == NULL) |
668 { | 671 { |
669 Sound_SetError(ERR_OUT_OF_MEMORY); | 672 Sound_SetError(ERR_OUT_OF_MEMORY); |
670 goto shn_open_puke; | 673 goto shn_open_puke; |
689 | 692 |
690 return(0); | 693 return(0); |
691 } /* SHN_open */ | 694 } /* SHN_open */ |
692 | 695 |
693 | 696 |
694 void fix_bitshift(Sint32 *buffer, int nitem, int bitshift, int ftype) | 697 static void fix_bitshift(Sint32 *buffer, int nitem, int bitshift, int ftype) |
695 { | 698 { |
696 int i; | 699 int i; |
697 | 700 |
698 if (ftype == SHN_TYPE_AU1) | 701 if (ftype == SHN_TYPE_AU1) |
699 { | 702 { |
1299 } /* SHN_read */ | 1302 } /* SHN_read */ |
1300 | 1303 |
1301 | 1304 |
1302 static int SHN_rewind(Sound_Sample *sample) | 1305 static int SHN_rewind(Sound_Sample *sample) |
1303 { | 1306 { |
1304 /* !!! FIXME. */ | 1307 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; |
1305 SNDDBG(("SHN_rewind(): Write me!\n")); | 1308 shn_t *shn = (shn_t *) internal->decoder_private; |
1306 assert(0); | 1309 |
1307 return(0); | 1310 #if 0 |
1311 int rc = SDL_RWseek(internal->rw, shn->start_pos, SEEK_SET); | |
1312 BAIL_IF_MACRO(rc != shn->start_pos, ERR_IO_ERROR, 0); | |
1313 /* !!! FIXME: set state. */ | |
1314 return(1); | |
1315 #else | |
1316 /* | |
1317 * !!! FIXME: This is really unacceptable; state should be reset and | |
1318 * !!! FIXME: the RWops should be pointed to the start of the data | |
1319 * !!! FIXME: to decode. The below kludge adds unneeded overhead and | |
1320 * !!! FIXME: risk of failure. | |
1321 */ | |
1322 BAIL_IF_MACRO(SDL_RWseek(internal->rw, 0, SEEK_SET) != 0, ERR_IO_ERROR, 0); | |
1323 SHN_close(sample); | |
1324 return(SHN_open(sample, "SHN")); | |
1325 #endif | |
1308 } /* SHN_rewind */ | 1326 } /* SHN_rewind */ |
1309 | 1327 |
1310 #endif /* defined SOUND_SUPPORTS_SHN */ | 1328 #endif /* defined SOUND_SUPPORTS_SHN */ |
1311 | 1329 |
1312 /* end of shn.c ... */ | 1330 /* end of shn.c ... */ |