FLAC File Seek

Started by Guilain,

Guilain

On a FLAC decode stream, BASS_ChannelGetPosition() returns 0 after a successful BASS_ChannelSetPosition(), and BASS_ChannelGetLength() returns the remaining length instead of the total — the seek itself works, only the reported position and length get rebased on the seek point. The same code on an equivalent WAV returns 20 s and 60 s as expected, so I'd like to know whether this is intended behaviour for add-on streams and whether there's a supported way to get absolute positions.
Thanks !

Ian @ un4seen

No, that doesn't sound normal. Are you having the problem with all FLAC files or only one/some? If the latter, please upload it to have a look at here:

    ftp://ftp.un4seen.com/incoming/

Please also confirm what BASS and BASSFLAC versions you're using, and on what platform.

Guilain

Hi Ian,
I've uploaded C source and one flac file.
Version are :
* bass.dll 2.4.18
* bassflac.dll 2.4.6
* Windows 11 - amd64
Thanks,
Guilain

Ian @ un4seen

Your code and FLAC file seem to be working fine here:

length before seek : 60.000 s
SetPosition(20 s)  : TRUE (error 0)
GetPosition        : 20.000 s
length after seek  : 60.000 s

Please try upgrading to the latest BASS (2.4.18.3) and BASSFLAC (2.4.6.1), and if that doesn't help, also check whether the BASS_PluginLoad call is successful. If BASSFLAC isn't loaded then the Media Foundation FLAC decoder would be used (although that shouldn't have this problem either) - you can confirm what decoder is used by checking the "ctype" value with BASS_ChannelGetInfo.

Guilain

Thanks Ian,

You were right on both counts: ctype confirmed the real BASSFLAC decoder (0x10900, not Media Foundation), and the versions were the culprit: we were on BASS 2.4.18.0 / BASSFLAC 2.4.6.0. Upgrading to 2.4.18.3 / 2.4.6.1 fixes it. Position now reads back 20s000ms and length stays 60s000ms after the seek.

Cross-testing the four combinations shows the fix is in BASSFLAC 2.4.6.1 specifically (old bass + new bassflac works; new bass + old bassflac still rebases).

Sorry for the noise, and thanks for the quick reply - might be worth a note in the bassflac history for 2.4.6.1, since the symptom is quite confusing when you hit it.

Ian @ un4seen

Good to hear the BASSFLAC upgrade fixed the problem. I see the BASSFLAC 2.4.16 release did introduce this issue when seeking before there's been any decoding, and so 2.4.16.1 was released soon after to correct that.