Changed bitstream handling to allow in-memory bitstream.