added support for B-frames and multiple slices