Quantum memory is a key element for quantum repeaters and linear optical quantum computers. In addition to memory, repeaters and computers also require manipulating quantum states by means of unitary transformations, which is generally accomplished using interferometric optical setups. We experimentally investigate photon-echo type atom-light interaction for the possibility to combine storage with controlled transformation of quantum states. As an example, we demonstrate unambiguous state discrimination of qubits and qutrits in an Ti:Er:LiNbO$_3$ waveguide cooled to 3K using states encoded into large ensembles of identically prepared photons in superposition of different temporal modes. The high robustness and flexibility of our approach makes it promising for quantum communication and computation as well as precision measurements.