Use a proper stack for the buffer_t's pointers
Refactor stream codec functions

It now provides simplified versions of parameters by default, and
exposes the more advanced parameters in a similar way to OpenGL calls.