The magnetic field and the location of the TeV emitter in Cygnus X-1 and LS 5039