Ticket #8337: vbi_cleanup.diff

File vbi_cleanup.diff, 2.6 KB (added by anonymous, 14 years ago)
  • mythtv/libs/libmythtv/vbitext/vbi.c

     
    1616#include "vt.h"
    1717#include "vbi.h"
    1818#include "hamm.h"
     19#include "videodev_myth.h"
    1920
    2021#define FAC    (1<<16)         // factor for fix-point arithmetic
    2122
    2223static unsigned char *rawbuf;          // one common buffer for raw vbi data.
    2324static int rawbuf_size;                // its current size
    2425
    25 
    2626/***** bttv api *****/
    2727
    2828#define BASE_VIDIOCPRIVATE     192
    2929#define BTTV_VERSION           _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
    3030#define BTTV_VBISIZE           _IOR('v' , BASE_VIDIOCPRIVATE+8, int)
    3131
    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_format
    46 {
    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_format
    58 {
    59     enum v4l2_buf_type type;                   /* V4L2_BUF_TYPE_* */
    60     union
    61     {
    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 
    7032/***** end of api definitions *****/
    7133
    7234static void
     
    572534#ifdef _WIN32
    573535    (void) vbi;
    574536#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;
    577539
    578540    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)
    581543    {
    582544       // not a v4l2 device.  assume bttv and create a standard fmt-struct.
    583545       int size;