Acoustic and elastic scattering by stratified media