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

diff -r f6680fa8e7ec -r 394c4b75e546 v4l2-apps/util/v4l2-ctl.cpp
--- a/v4l2-apps/util/v4l2-ctl.cpp	Tue Oct 20 00:08:05 2009 +0900
+++ b/v4l2-apps/util/v4l2-ctl.cpp	Wed Oct 21 16:14:12 2009 +0300
@@ -568,6 +568,24 @@ static std::string flags2s(unsigned val,
 	return s;
 }
 
+static const flag_def status_def[] = {
+	{V4L2_IN_ST_NO_POWER,"Attached device is off."},
+	{V4L2_IN_ST_NO_SIGNAL, "No signal"},
+	{V4L2_IN_ST_NO_COLOR, "The hardware supports color decoding, but does not detect color modulation in the signal."},
+	{V4L2_IN_ST_HFLIP, "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."},
+	{V4L2_IN_ST_VFLIP, "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"},
+	{V4L2_IN_ST_NO_H_LOCK, "No horizontal sync lock."},
+	{V4L2_IN_ST_COLOR_KILL, "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."},
+	{V4L2_IN_ST_NO_SYNC, "No synchronization lock."},
+	{V4L2_IN_ST_NO_EQU, "No equalizer lock."},
+	{V4L2_IN_ST_NO_CARRIER, "Carrier recovery failed."},
+	{V4L2_IN_ST_MACROVISION, "Macrovision is an analog copy prevention system mangling the video signal to confuse video recorders. When this flag is set Macrovision has been detected."},
+	{V4L2_IN_ST_NO_ACCESS, "Conditional access denied."},
+	{V4L2_IN_ST_VTR, "VTR time constant. [?]"},
+	{0, NULL}
+};
+
+
 static void print_sliced_vbi_cap(struct v4l2_sliced_vbi_cap &cap)
 {
 	printf("\tType           : %s\n", buftype2s(cap.type).c_str());
@@ -2671,6 +2689,11 @@ set_vid_fmt_error:
 			if (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
 				printf(" (%s)", vin.name);
 			printf("\n");
+			printf("Signal status: ");
+			if (vin.status)
+				printf("%s\n", flags2s(vin.status,status_def).c_str());
+			else
+				printf("Signal detected or detection unavailable\n");
 		}
 	}
 
