[opus] Question about libopusfile downloading the last 64K when duration is not needed

Ian Reed info at blindaudiogames.com
Thu Nov 15 06:59:15 UTC 2018


I am writing a program that retrieves and plays .opus files over the 
network.
I am using the C# PInvoke wrapper OpusFileSharp, which calls into 
libopusfile and passes callbacks for read, seek, and tell.
I want to enable seeking via the seek callback by not returning -1, but 
I find that as soon as I do libopusfile requests the last 64K of the 
.opus file, probably so it can calculate the duration.
My program already knows the duration of each .opus file, so I would 
rather not have libopusfile download an extra 64K of every .opus file to 
discover it.

I've read your FAQ here:
https://wiki.xiph.org/index.php?title=OpusFAQ&mobileaction=toggle_view_desktop
It explains why libopusfile requires the last 64K to calculate the 
duration, but again, I don't need libopusfile to get the duration for 
me, I only want it to allow me to seek within parts of the file that 
have already been downloaded.

Is there a reason libopusfile forces the retrieval of the last 64K of 
the file when seeking is enabled, but without ever being asked for the 
duration?

Thanks,
Ian Reed



More information about the opus mailing list