Takes a raw input stream containing frames with correct timestamps but
possibly out of order and inserts additional show-existing-frame
packets to correct the ordering.
(cherry picked from commit 34e051d168)
(cherry picked from commit b43b95f478)
Also converted from bitstream to get_bits.
It is useful for testing/debugging and will also be used as the default
filter in the following commit adding pre-decode filtering to avoid
having a separate non-filtered codepath.