Ticket #2044: v4l2_mpeg.diff

File v4l2_mpeg.diff, 31.7 KB (added by Janne <janne-mythtv@…>, 13 years ago)
  • libs/libmythtv/mpegrecorder.cpp

    old new bool MpegRecorder::OpenV4L2DeviceAsInput 
    319319        return false;
    320320    }
    321321
     322    struct v4l2_control ctrl;
     323    ctrl.id = V4L2_CID_AUDIO_VOLUME;
     324    ctrl.value = 65536 / 100 *audvolume;
     325
     326    if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
     327    {
     328        VERBOSE(VB_IMPORTANT, LOC_WARN +
     329                        "Unable to set recording volume" + ENO);
     330        VERBOSE(VB_IMPORTANT, LOC_WARN +
     331                        "If you are using an AverMedia M179 card this is normal.");
     332    }
     333    if (!SetIVTVDeviceOptions(chanfd) && !SetV4L2DeviceOptions(chanfd))
     334        return false;
     335
     336    readfd = open(videodevice.ascii(), O_RDWR | O_NONBLOCK);
     337    if (readfd < 0)
     338    {
     339        VERBOSE(VB_IMPORTANT, LOC_ERR + "Can't open video device." + ENO);
     340        return false;
     341    }
     342
     343    return true;
     344}
     345
     346bool MpegRecorder::SetIVTVDeviceOptions(int chanfd)
     347{
    322348    struct ivtv_ioctl_codec ivtvcodec;
    323349    bzero(&ivtvcodec, sizeof(ivtvcodec));
    324350
    325351    if (ioctl(chanfd, IVTV_IOC_G_CODEC, &ivtvcodec) < 0)
    326352    {
    327         VERBOSE(VB_IMPORTANT, LOC_ERR + "Error getting codec params" + ENO);
     353        //silence the warning in the case that the ioctl isn't supported,
     354        //means probably that it supports the v4l2 mpeg encoder api
     355        if (errno != 22)
     356            VERBOSE(VB_IMPORTANT, LOC_ERR + "Error getting codec params" + ENO);
    328357        return false;
    329358    }
    330359
    331     // only 48kHz works properly.
     360// only 48kHz works properly.
    332361    int audio_rate = 1;
    333362
    334363/*
    bool MpegRecorder::OpenV4L2DeviceAsInput 
    385414    if (ivtvcodec.framerate)
    386415        keyframedist = 12;
    387416
    388     struct v4l2_control ctrl;
    389     ctrl.id = V4L2_CID_AUDIO_VOLUME;
    390     ctrl.value = 65536 / 100 *audvolume;
    391 
    392     if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
    393     {
    394         VERBOSE(VB_IMPORTANT, LOC_WARN +
    395                         "Unable to set recording volume" + ENO);
    396         VERBOSE(VB_IMPORTANT, LOC_WARN +
    397                         "If you are using an AverMedia M179 card this is normal.");
    398     }
    399 
    400417    if (vbimode)
    401418    {
    402419        struct ivtv_sliced_vbi_format vbifmt;
    bool MpegRecorder::OpenV4L2DeviceAsInput 
    432449                .arg(vbifmt.service_set).arg(vbifmt.packet_size)
    433450                .arg(vbifmt.io_size));
    434451    }
     452    return true;
     453}
    435454
    436     readfd = open(videodevice.ascii(), O_RDWR | O_NONBLOCK);
    437     if (readfd < 0)
     455static void set_v4l2_ext_control(struct v4l2_ext_control *ctrl, uint32_t id, int32_t value)
     456{
     457    ctrl->id    = id;
     458    ctrl->value = value;
     459}
     460
     461bool MpegRecorder::SetV4L2DeviceOptions(int chanfd)
     462{
     463    int c = 0, noCtrls = 7;
     464    struct v4l2_ext_control *ext_ctrl = NULL;
     465    ext_ctrl = (struct v4l2_ext_control *)calloc(noCtrls, sizeof(struct v4l2_ext_control));
     466
     467    // only 48kHz works properly.
     468    set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000);
     469
     470    set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_VIDEO_ASPECT, aspectratio-1);
     471
     472    set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_AUDIO_ENCODING, audtype-1);
     473
     474    if (audtype == 2)
    438475    {
    439         VERBOSE(VB_IMPORTANT, LOC_ERR + "Can't open video device." + ENO);
     476        if (audbitratel2 < 10)
     477            audbitratel2 = 10;
     478        set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_AUDIO_L2_BITRATE, audbitratel2-1);
     479    }
     480    else
     481    {
     482        VERBOSE(VB_IMPORTANT, LOC_WARN + "MPEG Layer1 is not working properly"
     483                "and will probably removed from ivtv with 0.8");
     484        if (audbitratel1 < 6)
     485            audbitratel1 = 6;
     486        // forcing MPEG Audio layer 2, bitrates are compatible
     487        set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_AUDIO_L2_BITRATE, audbitratel1-1);
     488    }
     489
     490    if (bitrate > maxbitrate)
     491        bitrate = maxbitrate;
     492    set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_VIDEO_BITRATE, bitrate * 1000);
     493    set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, maxbitrate * 1000);
     494
     495    // framerate (1 = 25fps, 0 = 30fps)
     496    //ivtvcodec.framerate = (!ntsc_framerate);
     497
     498    // force MPEG2 program streams
     499    set_v4l2_ext_control(&ext_ctrl[c++], V4L2_CID_MPEG_STREAM_TYPE, V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
     500
     501    struct v4l2_ext_controls ctrls;
     502    ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
     503    ctrls.count      = c;
     504    ctrls.controls   = ext_ctrl;
     505    if (ioctl(chanfd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0)
     506    {
     507        if (ctrls.error_idx >= ctrls.count)
     508            VERBOSE(VB_IMPORTANT, LOC_WARN + "Error setting MPEG controls" + ENO);
     509        else
     510            VERBOSE(VB_IMPORTANT, LOC_WARN + QString("Error setting MPEG control no. %1 to %2")
     511                            .arg(ctrls.error_idx).arg(ext_ctrl[ctrls.error_idx].value) + ENO);
     512
     513        free(ext_ctrl);
    440514        return false;
    441515    }
     516    free(ext_ctrl);
     517
     518    struct v4l2_ext_control keyfrctrl;
     519    keyfrctrl.id =  V4L2_CID_MPEG_VIDEO_GOP_SIZE;
     520    ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
     521    ctrls.count      = 1;
     522    ctrls.controls   = &keyfrctrl;
     523    if (ioctl(chanfd, VIDIOC_G_EXT_CTRLS, &ctrls) < 0)
     524    {
     525        VERBOSE(VB_IMPORTANT, LOC_WARN +
     526                        "Unable to get V4L2_CID_MPEG_VIDEO_GOP_SIZE, defaulting to 12" + ENO);
     527        keyframedist = 12;
     528    }
     529    else
     530        keyframedist = keyfrctrl.value;
     531
     532    // vbi is currently (2006-07-11) not working
     533    // since ivtv trunk doesn't implement V4L2_CID_MPEG_STREAM_VBI_FMT yet
     534    if (vbimode)
     535    {
     536        struct v4l2_format vbifmt;
     537        bzero(&vbifmt, sizeof(struct v4l2_format));
     538        //struct v4l2_sliced_vbi_format vbifmt;
     539        //bzero(&vbifmt, sizeof(struct v4l2_sliced_vbi_format));
     540        vbifmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
     541        //vbifmt.fmt.sliced.service_set = (1==vbimode) ? VBI_TYPE_TELETEXT : VBI_TYPE_CC;
     542        if (1 == vbimode)
     543            vbifmt.fmt.sliced.service_set |= V4L2_SLICED_VBI_625;
     544        else
     545            vbifmt.fmt.sliced.service_set |= V4L2_SLICED_VBI_525;
     546
     547        if (ioctl(chanfd, VIDIOC_S_FMT, &vbifmt) < 0)
     548        {
     549            VERBOSE(VB_IMPORTANT, "Can't enable VBI recording" + ENO);
     550        }
     551
     552        struct v4l2_ext_control vbi_fmt;
     553        vbi_fmt.id    = V4L2_CID_MPEG_STREAM_VBI_FMT;
     554        vbi_fmt.value = V4L2_MPEG_STREAM_VBI_FMT_IVTV;
     555        ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
     556        ctrls.count      = 1;
     557        ctrls.controls   = &vbi_fmt;
     558        if (ioctl(chanfd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0)
     559        {
     560            VERBOSE(VB_IMPORTANT, LOC + "Can't enable VBI recording (2)"+ENO);
     561        }
     562
     563        ioctl(chanfd, VIDIOC_G_FMT, &vbifmt);
     564
     565        VERBOSE(VB_RECORD, LOC + QString(
     566                "VBI service:%1, packet size:2, io size:%3")
     567                .arg(vbifmt.fmt.sliced.service_set)
     568                //.arg(vbifmt.fmt.sliced.packet_size)
     569                .arg(vbifmt.fmt.sliced.io_size));
     570    }
    442571
    443572    return true;
    444573}
    445574
     575
    446576bool MpegRecorder::Open(void)
    447577{
    448578    if (deviceIsMpegFile)
  • libs/libmythtv/videodev2_myth.h

    old new enum v4l2_buf_type { 
    9090        V4L2_BUF_TYPE_VIDEO_OVERLAY      = 3,
    9191        V4L2_BUF_TYPE_VBI_CAPTURE        = 4,
    9292        V4L2_BUF_TYPE_VBI_OUTPUT         = 5,
    93 #if 1
     93#if 1 /*KEEP*/
    9494        /* Experimental Sliced VBI */
    9595        V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
    9696        V4L2_BUF_TYPE_SLICED_VBI_OUTPUT  = 7,
    enum v4l2_ctrl_type { 
    103103        V4L2_CTRL_TYPE_BOOLEAN       = 2,
    104104        V4L2_CTRL_TYPE_MENU          = 3,
    105105        V4L2_CTRL_TYPE_BUTTON        = 4,
     106        V4L2_CTRL_TYPE_INTEGER64     = 5,
     107        V4L2_CTRL_TYPE_CTRL_CLASS    = 6,
    106108};
    107109
    108110enum v4l2_tuner_type {
    struct v4l2_capability 
    184186#define V4L2_CAP_VIDEO_OVERLAY          0x00000004  /* Can do video overlay */
    185187#define V4L2_CAP_VBI_CAPTURE            0x00000010  /* Is a raw VBI capture device */
    186188#define V4L2_CAP_VBI_OUTPUT             0x00000020  /* Is a raw VBI output device */
    187 #if 1
     189#if 1 /*KEEP*/
    188190#define V4L2_CAP_SLICED_VBI_CAPTURE     0x00000040  /* Is a sliced VBI capture device */
    189191#define V4L2_CAP_SLICED_VBI_OUTPUT      0x00000080  /* Is a sliced VBI output device */
    190192#endif
    struct v4l2_capability 
    201203/*
    202204 *      V I D E O   I M A G E   F O R M A T
    203205 */
    204 
    205206struct v4l2_pix_format
    206207{
    207208        __u32                   width;
    struct v4l2_pix_format 
    214215        __u32                   priv;           /* private data, depends on pixelformat */
    215216};
    216217
    217 /*           Pixel format    FOURCC                  depth  Description   */
     218/*      Pixel format         FOURCC                        depth  Description  */
    218219#define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R','G','B','1') /*  8  RGB-3-3-2     */
    219220#define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R','G','B','O') /* 16  RGB-5-5-5     */
    220221#define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R','G','B','P') /* 16  RGB-5-6-5     */
    struct v4l2_pix_format 
    242243#define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y','U','1','2') /* 12  YUV 4:2:0     */
    243244#define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y','Y','U','V') /* 16  YUV 4:2:2     */
    244245#define V4L2_PIX_FMT_HI240   v4l2_fourcc('H','I','2','4') /*  8  8-bit color   */
     246#define V4L2_PIX_FMT_HM12    v4l2_fourcc('H','M','1','2') /*  8  YUV 4:1:1 16x16 macroblocks */
    245247
    246248/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
    247249#define V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B','A','8','1') /*  8  BGBG.. GRGR.. */
    struct v4l2_pix_format 
    250252#define V4L2_PIX_FMT_MJPEG    v4l2_fourcc('M','J','P','G') /* Motion-JPEG   */
    251253#define V4L2_PIX_FMT_JPEG     v4l2_fourcc('J','P','E','G') /* JFIF JPEG     */
    252254#define V4L2_PIX_FMT_DV       v4l2_fourcc('d','v','s','d') /* 1394          */
    253 #define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M','P','E','G') /* MPEG          */
     255#define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4    */
    254256
    255257/*  Vendor-specific formats   */
    256258#define V4L2_PIX_FMT_WNVA     v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
    257259#define V4L2_PIX_FMT_SN9C10X  v4l2_fourcc('S','9','1','0') /* SN9C10x compression */
    258260#define V4L2_PIX_FMT_PWC1     v4l2_fourcc('P','W','C','1') /* pwc older webcam */
    259261#define V4L2_PIX_FMT_PWC2     v4l2_fourcc('P','W','C','2') /* pwc newer webcam */
     262#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */
    260263
    261264/*
    262265 *      F O R M A T   E N U M E R A T I O N
    struct v4l2_fmtdesc 
    273276
    274277#define V4L2_FMT_FLAG_COMPRESSED 0x0001
    275278
    276 
    277279/*
    278280 *      T I M E C O D E
    279281 */
    struct v4l2_timecode 
    303305#define V4L2_TC_USERBITS_8BITCHARS      0x0008
    304306/* The above is based on SMPTE timecodes */
    305307
    306 
     308#ifdef __KERNEL__
    307309/*
    308310 *      M P E G   C O M P R E S S I O N   P A R A M E T E R S
    309311 *
    310  *  ### WARNING: this is still work-in-progress right now, most likely
    311  *  ###          there will be some incompatible changes.
     312 *  ### WARNING: This experimental MPEG compression API is obsolete.
     313 *  ###          It is replaced by the MPEG controls API.
     314 *  ###          This old API will disappear in the near future!
    312315 *
    313316 */
    314 
    315 
    316317enum v4l2_bitrate_mode {
    317318        V4L2_BITRATE_NONE = 0,  /* not specified */
    318319        V4L2_BITRATE_CBR,       /* constant bitrate */
    struct v4l2_mpeg_compression { 
    393394        /* I don't expect the above being perfect yet ;) */
    394395        __u32                           reserved_5[8];
    395396};
     397#endif
    396398
    397399struct v4l2_jpegcompression
    398400{
    struct v4l2_jpegcompression 
    424426                                        * allways use APP0 */
    425427};
    426428
    427 
    428429/*
    429430 *      M E M O R Y - M A P P I N G   B U F F E R S
    430431 */
    struct v4l2_framebuffer 
    493494struct v4l2_clip
    494495{
    495496        struct v4l2_rect        c;
    496         struct v4l2_clip        *next;
     497        struct v4l2_clip        __user *next;
    497498};
    498499
    499500struct v4l2_window
    struct v4l2_window 
    506507        void                    __user *bitmap;
    507508};
    508509
    509 
    510510/*
    511511 *      C A P T U R E   P A R A M E T E R S
    512512 */
    struct v4l2_captureparm 
    519519        __u32              readbuffers;   /*  # of buffers for read */
    520520        __u32              reserved[4];
    521521};
     522
    522523/*  Flags for 'capability' and 'capturemode' fields */
    523524#define V4L2_MODE_HIGHQUALITY   0x0001  /*  High quality imaging mode */
    524525#define V4L2_CAP_TIMEPERFRAME   0x1000  /*  timeperframe field is supported */
    struct v4l2_outputparm 
    536537/*
    537538 *      I N P U T   I M A G E   C R O P P I N G
    538539 */
    539 
    540540struct v4l2_cropcap {
    541541        enum v4l2_buf_type      type;
    542542        struct v4l2_rect        bounds;
    typedef __u64 v4l2_std_id; 
    573573#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
    574574#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
    575575#define V4L2_STD_NTSC_443       ((v4l2_std_id)0x00004000)
     576#define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)
    576577
    577578#define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
    578579#define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
    typedef __u64 v4l2_std_id; 
    587588#define V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
    588589#define V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
    589590
     591/* some merged standards */
     592#define V4L2_STD_MN     (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
     593#define V4L2_STD_B      (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
     594#define V4L2_STD_GH     (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
     595#define V4L2_STD_DK     (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
     596
    590597/* some common needed stuff */
    591598#define V4L2_STD_PAL_BG         (V4L2_STD_PAL_B         |\
    592599                                 V4L2_STD_PAL_B1        |\
    typedef __u64 v4l2_std_id; 
    599606                                 V4L2_STD_PAL_H         |\
    600607                                 V4L2_STD_PAL_I)
    601608#define V4L2_STD_NTSC           (V4L2_STD_NTSC_M        |\
    602                                  V4L2_STD_NTSC_M_JP)
     609                                 V4L2_STD_NTSC_M_JP     |\
     610                                 V4L2_STD_NTSC_M_KR)
    603611#define V4L2_STD_SECAM_DK       (V4L2_STD_SECAM_D       |\
    604612                                 V4L2_STD_SECAM_K       |\
    605613                                 V4L2_STD_SECAM_K1)
    typedef __u64 v4l2_std_id; 
    607615                                 V4L2_STD_SECAM_G       |\
    608616                                 V4L2_STD_SECAM_H       |\
    609617                                 V4L2_STD_SECAM_DK      |\
    610                                  V4L2_STD_SECAM_L)
     618                                 V4L2_STD_SECAM_L       |\
     619                                 V4L2_STD_SECAM_LC)
    611620
    612621#define V4L2_STD_525_60         (V4L2_STD_PAL_M         |\
    613622                                 V4L2_STD_PAL_60        |\
    struct v4l2_standard 
    634643        __u32                reserved[4];
    635644};
    636645
    637 
    638646/*
    639647 *      V I D E O   I N P U T S
    640648 */
    struct v4l2_input 
    649657        __u32        status;
    650658        __u32        reserved[4];
    651659};
     660
    652661/*  Values for the 'type' field */
    653662#define V4L2_INPUT_TYPE_TUNER           1
    654663#define V4L2_INPUT_TYPE_CAMERA          2
    struct v4l2_control 
    699708        __s32                value;
    700709};
    701710
     711struct v4l2_ext_control
     712{
     713        __u32 id;
     714        __u32 reserved2[2];
     715        union {
     716                __s32 value;
     717                __s64 value64;
     718                void *reserved;
     719        };
     720};
     721
     722struct v4l2_ext_controls
     723{
     724        __u32 ctrl_class;
     725        __u32 count;
     726        __u32 error_idx;
     727        __u32 reserved[2];
     728        struct v4l2_ext_control *controls;
     729};
     730
     731/*  Values for ctrl_class field */
     732#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
     733#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
     734
     735#define V4L2_CTRL_ID_MASK         (0x0fffffff)
     736#define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
     737#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
     738
    702739/*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
    703740struct v4l2_queryctrl
    704741{
    struct v4l2_querymenu 
    725762/*  Control flags  */
    726763#define V4L2_CTRL_FLAG_DISABLED         0x0001
    727764#define V4L2_CTRL_FLAG_GRABBED          0x0002
    728 
    729 /*  Control IDs defined by V4L2 */
    730 #define V4L2_CID_BASE                   0x00980900
     765#define V4L2_CTRL_FLAG_READ_ONLY        0x0004
     766#define V4L2_CTRL_FLAG_UPDATE           0x0008
     767#define V4L2_CTRL_FLAG_INACTIVE         0x0010
     768#define V4L2_CTRL_FLAG_SLIDER           0x0020
     769
     770/*  Query flag, to be ORed with the control ID */
     771#define V4L2_CTRL_FLAG_NEXT_CTRL        0x80000000
     772
     773/*  User-class control IDs defined by V4L2 */
     774#define V4L2_CID_BASE                   (V4L2_CTRL_CLASS_USER | 0x900)
     775#define V4L2_CID_USER_BASE              V4L2_CID_BASE
    731776/*  IDs reserved for driver specific controls */
    732777#define V4L2_CID_PRIVATE_BASE           0x08000000
    733778
     779#define V4L2_CID_USER_CLASS             (V4L2_CTRL_CLASS_USER | 1)
    734780#define V4L2_CID_BRIGHTNESS             (V4L2_CID_BASE+0)
    735781#define V4L2_CID_CONTRAST               (V4L2_CID_BASE+1)
    736782#define V4L2_CID_SATURATION             (V4L2_CID_BASE+2)
    struct v4l2_querymenu 
    757803#define V4L2_CID_VCENTER                (V4L2_CID_BASE+23)
    758804#define V4L2_CID_LASTP1                 (V4L2_CID_BASE+24) /* last CID + 1 */
    759805
     806/*  MPEG-class control IDs defined by V4L2 */
     807#define V4L2_CID_MPEG_BASE                      (V4L2_CTRL_CLASS_MPEG | 0x900)
     808#define V4L2_CID_MPEG_CLASS                     (V4L2_CTRL_CLASS_MPEG | 1)
     809
     810/*  MPEG streams */
     811#define V4L2_CID_MPEG_STREAM_TYPE               (V4L2_CID_MPEG_BASE+0)
     812enum v4l2_mpeg_stream_type {
     813        V4L2_MPEG_STREAM_TYPE_MPEG2_PS   = 0, /* MPEG-2 program stream */
     814        V4L2_MPEG_STREAM_TYPE_MPEG2_TS   = 1, /* MPEG-2 transport stream */
     815        V4L2_MPEG_STREAM_TYPE_MPEG1_SS   = 2, /* MPEG-1 system stream */
     816        V4L2_MPEG_STREAM_TYPE_MPEG2_DVD  = 3, /* MPEG-2 DVD-compatible stream */
     817        V4L2_MPEG_STREAM_TYPE_MPEG1_VCD  = 4, /* MPEG-1 VCD-compatible stream */
     818        V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
     819};
     820#define V4L2_CID_MPEG_STREAM_PID_PMT            (V4L2_CID_MPEG_BASE+1)
     821#define V4L2_CID_MPEG_STREAM_PID_AUDIO          (V4L2_CID_MPEG_BASE+2)
     822#define V4L2_CID_MPEG_STREAM_PID_VIDEO          (V4L2_CID_MPEG_BASE+3)
     823#define V4L2_CID_MPEG_STREAM_PID_PCR            (V4L2_CID_MPEG_BASE+4)
     824#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO       (V4L2_CID_MPEG_BASE+5)
     825#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO       (V4L2_CID_MPEG_BASE+6)
     826#define V4L2_CID_MPEG_STREAM_VBI_FMT            (V4L2_CID_MPEG_BASE+7)
     827enum v4l2_mpeg_stream_vbi_fmt {
     828        V4L2_MPEG_STREAM_VBI_FMT_NONE = 0,  /* No VBI in the MPEG stream */
     829        V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1,  /* VBI in private packets, IVTV format */
     830};
     831
     832/*  MPEG audio */
     833#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ       (V4L2_CID_MPEG_BASE+100)
     834enum v4l2_mpeg_audio_sampling_freq {
     835        V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
     836        V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
     837        V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
     838};
     839#define V4L2_CID_MPEG_AUDIO_ENCODING            (V4L2_CID_MPEG_BASE+101)
     840enum v4l2_mpeg_audio_encoding {
     841        V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
     842        V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
     843        V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
     844};
     845#define V4L2_CID_MPEG_AUDIO_L1_BITRATE          (V4L2_CID_MPEG_BASE+102)
     846enum v4l2_mpeg_audio_l1_bitrate {
     847        V4L2_MPEG_AUDIO_L1_BITRATE_32K  = 0,
     848        V4L2_MPEG_AUDIO_L1_BITRATE_64K  = 1,
     849        V4L2_MPEG_AUDIO_L1_BITRATE_96K  = 2,
     850        V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
     851        V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
     852        V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
     853        V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
     854        V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
     855        V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
     856        V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
     857        V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
     858        V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
     859        V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
     860        V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
     861};
     862#define V4L2_CID_MPEG_AUDIO_L2_BITRATE          (V4L2_CID_MPEG_BASE+103)
     863enum v4l2_mpeg_audio_l2_bitrate {
     864        V4L2_MPEG_AUDIO_L2_BITRATE_32K  = 0,
     865        V4L2_MPEG_AUDIO_L2_BITRATE_48K  = 1,
     866        V4L2_MPEG_AUDIO_L2_BITRATE_56K  = 2,
     867        V4L2_MPEG_AUDIO_L2_BITRATE_64K  = 3,
     868        V4L2_MPEG_AUDIO_L2_BITRATE_80K  = 4,
     869        V4L2_MPEG_AUDIO_L2_BITRATE_96K  = 5,
     870        V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
     871        V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
     872        V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
     873        V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
     874        V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
     875        V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
     876        V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
     877        V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
     878};
     879#define V4L2_CID_MPEG_AUDIO_L3_BITRATE          (V4L2_CID_MPEG_BASE+104)
     880enum v4l2_mpeg_audio_l3_bitrate {
     881        V4L2_MPEG_AUDIO_L3_BITRATE_32K  = 0,
     882        V4L2_MPEG_AUDIO_L3_BITRATE_40K  = 1,
     883        V4L2_MPEG_AUDIO_L3_BITRATE_48K  = 2,
     884        V4L2_MPEG_AUDIO_L3_BITRATE_56K  = 3,
     885        V4L2_MPEG_AUDIO_L3_BITRATE_64K  = 4,
     886        V4L2_MPEG_AUDIO_L3_BITRATE_80K  = 5,
     887        V4L2_MPEG_AUDIO_L3_BITRATE_96K  = 6,
     888        V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
     889        V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
     890        V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
     891        V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
     892        V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
     893        V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
     894        V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
     895};
     896#define V4L2_CID_MPEG_AUDIO_MODE                (V4L2_CID_MPEG_BASE+105)
     897enum v4l2_mpeg_audio_mode {
     898        V4L2_MPEG_AUDIO_MODE_STEREO       = 0,
     899        V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
     900        V4L2_MPEG_AUDIO_MODE_DUAL         = 2,
     901        V4L2_MPEG_AUDIO_MODE_MONO         = 3,
     902};
     903#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION      (V4L2_CID_MPEG_BASE+106)
     904enum v4l2_mpeg_audio_mode_extension {
     905        V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4  = 0,
     906        V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8  = 1,
     907        V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
     908        V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
     909};
     910#define V4L2_CID_MPEG_AUDIO_EMPHASIS            (V4L2_CID_MPEG_BASE+107)
     911enum v4l2_mpeg_audio_emphasis {
     912        V4L2_MPEG_AUDIO_EMPHASIS_NONE         = 0,
     913        V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
     914        V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17    = 2,
     915};
     916#define V4L2_CID_MPEG_AUDIO_CRC                 (V4L2_CID_MPEG_BASE+108)
     917enum v4l2_mpeg_audio_crc {
     918        V4L2_MPEG_AUDIO_CRC_NONE  = 0,
     919        V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
     920};
     921
     922/*  MPEG video */
     923#define V4L2_CID_MPEG_VIDEO_ENCODING            (V4L2_CID_MPEG_BASE+200)
     924enum v4l2_mpeg_video_encoding {
     925        V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
     926        V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
     927};
     928#define V4L2_CID_MPEG_VIDEO_ASPECT              (V4L2_CID_MPEG_BASE+201)
     929enum v4l2_mpeg_video_aspect {
     930        V4L2_MPEG_VIDEO_ASPECT_1x1     = 0,
     931        V4L2_MPEG_VIDEO_ASPECT_4x3     = 1,
     932        V4L2_MPEG_VIDEO_ASPECT_16x9    = 2,
     933        V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
     934};
     935#define V4L2_CID_MPEG_VIDEO_B_FRAMES            (V4L2_CID_MPEG_BASE+202)
     936#define V4L2_CID_MPEG_VIDEO_GOP_SIZE            (V4L2_CID_MPEG_BASE+203)
     937#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE         (V4L2_CID_MPEG_BASE+204)
     938#define V4L2_CID_MPEG_VIDEO_PULLDOWN            (V4L2_CID_MPEG_BASE+205)
     939#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE        (V4L2_CID_MPEG_BASE+206)
     940enum v4l2_mpeg_video_bitrate_mode {
     941        V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
     942        V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
     943};
     944#define V4L2_CID_MPEG_VIDEO_BITRATE             (V4L2_CID_MPEG_BASE+207)
     945#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK        (V4L2_CID_MPEG_BASE+208)
     946#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
     947
     948/*  MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
     949#define V4L2_CID_MPEG_CX2341X_BASE                              (V4L2_CTRL_CLASS_MPEG | 0x1000)
     950#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE         (V4L2_CID_MPEG_CX2341X_BASE+0)
     951enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
     952        V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
     953        V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO   = 1,
     954};
     955#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER              (V4L2_CID_MPEG_CX2341X_BASE+1)
     956#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE    (V4L2_CID_MPEG_CX2341X_BASE+2)
     957enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
     958        V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF                  = 0,
     959        V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR               = 1,
     960        V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT              = 2,
     961        V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE      = 3,
     962        V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
     963};
     964#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE  (V4L2_CID_MPEG_CX2341X_BASE+3)
     965enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
     966        V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF    = 0,
     967        V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
     968};
     969#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE        (V4L2_CID_MPEG_CX2341X_BASE+4)
     970enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
     971        V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
     972        V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO   = 1,
     973};
     974#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER             (V4L2_CID_MPEG_CX2341X_BASE+5)
     975#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE          (V4L2_CID_MPEG_CX2341X_BASE+6)
     976enum v4l2_mpeg_cx2341x_video_median_filter_type {
     977        V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF      = 0,
     978        V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR      = 1,
     979        V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT     = 2,
     980        V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
     981        V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG     = 4,
     982};
     983#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM   (V4L2_CID_MPEG_CX2341X_BASE+7)
     984#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP      (V4L2_CID_MPEG_CX2341X_BASE+8)
     985#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
     986#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP    (V4L2_CID_MPEG_CX2341X_BASE+10)
     987
    760988/*
    761989 *      T U N I N G
    762990 */
    struct v4l2_modulator 
    8071035#define V4L2_TUNER_MODE_LANG2           0x0002
    8081036#define V4L2_TUNER_MODE_SAP             0x0002
    8091037#define V4L2_TUNER_MODE_LANG1           0x0003
     1038#define V4L2_TUNER_MODE_LANG1_LANG2     0x0004
    8101039
    8111040struct v4l2_frequency
    8121041{
    struct v4l2_audio 
    8271056        __u32   mode;
    8281057        __u32   reserved[2];
    8291058};
     1059
    8301060/*  Flags for the 'capability' field */
    8311061#define V4L2_AUDCAP_STEREO              0x00001
    8321062#define V4L2_AUDCAP_AVL                 0x00002
    8331063
    8341064/*  Flags for the 'mode' field */
    8351065#define V4L2_AUDMODE_AVL                0x00001
    836 #define V4L2_AUDMODE_32BITS             0x00002
    8371066
    8381067struct v4l2_audioout
    8391068{
    struct v4l2_audioout 
    8511080 */
    8521081
    8531082/* Raw VBI */
    854 
    8551083struct v4l2_vbi_format
    8561084{
    8571085        __u32   sampling_rate;          /* in 1 Hz */
    struct v4l2_vbi_format 
    8681096#define V4L2_VBI_UNSYNC         (1<< 0)
    8691097#define V4L2_VBI_INTERLACED     (1<< 1)
    8701098
    871 #if 1
     1099#if 1 /*KEEP*/
    8721100/* Sliced VBI
    8731101 *
    8741102 *    This implements is a proposal V4L2 API to allow SLICED VBI
    struct v4l2_sliced_vbi_format 
    8881116        __u32   reserved[2];            /* must be zero */
    8891117};
    8901118
     1119/* Teletext World System Teletext
     1120   (WST), defined on ITU-R BT.653-2 */
    8911121#define V4L2_SLICED_TELETEXT_B          (0x0001)
     1122/* Video Program System, defined on ETS 300 231*/
    8921123#define V4L2_SLICED_VPS                 (0x0400)
     1124/* Closed Caption, defined on EIA-608 */
    8931125#define V4L2_SLICED_CAPTION_525         (0x1000)
     1126/* Wide Screen System, defined on ITU-R BT1119.1 */
    8941127#define V4L2_SLICED_WSS_625             (0x4000)
    8951128
    8961129#define V4L2_SLICED_VBI_525             (V4L2_SLICED_CAPTION_525)
    8971130#define V4L2_SLICED_VBI_625             (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
    8981131
     1132#if 0
     1133/* FIXME: Currently unused defines, needs to be discussed further */
     1134
     1135/* Teletext World System Teletext
     1136   (WST), defined on ITU-R BT.653-2 */
     1137#define V4L2_SLICED_TELETEXT_PAL_B      (0x000001)
     1138#define V4L2_SLICED_TELETEXT_PAL_C      (0x000002)
     1139#define V4L2_SLICED_TELETEXT_NTSC_B     (0x000010)
     1140#define V4L2_SLICED_TELETEXT_SECAM      (0x000020)
     1141
     1142/* Teletext North American Broadcast Teletext Specification
     1143   (NABTS), defined on ITU-R BT.653-2 */
     1144#define V4L2_SLICED_TELETEXT_NTSC_C     (0x000040)
     1145#define V4L2_SLICED_TELETEXT_NTSC_D     (0x000080)
     1146
     1147/* Video Program System, defined on ETS 300 231*/
     1148#define V4L2_SLICED_VPS                 (0x000400)
     1149
     1150/* Closed Caption, defined on EIA-608 */
     1151#define V4L2_SLICED_CAPTION_525         (0x001000)
     1152#define V4L2_SLICED_CAPTION_625         (0x002000)
     1153
     1154/* Wide Screen System, defined on ITU-R BT1119.1 */
     1155#define V4L2_SLICED_WSS_625             (0x004000)
     1156
     1157/* Wide Screen System, defined on IEC 61880 */
     1158#define V4L2_SLICED_WSS_525             (0x008000)
     1159
     1160/* Vertical Interval Timecode (VITC), defined on SMPTE 12M */
     1161#define V4l2_SLICED_VITC_625            (0x010000)
     1162#define V4l2_SLICED_VITC_525            (0x020000)
     1163
     1164#define V4L2_SLICED_TELETEXT_B          (V4L2_SLICED_TELETEXT_PAL_B  |\
     1165                                         V4L2_SLICED_TELETEXT_NTSC_B)
     1166
     1167#define V4L2_SLICED_TELETEXT            (V4L2_SLICED_TELETEXT_PAL_B  |\
     1168                                         V4L2_SLICED_TELETEXT_PAL_C  |\
     1169                                         V4L2_SLICED_TELETEXT_SECAM  |\
     1170                                         V4L2_SLICED_TELETEXT_NTSC_B |\
     1171                                         V4L2_SLICED_TELETEXT_NTSC_C |\
     1172                                         V4L2_SLICED_TELETEXT_NTSC_D)
     1173
     1174#define V4L2_SLICED_CAPTION             (V4L2_SLICED_CAPTION_525     |\
     1175                                         V4L2_SLICED_CAPTION_625)
     1176
     1177#define V4L2_SLICED_WSS                 (V4L2_SLICED_WSS_525         |\
     1178                                         V4L2_SLICED_WSS_625)
     1179
     1180#define V4L2_SLICED_VITC                (V4L2_SLICED_VITC_525        |\
     1181                                         V4L2_SLICED_VITC_625)
     1182
     1183#define V4L2_SLICED_VBI_525             (V4L2_SLICED_TELETEXT_NTSC_B |\
     1184                                         V4L2_SLICED_TELETEXT_NTSC_C |\
     1185                                         V4L2_SLICED_TELETEXT_NTSC_D |\
     1186                                         V4L2_SLICED_CAPTION_525     |\
     1187                                         V4L2_SLICED_WSS_525         |\
     1188                                         V4l2_SLICED_VITC_525)
     1189
     1190#define V4L2_SLICED_VBI_625             (V4L2_SLICED_TELETEXT_PAL_B  |\
     1191                                         V4L2_SLICED_TELETEXT_PAL_C  |\
     1192                                         V4L2_SLICED_TELETEXT_SECAM  |\
     1193                                         V4L2_SLICED_VPS             |\
     1194                                         V4L2_SLICED_CAPTION_625     |\
     1195                                         V4L2_SLICED_WSS_625         |\
     1196                                         V4l2_SLICED_VITC_625)
     1197#endif
     1198
    8991199struct v4l2_sliced_vbi_cap
    9001200{
    9011201        __u16   service_set;
    struct v4l2_format 
    9311231                struct v4l2_pix_format          pix;     // V4L2_BUF_TYPE_VIDEO_CAPTURE
    9321232                struct v4l2_window              win;     // V4L2_BUF_TYPE_VIDEO_OVERLAY
    9331233                struct v4l2_vbi_format          vbi;     // V4L2_BUF_TYPE_VBI_CAPTURE
    934 #if 1
     1234#if 1 /*KEEP*/
    9351235                struct v4l2_sliced_vbi_format   sliced;  // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
    9361236#endif
    9371237                __u8    raw_data[200];                   // user-defined
    struct v4l2_streamparm 
    9521252        } parm;
    9531253};
    9541254
    955 
    956 
    9571255/*
    9581256 *      I O C T L   C O D E S   F O R   V I D E O   D E V I C E S
    9591257 *
    struct v4l2_streamparm 
    9631261#define VIDIOC_ENUM_FMT         _IOWR ('V',  2, struct v4l2_fmtdesc)
    9641262#define VIDIOC_G_FMT            _IOWR ('V',  4, struct v4l2_format)
    9651263#define VIDIOC_S_FMT            _IOWR ('V',  5, struct v4l2_format)
     1264#ifdef __KERNEL__
    9661265#define VIDIOC_G_MPEGCOMP       _IOR  ('V',  6, struct v4l2_mpeg_compression)
    9671266#define VIDIOC_S_MPEGCOMP       _IOW  ('V',  7, struct v4l2_mpeg_compression)
     1267#endif
    9681268#define VIDIOC_REQBUFS          _IOWR ('V',  8, struct v4l2_requestbuffers)
    9691269#define VIDIOC_QUERYBUF         _IOWR ('V',  9, struct v4l2_buffer)
    9701270#define VIDIOC_G_FBUF           _IOR  ('V', 10, struct v4l2_framebuffer)
    struct v4l2_streamparm 
    10101310#define VIDIOC_ENUMAUDOUT       _IOWR ('V', 66, struct v4l2_audioout)
    10111311#define VIDIOC_G_PRIORITY       _IOR  ('V', 67, enum v4l2_priority)
    10121312#define VIDIOC_S_PRIORITY       _IOW  ('V', 68, enum v4l2_priority)
    1013 #if 1
     1313#if 1 /*KEEP*/
    10141314#define VIDIOC_G_SLICED_VBI_CAP _IOR  ('V', 69, struct v4l2_sliced_vbi_cap)
    10151315#endif
    10161316#define VIDIOC_LOG_STATUS       _IO   ('V', 70)
     1317#define VIDIOC_G_EXT_CTRLS      _IOWR ('V', 71, struct v4l2_ext_controls)
     1318#define VIDIOC_S_EXT_CTRLS      _IOWR ('V', 72, struct v4l2_ext_controls)
     1319#define VIDIOC_TRY_EXT_CTRLS    _IOWR ('V', 73, struct v4l2_ext_controls)
    10171320
     1321#ifdef __OLD_VIDIOC_
    10181322/* for compatibility, will go away some day */
    10191323#define VIDIOC_OVERLAY_OLD      _IOWR ('V', 14, int)
    10201324#define VIDIOC_S_PARM_OLD       _IOW  ('V', 22, struct v4l2_streamparm)
    struct v4l2_streamparm 
    10221326#define VIDIOC_G_AUDIO_OLD      _IOWR ('V', 33, struct v4l2_audio)
    10231327#define VIDIOC_G_AUDOUT_OLD     _IOWR ('V', 49, struct v4l2_audioout)
    10241328#define VIDIOC_CROPCAP_OLD      _IOR  ('V', 58, struct v4l2_cropcap)
     1329#endif
    10251330
    10261331#define BASE_VIDIOC_PRIVATE     192             /* 192-255 are private */
    10271332
    1028 
    1029 #ifdef __KERNEL__
    1030 /*
    1031  *
    1032  *      V 4 L 2   D R I V E R   H E L P E R   A P I
    1033  *
    1034  *      Some commonly needed functions for drivers (v4l2-common.o module)
    1035  */
    1036 #include <linux/fs.h>
    1037 
    1038 /*  Video standard functions  */
    1039 extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
    1040 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
    1041                                     int id, char *name);
    1042 
    1043 /* prority handling */
    1044 struct v4l2_prio_state {
    1045         atomic_t prios[4];
    1046 };
    1047 int v4l2_prio_init(struct v4l2_prio_state *global);
    1048 int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
    1049                      enum v4l2_priority new);
    1050 int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
    1051 int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
    1052 enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
    1053 int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
    1054 
    1055 /* names for fancy debug output */
    1056 extern char *v4l2_field_names[];
    1057 extern char *v4l2_type_names[];
    1058 extern char *v4l2_ioctl_names[];
    1059 
    1060 /*  Compatibility layer interface  --  v4l1-compat module */
    1061 typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
    1062                            unsigned int cmd, void *arg);
    1063 int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
    1064                                int cmd, void *arg, v4l2_kioctl driver_ioctl);
    1065 
    1066 #endif /* __KERNEL__ */
    10671333#endif /* __LINUX_VIDEODEV2_H */
    10681334
    10691335/*