Skip to content

Commit 7bd8237

Browse files
committed
xmp: reset decoder internal state after seeking
Otherwise loop_count stays non-zero and XMP_decode() gets stuck in an endless loop. Fixes #749
1 parent f9566f4 commit 7bd8237

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/decoder_xmp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct xmp_callbacks {
5454
MIX_LOADER_FUNCTION(true,void,xmp_end_player,(xmp_context)) \
5555
MIX_LOADER_FUNCTION(true,void,xmp_get_module_info,(xmp_context, struct xmp_module_info *)) \
5656
MIX_LOADER_FUNCTION(true,int,xmp_play_frame,(xmp_context)) \
57+
MIX_LOADER_FUNCTION(true,int,xmp_play_buffer,(xmp_context, void *, int, int)) \
5758
MIX_LOADER_FUNCTION(true,int,xmp_seek_time,(xmp_context, int)) \
5859
MIX_LOADER_FUNCTION(true,void,xmp_get_frame_info,(xmp_context, struct xmp_frame_info *)) \
5960
MIX_LOADER_FUNCTION(true,void,xmp_stop_module,(xmp_context)) \
@@ -264,6 +265,7 @@ static bool SDLCALL XMP_seek(void *track_userdata, Uint64 frame)
264265
ms = 0;
265266
}
266267
const int err = libxmp.xmp_seek_time(tdata->ctx, (int) ms);
268+
libxmp.xmp_play_buffer(tdata->ctx, NULL, 0, 0); // reset the internal state.
267269
return err ? SetLibXmpError("xmp_seek_time", err) : true;
268270
}
269271

0 commit comments

Comments
 (0)