Why not just run it through your sound system first, then to your TV?
My problem is that I don't have enough HDMI inputs on my sound system. I have quite a few on the TV. So once I hit that limit, I've had to run HDMI to the TV without digital optical output run over to my sound system. Then I use my Logitech remote to switch everything to the right input/output settings.