Canonical formulation of relativistic hydrodynamics