Custom decoder that also resamples

im trying to write a decoder that takes data in at one rate and format and outputs at another rate and format. as an example imagine the input is a U8 stream of packed bits and the output is effectively those bits separated as individual samples with some S16LE value. im using a test harness to validate its operation. i initially tried inheriting from an AudioDecoder but got a negotiation error when trying to push a buffer. i then thought maybe the BaseTransform class was more suitable but i couldne even get the harness to successfully link to my element.

tl;dr im wonder if what the optimal path would be for this use case and what critical virtual methods i might need to implement.

AudioDecoder would be the correct base class. Take a look at opusdec for how to implement the negotiation correctly. opusdec also resamples internally (Opus is always 48kHz but it can output a lower sample rate by downsampling if it is known that the original audio had a lower sample rate).

thanks for the quick response. i’ll check that example out.