Yes, headphone, microphone and line in presence detection is something that every smart phone does these days.
Basically, it just takes a bit of observation whether you see any relatively high voltages (say, above 50 mV), then there's an active signal driver (i.e. the line-out of a player, or a heaphone driver) attached.
For headphones vs microphone detection proprietary approaches exist, but my understanding is that they are basically DC and AC impedance measurement.
It's probably not hard to write software for a microcontroller that has an ADC and an analog signal switch to do that detection and then light up the LEDs you want.