# HG changeset patch
# User root@localhost
# Date 1256130852 -10800
# Node ID b335284d31a3fa85f1bb2a94956045bcb2e7c2c2
# Parent  7e273bee86017aa1568bb92e6f717eb585561578
changed --get-input to parse and output the status field of VIDIOC_ENUMINPUT
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>

diff -r 7e273bee8601 -r b335284d31a3 v4l2-apps/util/v4l2-ctl.cpp
--- a/v4l2-apps/util/v4l2-ctl.cpp	Wed Oct 21 16:11:09 2009 +0300
+++ b/v4l2-apps/util/v4l2-ctl.cpp	Wed Oct 21 16:14:12 2009 +0300
@@ -572,6 +572,44 @@ static std::string flags2s(unsigned val,
 	return s;
 }
 
+static std::string status2s(__u32 status)
+{
+	switch (status) {
+	case 0:
+		return "Signal OK";
+	case V4L2_IN_ST_NO_POWER:
+		return "Attached device is off.";
+	case V4L2_IN_ST_NO_SIGNAL:
+		return "No signal";
+	case V4L2_IN_ST_NO_COLOR:
+		return "The hardware supports color decoding, but does not detect color modulation in the signal.";
+	case V4L2_IN_ST_HFLIP:
+		return "The input is connected to a device that produces a signal that is flipped horizontally and does not correct this before passing the signal to userspace.";
+	case V4L2_IN_ST_VFLIP:
+		return "The input is connected to a device that produces a signal that is flipped vertically and does not correct this before passing the signal to userspace. Note that a 180 degree rotation is the same as HFLIP | VFLIP";
+	case V4L2_IN_ST_NO_H_LOCK:
+		return "No horizontal sync lock.";
+	case V4L2_IN_ST_COLOR_KILL:
+		return "A color killer circuit automatically disables color decoding when it detects no color modulation. When this flag is set the color killer is enabled and has shut off color decoding.";
+	case V4L2_IN_ST_NO_SYNC:
+		return "No synchronization lock.";
+	case V4L2_IN_ST_NO_EQU:
+		return "No equalizer lock.";
+	case V4L2_IN_ST_NO_CARRIER:
+		return "Carrier recovery failed.";
+	case V4L2_IN_ST_MACROVISION:
+		return "Macrovision is an analog copy prevention system mangling the video signal to confuse video recorders. When this flag is set Macrovision has been detected.";
+	case V4L2_IN_ST_NO_ACCESS:
+		return "Conditional access denied.";
+	case V4L2_IN_ST_VTR:
+		return "VTR time constant. [?]";
+	default:
+		char msg[20];
+		sprintf(msg, "unknown(%d)", status);
+		return msg;
+	}
+}
+
 static void print_sliced_vbi_cap(struct v4l2_sliced_vbi_cap &cap)
 {
 	printf("\tType           : %s\n", buftype2s(cap.type).c_str());
@@ -2707,7 +2745,7 @@ set_vid_fmt_error:
 			printf("Video input : %d", input);
 			vin.index = input;
 			if (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
-				printf(" (%s)", vin.name);
+				printf(" (%s: %s)", vin.name, status2s(vin.status).c_str());
 			printf("\n");
 		}
 	}
