matroskadec: extract common code out of ebml_read_*()