hopefully make seeking backwards a little safer

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@136 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2008-05-16 21:13:19 +00:00
parent 1e4e66ce3f
commit 40e445aae6

View File

@ -361,13 +361,21 @@ DWORD WINAPI __stdcall decode(void *arg) {
if (seek_needed_samples != -1) { if (seek_needed_samples != -1) {
/* reset if we need to seek backwards */ /* reset if we need to seek backwards */
if (seek_needed_samples < decode_pos_samples) { if (seek_needed_samples < decode_pos_samples) {
VGMSTREAM * temp; VGMSTREAM * new_temp;
temp = vgmstream; VGMSTREAM * old_temp;
vgmstream = NULL;
close_vgmstream(temp);
temp = init_vgmstream(lastfn); new_temp = init_vgmstream(lastfn);
vgmstream = temp; if (!new_temp) {
PostMessage(input_module.hMainWindow, /* message dest */
WM_WA_MPEG_EOF, /* message id */
0,0); /* no parameters */
return 0;
}
old_temp = vgmstream;
vgmstream = new_temp;
close_vgmstream(old_temp);
decode_pos_samples = 0; decode_pos_samples = 0;
decode_pos_ms = 0; decode_pos_ms = 0;