summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-02-11 09:12:29 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-02-11 09:24:53 -0200
commitca09693ba2b82be416eaa0f9b6d4cd644bed514b (patch)
tree3f8edeba9938cfd2c753b4b61d2ee793411ce424
parentf7e6dcee73fe7bd95a1f9ae34018dbf4f2412f00 (diff)
Fix standard video size detection
video width/height size can vary not only as a function of the video standard but also in function of device capabilities. Due to that, the code were trying to get those info from the hardware. However, due to a driver bug, the info is not properly filled when the video standard is changed. While I intend to fix this inside the drivers, the current logic doesn't work with the current stable kernels. So, use an alternative way of getting this info, just using video standards information. Let's keep the not working code there, in order to make easy to return, after fixing the drivers. We'll probably need to check for driver versions after reenabling the correct (not working) code, or to use the new VIDIOC ioctl's to enumberate the supported formats. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--src/v4l.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/v4l.c b/src/v4l.c
index 7b3d538..10e782b 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -992,7 +992,6 @@ V4LBuildEncodings(PortPrivPtr p, int fd)
*/
for (inp = 0; inp < 256; inp++) {
struct v4l2_input input;
- struct v4l2_framebuffer fbuf;
memset(&input, 0, sizeof(input));
input.index = inp;
@@ -1002,6 +1001,14 @@ V4LBuildEncodings(PortPrivPtr p, int fd)
for (std = 0; std < num_std; std++) {
int width, height;
+ /*
+ * Currently, this code is not reliable, due to driver
+ * non-compliance on both saa7134 and bttv. So, instead,
+ * just use the video standard information
+ */
+#if 0
+ struct v4l2_framebuffer fbuf;
+
/* Some webcam drivers will fail here, but that's OK */
ioctl(fd, VIDIOC_S_STD, &p->standard[std].id);
@@ -1035,7 +1042,16 @@ V4LBuildEncodings(PortPrivPtr p, int fd)
width = format.fmt.pix.width;
}
}
+#else
+ if (p->standard[std].id & V4L2_STD_525_60) {
+ height = 480;
+ width = 640;
+ } else {
+ height = 576;
+ width = 768;
+ }
+#endif
/* Fixup for some driver bug */
if ((p->standard[std].id & V4L2_STD_525_60) && (height == 576))
height = 480;