Move encode_{locally,remotely} into the frame encoder classes.