Ticket #8337: vbi_cleanup.diff
File vbi_cleanup.diff, 2.6 KB (added by , 14 years ago) |
---|
-
mythtv/libs/libmythtv/vbitext/vbi.c
16 16 #include "vt.h" 17 17 #include "vbi.h" 18 18 #include "hamm.h" 19 #include "videodev_myth.h" 19 20 20 21 #define FAC (1<<16) // factor for fix-point arithmetic 21 22 22 23 static unsigned char *rawbuf; // one common buffer for raw vbi data. 23 24 static int rawbuf_size; // its current size 24 25 25 26 26 /***** bttv api *****/ 27 27 28 28 #define BASE_VIDIOCPRIVATE 192 29 29 #define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int) 30 30 #define BTTV_VBISIZE _IOR('v' , BASE_VIDIOCPRIVATE+8, int) 31 31 32 /***** v4l2 vbi-api *****/33 34 /* #include "/usr/src/linux/include/linux/videodev2.h" */35 36 enum v4l2_buf_type {37 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,38 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,39 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,40 V4L2_BUF_TYPE_VBI_CAPTURE = 4,41 V4L2_BUF_TYPE_VBI_OUTPUT = 5,42 V4L2_BUF_TYPE_PRIVATE = 0x80,43 };44 45 struct v4l2_vbi_format46 {47 unsigned int sampling_rate; /* in 1 Hz */48 unsigned int offset; /* sampling starts # samples after rising hs */49 unsigned int samples_per_line;50 unsigned int sample_format; /* V4L2_VBI_SF_* */51 signed int start[2];52 unsigned int count[2];53 unsigned int flags; /* V4L2_VBI_* */54 unsigned int reserved2; /* must be zero */55 };56 57 struct v4l2_format58 {59 enum v4l2_buf_type type; /* V4L2_BUF_TYPE_* */60 union61 {62 struct v4l2_vbi_format vbi; /* VBI data */63 unsigned char raw_data[200]; /* user-defined */64 } fmt;65 };66 67 #define V4L2_PIX_FMT_GREY 0x59455247 /* v4l2_fourcc('G','R','E','Y') *//* 8 Greyscale */68 #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)69 70 32 /***** end of api definitions *****/ 71 33 72 34 static void … … 572 534 #ifdef _WIN32 573 535 (void) vbi; 574 536 #else // if !_WIN32 575 struct v4l2_format v4l2_format [1];576 struct v4l2_vbi_format *vbifmt = &v4l2_format ->fmt.vbi;537 struct v4l2_format v4l2_format; 538 struct v4l2_vbi_format *vbifmt = &v4l2_format.fmt.vbi; 577 539 578 540 memset(&v4l2_format, 0, sizeof(v4l2_format)); 579 v4l2_format ->type = V4L2_BUF_TYPE_VBI_CAPTURE;580 if (ioctl(vbi->fd, VIDIOC_G_FMT, v4l2_format) == -1)541 v4l2_format.type = V4L2_BUF_TYPE_VBI_CAPTURE; 542 if (ioctl(vbi->fd, VIDIOC_G_FMT, &v4l2_format) == -1) 581 543 { 582 544 // not a v4l2 device. assume bttv and create a standard fmt-struct. 583 545 int size;