fixed codec header csid in interleaved mode
refactored
implemented wait_key
optimizations for atc case