That might be a better solution than just checking the amplituide, since you won't know if you have a line in until the signal gets positively above a certain level for a short time (longer than any possible transient). And if the level goes down, it will up the gain once more... Bad solution.Line in is usually 10k ohms, I think.
Mic in will be much lower for dynamic or electret mic.