Custom pull-mode source for audio player

I’m developing an audio player that needs to pull chunks from a remote resource with HTTP range requests and decrypt those chunks. I want to write a custom pull-mode source element for that. How would I do that?

You could write your own source element that handles the HTTP connection itself. Then you’re in charge of the range requests and can do the decryption in the source, or let a downstream element do the decryption. You could make a custom protocol like mycrypto+http:// for those streams to get it autoplugged by playbin(3) etc.

Alternatively, you could write a parser/demuxer style element that activates in pull mode and have a normal http source element upstream with a queue2 in ring buffer mode (set the ring-buffer-max-size property to a few MB or so, whatever is appropriate). Then your element can pull chunks in the right size using gst_pad_pull_range() (or via the API if you’re using GstBaseParse, depends on if you know the chunk sizes etc), and queue2 and the source will sort out the range requests between them.