[opus] Decoding Opus File in Chunks

Thomas Daede tdaede at mozilla.com
Fri Apr 6 16:21:32 UTC 2018


You might want to take a look at the op_open_callbacks API:

https://opus-codec.org/docs/opusfile_api-0.7/group__stream__open__close.html#ga5b81c0b685f3d3c9c7d7091e5536c759

libopusfile will only call your provided read() function as needed. If
you don't implement the seeking functions, it will only read it in a
linear order.

On 04/06/2018 09:08 AM, Chris McGowan wrote:
> I would like to decode an Opus file in chunks (e.g. 16K byte array).  Is
> this possible with the Opusfile library or would I need to interface
> directly with libogg and libopus?  It seems like the Opusfile decoder
> functions maintain an internal pointer/state for OggOpusFile during
> multiple calls to op_read(OggOpusFile *_op ...) and a complete byte
> array of the entire Opus file would be needed.
> 
> Any help in pointing me in the right direction would be greatly
> appreciated.  Due to the nature of the chunks coming in and the need to
> obtain/assemble Opus packets before decoding, I'm aware that some
> buffering/assembly of the chunks may be needed, but I'm hoping to
> achieve this with a high-level API if possible.  I'm new to C, and this
> is for an educational WebAssembly demo for the web community.
> 
> I've successfully compiled opusfile and have been playing with the
> opusfile_example.c file, but those examples seem to be for complete
> files only.  I cannot use the native HTTP decoding features because of
> the need to process byte array chunks for this demo.
> 
> 
> 
> 
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
> 


More information about the opus mailing list