[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-video
Subject:    saa7134 and alevt
From:       <braun () itwm ! fhg ! de>
Date:       2002-12-31 16:14:10
[Download RAW message or body]

Hello all

I am trying to get alevt-1.6.1 working with my Terratec Cinergy 600.
This card basically works otherwise (see the "Recording with SAA7134
card" thread), but alevt does not even initialize the card correctly
(silent failure without error message).
This is due to a recent change in some V4L2 ioctls. The patch below
makes alevt use the new values. but the pages are still corrupted -
(mix between the current page and the page before). This could be
a bug in saa7134, alevt or my patch. This is with latest saa7134
version dated 2002-12-28.
Comments and additional infos are welcome.

Cheers,

Martin Braun



["alevt-1.6.1-v4l2.patch" (application/octet-stream)]

diff -Naur alevt-1.6.1-dist/lang.h alevt-1.6.1/lang.h
--- alevt-1.6.1-dist/lang.h	1999-06-28 23:08:08.000000000 +0200
+++ alevt-1.6.1/lang.h	2002-12-31 16:54:22.000000000 +0100
@@ -19,4 +19,4 @@
 void add_enhance(struct enhance *eh, int dcode, u32 *data);
 void enhance(struct enhance *eh, struct vt_page *vtp);
 
-#endif LANG_H
+#endif /* LANG_H */
diff -Naur alevt-1.6.1-dist/vbi.c alevt-1.6.1/vbi.c
--- alevt-1.6.1-dist/vbi.c	2001-03-03 19:14:03.000000000 +0100
+++ alevt-1.6.1/vbi.c	2002-12-31 16:54:22.000000000 +0100
@@ -25,7 +25,7 @@
 #define BTTV_VBISIZE		_IOR('v' , BASE_VIDIOCPRIVATE+8, int)
 
 /***** v4l2 vbi-api *****/
-
+#if 0
 struct v4l2_vbi_format
 {
     u32 sampling_rate;		/* in 1 Hz */
@@ -52,6 +52,51 @@
 #define V4L2_BUF_TYPE_VBI       0x00000009
 #define VIDIOC_G_FMT		_IOWR('V',  4, struct v4l2_format)
 
+#else
+/*  Four-character-code (FOURCC) */
+#define v4l2_fourcc(a,b,c,d)\
+	(((u32)(a)<<0)|((u32)(b)<<8)|((u32)(c)<<16)|((u32)(d)<<24))
+
+enum v4l2_buf_type {
+	V4L2_BUF_TYPE_VIDEO_CAPTURE	= 1,
+	V4L2_BUF_TYPE_VIDEO_OUTPUT	= 2,
+	V4L2_BUF_TYPE_VIDEO_OVERLAY	= 3,
+	V4L2_BUF_TYPE_VBI_CAPTURE	= 4,
+	V4L2_BUF_TYPE_VBI_OUTPUT	= 5,
+	V4L2_BUF_TYPE_PRIVATE		= 0x80,
+};
+
+struct v4l2_vbi_format
+{
+	u32	sampling_rate;	/* in 1 Hz */
+	u32	offset;
+	u32	samples_per_line;
+	u32	sample_format;	/* V4L2_PIX_FMT_* */
+	s32	start[2];
+	u32	count[2];
+	u32	flags;		/* V4L2_VBI_* */
+	u32	reserved[2];	/* must be zero */
+};
+
+struct v4l2_format
+{
+	enum v4l2_buf_type type;
+	union
+	{
+/* not needed */
+#if 0
+		struct v4l2_pix_format	pix;  /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
+		struct v4l2_window	win;  /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
+#endif
+		struct v4l2_vbi_format	vbi;  /* V4L2_BUF_TYPE_VBI_CAPTURE */
+		u8	raw_data[200];        /* user-defined */
+	} fmt;
+};
+
+#define V4L2_PIX_FMT_GREY	v4l2_fourcc('G','R','E','Y') /*  8  Greyscale     */
+#define VIDIOC_G_FMT		_IOWR('V',  4, struct v4l2_format)
+
+#endif
 /***** end of api definitions *****/
 
 
@@ -468,7 +513,11 @@
     int soc, eoc;	// start/end of clock run-in
     int bpl;		// bytes per line
 
+#if 0
     if (p->sample_format != V4L2_VBI_SF_UBYTE)
+#else
+    if (p->sample_format != V4L2_PIX_FMT_GREY)
+#endif
     {
 	error("v4l2: unsupported vbi data format");
 	return -1;
@@ -526,13 +575,24 @@
     struct v4l2_format v4l2_format[1];
     struct v4l2_vbi_format *vbifmt = &v4l2_format->fmt.vbi;
 
+#if 0
     if (ioctl(vbi->fd, VIDIOC_G_FMT, v4l2_format) == -1
 	|| v4l2_format->type != V4L2_BUF_TYPE_VBI)
+#else
+    memset (v4l2_format, 0, sizeof(struct v4l2_format));
+    v4l2_format->type = V4L2_BUF_TYPE_VBI_CAPTURE;
+    if (ioctl(vbi->fd, VIDIOC_G_FMT, v4l2_format) == -1
+	|| v4l2_format->type != V4L2_BUF_TYPE_VBI_CAPTURE)
+#endif
     {
 	// not a v4l2 device.  assume bttv and create a standard fmt-struct.
 	int size;
 
+#if 0
 	vbifmt->sample_format = V4L2_VBI_SF_UBYTE;
+#else
+	vbifmt->sample_format = V4L2_PIX_FMT_GREY;
+#endif
 	vbifmt->sampling_rate = 35468950;
 	vbifmt->samples_per_line = 2048;
 	vbifmt->offset = 244;

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/video4linux-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic