Refactor video decoder