Use state machine to parse SRT