Changeset 4129

Show
Ignore:
Timestamp:
08/19/08 22:03:34 (4 months ago)
Author:
hverkuil
Message:

Update with latest from v4l-dvb

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ivtv/trunk/utils/Makefile

    r4123 r4129  
    1717HEADERS := linux/ivtv.h linux/ivtvfb.h 
    1818 
    19 CFLAGS = -D_GNU_SOURCE -O2 -Wall -g 
     19CFLAGS = -D_GNU_SOURCE -O2 -Wall -g -I. 
    2020CXXFLAGS = $(CFLAGS) 
    2121 
  • ivtv/trunk/utils/linux/ivtv.h

    r4115 r4129  
    2121#ifndef _LINUX_IVTV_H 
    2222#define _LINUX_IVTV_H 
     23 
     24#include <linux/types.h> 
    2325 
    2426/* ivtv knows several distinct output modes: MPEG streaming, 
     
    4648        enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */ 
    4749        __u32 pixelformat;       /* 0 == same as destination */ 
    48         void __user *y_source;   /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, 
     50        void *y_source;   /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, 
    4951                                    then just switch to user DMA YUV output mode */ 
    50         void __user *uv_source;  /* Unused for RGB pixelformats */ 
     52        void *uv_source;  /* Unused for RGB pixelformats */ 
    5153        struct v4l2_rect src; 
    5254        struct v4l2_rect dst; 
  • ivtv/trunk/utils/linux/ivtvfb.h

    r4115 r4129  
    2222#define __LINUX_IVTVFB_H__ 
    2323 
    24 #ifdef __KERNEL__ 
    25 #include <linux/compiler.h> /* need __user */ 
    26 #else 
    27 #define __user 
    28 #endif 
    2924#include <linux/types.h> 
    3025 
  • ivtv/trunk/utils/v4l2-chipids.cpp

    r4115 r4129  
    2424{ "vp27smpx", 2700 }, 
    2525{ "cs5345", 5345 }, 
     26{ "saa6752hs", 6752 }, 
     27{ "saa6752hs_ac3", 6753 }, 
    2628{ "wm8739", 8739 }, 
    2729{ "wm8775", 8775 }, 
     
    3032{ "upd64083", 64083 }, 
    3133{ "m52790", 52790 }, 
     34{ "mspx4xx", 34000 }, 
    3235{ "msp3400b", 34002 }, 
    3336{ "msp3410b", 34102 }, 
  • ivtv/trunk/utils/v4l2-ctl.cpp

    r4115 r4129  
    161161#define FmtChromaKey            (1L<<2) 
    162162#define FmtGlobalAlpha          (1L<<3) 
     163#define FmtPixelFormat          (1L<<4) 
    163164 
    164165/* crop specified */ 
     
    237238{ 
    238239        printf("Usage:\n"); 
    239         printf("Common options:\n"); 
    240         printf("  --all              display all information available\n"); 
    241         printf("  -B, --get-fmt-sliced-vbi\n"); 
    242         printf("                     query the sliced VBI capture format [VIDIOC_G_FMT]\n"); 
    243         printf("  -b, --set-fmt-sliced-vbi=<mode>\n"); 
    244         printf("                     set the sliced VBI capture format to <mode> [VIDIOC_S_FMT]\n"); 
    245         printf("                     <mode> is a comma separated list of:\n"); 
    246         printf("                     off:      turn off sliced VBI (cannot be combined with other modes)\n"); 
    247         printf("                     teletext: teletext (PAL/SECAM)\n"); 
    248         printf("                     cc:       closed caption (NTSC)\n"); 
    249         printf("                     wss:      widescreen signal (PAL/SECAM)\n"); 
    250         printf("                     vps:      VPS (PAL/SECAM)\n"); 
    251         printf("  -C, --get-ctrl=<ctrl>[,<ctrl>...]\n"); 
    252         printf("                     get the value of the controls [VIDIOC_G_EXT_CTRLS]\n"); 
    253         printf("  -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...]\n"); 
    254         printf("                     set the controls to the values specified [VIDIOC_S_EXT_CTRLS]\n"); 
    255         printf("  -D, --info         show driver info [VIDIOC_QUERYCAP]\n"); 
    256         printf("  -d, --device=<dev> use device <dev> instead of /dev/video0\n"); 
    257         printf("                     if <dev> is a single digit, then /dev/video<dev> is used\n"); 
    258         printf("  -F, --get-freq     query the frequency [VIDIOC_G_FREQUENCY]\n"); 
    259         printf("  -f, --set-freq=<freq>\n"); 
    260         printf("                     set the frequency to <freq> MHz [VIDIOC_S_FREQUENCY]\n"); 
    261         printf("  -h, --help         display this help message\n"); 
    262         printf("  -I, --get-input    query the video input [VIDIOC_G_INPUT]\n"); 
    263         printf("  -i, --set-input=<num>\n"); 
    264         printf("                     set the video input to <num> [VIDIOC_S_INPUT]\n"); 
    265         printf("  -l, --list-ctrls   display all controls and their values [VIDIOC_QUERYCTRL]\n"); 
    266         printf("  -L, --list-ctrls-menus\n"); 
    267         printf("                     display all controls, their values and the menus [VIDIOC_QUERYMENU]\n"); 
    268         printf("  -N, --list-outputs display video outputs [VIDIOC_ENUMOUTPUT]\n"); 
    269         printf("  -n, --list-inputs  display video inputs [VIDIOC_ENUMINPUT]\n"); 
    270         printf("  -O, --get-output   query the video output [VIDIOC_G_OUTPUT]\n"); 
    271         printf("  -o, --set-output=<num>\n"); 
    272         printf("                     set the video output to <num> [VIDIOC_S_OUTPUT]\n"); 
    273         printf("  -S, --get-standard\n"); 
    274         printf("                     query the video standard [VIDIOC_G_STD]\n"); 
    275         printf("  -s, --set-standard=<num>\n"); 
    276         printf("                     set the video standard to <num> [VIDIOC_S_STD]\n"); 
    277         printf("                     <num> can be a numerical v4l2_std value, or it can be one of:\n"); 
    278         printf("                     pal-X (X = B/G/H/N/Nc/I/D/K/M/60) or just 'pal' (V4L2_STD_PAL)\n"); 
    279         printf("                     ntsc-X (X = M/J/K) or just 'ntsc' (V4L2_STD_NTSC)\n"); 
    280         printf("                     secam-X (X = B/G/H/D/K/L/Lc) or just 'secam' (V4L2_STD_SECAM)\n"); 
    281         printf("  --list-standards   display supported video standards [VIDIOC_ENUMSTD]\n"); 
    282         printf("  -T, --get-tuner    query the tuner settings [VIDIOC_G_TUNER]\n"); 
    283         printf("  -t, --set-tuner=<mode>\n"); 
    284         printf("                     set the audio mode of the tuner [VIDIOC_S_TUNER]\n"); 
    285         printf("                     Possible values: mono, stereo, lang2, lang1, bilingual\n"); 
    286         printf("  --list-formats     display supported video formats [VIDIOC_ENUM_FMT]\n"); 
    287         printf("  -V, --get-fmt-video\n"); 
    288         printf("                     query the video capture format [VIDIOC_G_FMT]\n"); 
    289         printf("  -v, --set-fmt-video=width=<w>,height=<h>\n"); 
    290         printf("                     set the video capture format [VIDIOC_S_FMT]\n"); 
    291         printf("  --verbose          turn on verbose ioctl error reporting.\n"); 
    292         printf("\n"); 
    293         printf("Uncommon options:\n"); 
    294         printf("  --get-fmt-video-out\n"); 
    295         printf("                     query the video output format [VIDIOC_G_FMT]\n"); 
    296         printf("  --set-fmt-video-out=width=<w>,height=<h>\n"); 
    297         printf("                     set the video output format [VIDIOC_S_FMT]\n"); 
    298         printf("  --get-fmt-overlay\n"); 
    299         printf("                     query the video overlay format [VIDIOC_G_FMT]\n"); 
    300         printf("  --get-fmt-output-overlay\n"); 
    301         printf("                     query the video output overlay format [VIDIOC_G_FMT]\n"); 
    302         printf("  --set-fmt-output-overlay=chromakey=<key>,global_alpha=<alpha>\n"); 
    303         printf("                     set the video output overlay format [VIDIOC_S_FMT]\n"); 
    304         printf("  --get-sliced-vbi-cap\n"); 
    305         printf("                     query the sliced VBI capture capabilities [VIDIOC_G_SLICED_VBI_CAP]\n"); 
    306         printf("  --get-sliced-vbi-out-cap\n"); 
    307         printf("                     query the sliced VBI output capabilities [VIDIOC_G_SLICED_VBI_CAP]\n"); 
    308         printf("  --get-fmt-sliced-vbi-out\n"); 
    309         printf("                     query the sliced VBI output format [VIDIOC_G_FMT]\n"); 
    310         printf("  --set-fmt-sliced-vbi-out=<mode>\n"); 
    311         printf("                     set the sliced VBI output format to <mode> [VIDIOC_S_FMT]\n"); 
    312         printf("                     <mode> is a comma separated list of:\n"); 
    313         printf("                     off:      turn off sliced VBI (cannot be combined with other modes)\n"); 
    314         printf("                     teletext: teletext (PAL/SECAM)\n"); 
    315         printf("                     cc:       closed caption (NTSC)\n"); 
    316         printf("                     wss:      widescreen signal (PAL/SECAM)\n"); 
    317         printf("                     vps:      VPS (PAL/SECAM)\n"); 
    318         printf("  --get-fmt-vbi      query the VBI capture format [VIDIOC_G_FMT]\n"); 
    319         printf("  --get-fmt-vbi-out  query the VBI output format [VIDIOC_G_FMT]\n"); 
    320         printf("  --overlay=<on>     turn overlay on (1) or off (0) (VIDIOC_OVERLAY)\n"); 
    321         printf("  --get-fbuf         query the overlay framebuffer data [VIDIOC_G_FBUF]\n"); 
    322         printf("  --set-fbuf=chromakey=<0/1>,global_alpha=<0/1>,local_alpha=<0/1>,local_inv_alpha=<0/1>\n"); 
    323         printf("                     set the overlay framebuffer [VIDIOC_S_FBUF]\n"); 
    324         printf("  --get-cropcap      query the crop capabilities [VIDIOC_CROPCAP]\n"); 
    325         printf("  --get-crop         query the video capture crop window [VIDIOC_G_CROP]\n"); 
    326         printf("  --set-crop=top=<x>,left=<y>,width=<w>,height=<h>\n"); 
    327         printf("                     set the video capture crop window [VIDIOC_S_CROP]\n"); 
    328         printf("  --get-cropcap-output\n"); 
    329         printf("                     query the crop capabilities for video output [VIDIOC_CROPCAP]\n"); 
    330         printf("  --get-crop-output  query the video output crop window [VIDIOC_G_CROP]\n"); 
    331         printf("  --set-crop-output=top=<x>,left=<y>,width=<w>,height=<h>\n"); 
    332         printf("                     set the video output crop window [VIDIOC_S_CROP]\n"); 
    333         printf("  --get-cropcap-overlay\n"); 
    334         printf("                     query the crop capabilities for video overlay [VIDIOC_CROPCAP]\n"); 
    335         printf("  --get-crop-overlay query the video overlay crop window [VIDIOC_G_CROP]\n"); 
    336         printf("  --set-crop-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n"); 
    337         printf("                     set the video overlay crop window [VIDIOC_S_CROP]\n"); 
    338         printf("  --get-cropcap-output-overlay\n"); 
    339         printf("                     query the crop capabilities for video output overlays [VIDIOC_CROPCAP]\n"); 
    340         printf("  --get-crop-output-overlay\n"); 
    341         printf("                     query the video output overlay crop window [VIDIOC_G_CROP]\n"); 
    342         printf("  --set-crop-output-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n"); 
    343         printf("                     set the video output overlay crop window [VIDIOC_S_CROP]\n"); 
    344         printf("  --get-audio-input  query the audio input [VIDIOC_G_AUDIO]\n"); 
    345         printf("  --set-audio-input=<num>\n"); 
    346         printf("                     set the audio input to <num> [VIDIOC_S_AUDIO]\n"); 
    347         printf("  --get-audio-output query the audio output [VIDIOC_G_AUDOUT]\n"); 
    348         printf("  --set-audio-output=<num>\n"); 
    349         printf("                     set the audio output to <num> [VIDIOC_S_AUDOUT]\n"); 
    350         printf("  --list-audio-outputs\n"); 
    351         printf("                     display audio outputs [VIDIOC_ENUMAUDOUT]\n"); 
    352         printf("  --list-audio-inputs\n"); 
    353         printf("                     display audio inputs [VIDIOC_ENUMAUDIO]\n"); 
    354         printf("\n"); 
    355         printf("Expert options:\n"); 
    356         printf("  --streamoff        turn the stream off [VIDIOC_STREAMOFF]\n"); 
    357         printf("  --streamon         turn the stream on [VIDIOC_STREAMOFF]\n"); 
    358         printf("  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); 
     240        printf("Common options:\n" 
     241               "  --all              display all information available\n" 
     242               "  -B, --get-fmt-sliced-vbi\n" 
     243               "                     query the sliced VBI capture format [VIDIOC_G_FMT]\n" 
     244               "  -b, --set-fmt-sliced-vbi=<mode>\n" 
     245               "                     set the sliced VBI capture format to <mode> [VIDIOC_S_FMT]\n" 
     246               "                     <mode> is a comma separated list of:\n" 
     247               "                     off:      turn off sliced VBI (cannot be combined with other modes)\n" 
     248               "                     teletext: teletext (PAL/SECAM)\n" 
     249               "                     cc:       closed caption (NTSC)\n" 
     250               "                     wss:      widescreen signal (PAL/SECAM)\n" 
     251               "                     vps:      VPS (PAL/SECAM)\n" 
     252               "  -C, --get-ctrl=<ctrl>[,<ctrl>...]\n" 
     253               "                     get the value of the controls [VIDIOC_G_EXT_CTRLS]\n" 
     254               "  -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...]\n" 
     255               "                     set the controls to the values specified [VIDIOC_S_EXT_CTRLS]\n" 
     256               "  -D, --info         show driver info [VIDIOC_QUERYCAP]\n" 
     257               "  -d, --device=<dev> use device <dev> instead of /dev/video0\n" 
     258               "                     if <dev> is a single digit, then /dev/video<dev> is used\n" 
     259               "  -F, --get-freq     query the frequency [VIDIOC_G_FREQUENCY]\n" 
     260               "  -f, --set-freq=<freq>\n" 
     261               "                     set the frequency to <freq> MHz [VIDIOC_S_FREQUENCY]\n" 
     262               "  -h, --help         display this help message\n" 
     263               "  -I, --get-input    query the video input [VIDIOC_G_INPUT]\n" 
     264               "  -i, --set-input=<num>\n" 
     265               "                     set the video input to <num> [VIDIOC_S_INPUT]\n" 
     266               "  -l, --list-ctrls   display all controls and their values [VIDIOC_QUERYCTRL]\n" 
     267               "  -L, --list-ctrls-menus\n" 
     268               "                     display all controls, their values and the menus [VIDIOC_QUERYMENU]\n" 
     269               "  -N, --list-outputs display video outputs [VIDIOC_ENUMOUTPUT]\n" 
     270               "  -n, --list-inputs  display video inputs [VIDIOC_ENUMINPUT]\n" 
     271               "  -O, --get-output   query the video output [VIDIOC_G_OUTPUT]\n" 
     272               "  -o, --set-output=<num>\n" 
     273               "                     set the video output to <num> [VIDIOC_S_OUTPUT]\n" 
     274               "  -S, --get-standard\n" 
     275               "                     query the video standard [VIDIOC_G_STD]\n" 
     276               "  -s, --set-standard=<num>\n" 
     277               "                     set the video standard to <num> [VIDIOC_S_STD]\n" 
     278               "                     <num> can be a numerical v4l2_std value, or it can be one of:\n" 
     279               "                     pal-X (X = B/G/H/N/Nc/I/D/K/M/60) or just 'pal' (V4L2_STD_PAL)\n" 
     280               "                     ntsc-X (X = M/J/K) or just 'ntsc' (V4L2_STD_NTSC)\n" 
     281               "                     secam-X (X = B/G/H/D/K/L/Lc) or just 'secam' (V4L2_STD_SECAM)\n" 
     282               "  --list-standards   display supported video standards [VIDIOC_ENUMSTD]\n" 
     283               "  -T, --get-tuner    query the tuner settings [VIDIOC_G_TUNER]\n" 
     284               "  -t, --set-tuner=<mode>\n" 
     285               "                     set the audio mode of the tuner [VIDIOC_S_TUNER]\n" 
     286               "                     Possible values: mono, stereo, lang2, lang1, bilingual\n" 
     287               "  --list-formats     display supported video formats [VIDIOC_ENUM_FMT]\n" 
     288               "  -V, --get-fmt-video\n" 
     289               "                     query the video capture format [VIDIOC_G_FMT]\n" 
     290               "  -v, --set-fmt-video=width=<w>,height=<h>,pixelformat=<f>\n" 
     291               "                     set the video capture format [VIDIOC_S_FMT]\n" 
     292               "                     pixelformat is either the format index as reported by\n" 
     293               "                     --list-formats, or the fourcc value as a string\n" 
     294               "  --verbose          turn on verbose ioctl error reporting.\n" 
     295               "\n"); 
     296        printf("Uncommon options:\n" 
     297               "  --get-fmt-video-out\n" 
     298               "                     query the video output format [VIDIOC_G_FMT]\n" 
     299               "  --set-fmt-video-out=width=<w>,height=<h>\n" 
     300               "                     set the video output format [VIDIOC_S_FMT]\n" 
     301               "  --get-fmt-overlay\n" 
     302               "                     query the video overlay format [VIDIOC_G_FMT]\n" 
     303               "  --get-fmt-output-overlay\n" 
     304               "                     query the video output overlay format [VIDIOC_G_FMT]\n" 
     305               "  --set-fmt-output-overlay=chromakey=<key>,global_alpha=<alpha>\n" 
     306               "                     set the video output overlay format [VIDIOC_S_FMT]\n" 
     307               "  --get-sliced-vbi-cap\n" 
     308               "                     query the sliced VBI capture capabilities [VIDIOC_G_SLICED_VBI_CAP]\n" 
     309               "  --get-sliced-vbi-out-cap\n" 
     310               "                     query the sliced VBI output capabilities [VIDIOC_G_SLICED_VBI_CAP]\n" 
     311               "  --get-fmt-sliced-vbi-out\n" 
     312               "                     query the sliced VBI output format [VIDIOC_G_FMT]\n" 
     313               "  --set-fmt-sliced-vbi-out=<mode>\n" 
     314               "                     set the sliced VBI output format to <mode> [VIDIOC_S_FMT]\n" 
     315               "                     <mode> is a comma separated list of:\n" 
     316               "                     off:      turn off sliced VBI (cannot be combined with other modes)\n" 
     317               "                     teletext: teletext (PAL/SECAM)\n" 
     318               "                     cc:       closed caption (NTSC)\n" 
     319               "                     wss:      widescreen signal (PAL/SECAM)\n" 
     320               "                     vps:      VPS (PAL/SECAM)\n" 
     321               "  --get-fmt-vbi      query the VBI capture format [VIDIOC_G_FMT]\n" 
     322               "  --get-fmt-vbi-out  query the VBI output format [VIDIOC_G_FMT]\n" 
     323               "  --overlay=<on>     turn overlay on (1) or off (0) (VIDIOC_OVERLAY)\n" 
     324               "  --get-fbuf         query the overlay framebuffer data [VIDIOC_G_FBUF]\n" 
     325               "  --set-fbuf=chromakey=<0/1>,global_alpha=<0/1>,local_alpha=<0/1>,local_inv_alpha=<0/1>\n" 
     326               "                     set the overlay framebuffer [VIDIOC_S_FBUF]\n" 
     327               "  --get-cropcap      query the crop capabilities [VIDIOC_CROPCAP]\n" 
     328               "  --get-crop         query the video capture crop window [VIDIOC_G_CROP]\n" 
     329               "  --set-crop=top=<x>,left=<y>,width=<w>,height=<h>\n" 
     330               "                     set the video capture crop window [VIDIOC_S_CROP]\n" 
     331               "  --get-cropcap-output\n" 
     332               "                     query the crop capabilities for video output [VIDIOC_CROPCAP]\n" 
     333               "  --get-crop-output  query the video output crop window [VIDIOC_G_CROP]\n" 
     334               "  --set-crop-output=top=<x>,left=<y>,width=<w>,height=<h>\n" 
     335               "                     set the video output crop window [VIDIOC_S_CROP]\n" 
     336               "  --get-cropcap-overlay\n" 
     337               "                     query the crop capabilities for video overlay [VIDIOC_CROPCAP]\n" 
     338               "  --get-crop-overlay query the video overlay crop window [VIDIOC_G_CROP]\n" 
     339               "  --set-crop-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n" 
     340               "                     set the video overlay crop window [VIDIOC_S_CROP]\n" 
     341               "  --get-cropcap-output-overlay\n" 
     342               "                     query the crop capabilities for video output overlays [VIDIOC_CROPCAP]\n" 
     343               "  --get-crop-output-overlay\n" 
     344               "                     query the video output overlay crop window [VIDIOC_G_CROP]\n" 
     345               "  --set-crop-output-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n" 
     346               "                     set the video output overlay crop window [VIDIOC_S_CROP]\n" 
     347               "  --get-audio-input  query the audio input [VIDIOC_G_AUDIO]\n" 
     348               "  --set-audio-input=<num>\n" 
     349               "                     set the audio input to <num> [VIDIOC_S_AUDIO]\n" 
     350               "  --get-audio-output query the audio output [VIDIOC_G_AUDOUT]\n" 
     351               "  --set-audio-output=<num>\n" 
     352               "                     set the audio output to <num> [VIDIOC_S_AUDOUT]\n" 
     353               "  --list-audio-outputs\n" 
     354               "                     display audio outputs [VIDIOC_ENUMAUDOUT]\n" 
     355               "  --list-audio-inputs\n" 
     356               "                     display audio inputs [VIDIOC_ENUMAUDIO]\n" 
     357               "\n"); 
     358        printf("Expert options:\n" 
     359               "  --streamoff        turn the stream off [VIDIOC_STREAMOFF]\n" 
     360               "  --streamon         turn the stream on [VIDIOC_STREAMOFF]\n" 
     361               "  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); 
    359362        exit(0); 
    360363} 
     
    486489{ 
    487490        std::string s; 
     491        int add_underscore = 0; 
    488492 
    489493        while (*name) { 
    490                 if (*name == ' ') s += "_"; 
    491                 else s += std::string(1, tolower(*name)); 
     494                if (isalnum(*name)) { 
     495                        if (add_underscore) 
     496                                s += '_'; 
     497                        add_underscore = 0; 
     498                        s += std::string(1, tolower(*name)); 
     499                } 
     500                else if (s.length()) add_underscore = 1; 
    492501                name++; 
    493502        } 
     
    629638                qctrl.id = id; 
    630639                if (ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0 && 
    631                     !(qctrl.flags & V4L2_CTRL_FLAG_DISABLED)) 
     640                    !(qctrl.flags & V4L2_CTRL_FLAG_DISABLED)) { 
    632641                        ctrl_str2id[name2var(qctrl.name)] = qctrl.id; 
     642                        ctrl_id2str[qctrl.id] = name2var(qctrl.name); 
     643                } 
    633644        } 
    634645        for (qctrl.id = V4L2_CID_PRIVATE_BASE; 
    635646                        ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0; qctrl.id++) { 
    636                 if (!(qctrl.flags & V4L2_CTRL_FLAG_DISABLED)) 
     647                if (!(qctrl.flags & V4L2_CTRL_FLAG_DISABLED)) { 
    637648                        ctrl_str2id[name2var(qctrl.name)] = qctrl.id; 
     649                        ctrl_id2str[qctrl.id] = name2var(qctrl.name); 
     650                } 
    638651        } 
    639652} 
     
    692705        printf("\tWidth         : %d\n", fb.fmt.width); 
    693706        printf("\tHeight        : %d\n", fb.fmt.height); 
    694         printf("\tPixel Format  : %s\n", fcc2s(fb.fmt.pixelformat).c_str()); 
     707        printf("\tPixel Format  : '%s'\n", fcc2s(fb.fmt.pixelformat).c_str()); 
    695708        if (!is_ext) { 
    696709                printf("\tBytes per Line: %d\n", fb.fmt.bytesperline); 
     
    731744        case V4L2_BUF_TYPE_VIDEO_OUTPUT: 
    732745                printf("\tWidth/Height  : %u/%u\n", vfmt.fmt.pix.width, vfmt.fmt.pix.height); 
    733                 printf("\tPixel Format  : %s\n", fcc2s(vfmt.fmt.pix.pixelformat).c_str()); 
     746                printf("\tPixel Format  : '%s'\n", fcc2s(vfmt.fmt.pix.pixelformat).c_str()); 
    734747                printf("\tField         : %s\n", field2s(vfmt.fmt.pix.field).c_str()); 
    735748                printf("\tBytes per Line: %u\n", vfmt.fmt.pix.bytesperline); 
     
    789802        fmt.type = type; 
    790803        while (ioctl(fd, VIDIOC_ENUM_FMT, &fmt) >= 0) { 
     804                printf("\tIndex       : %d\n", fmt.index); 
    791805                printf("\tType        : %s\n", buftype2s(type).c_str()); 
    792                 printf("\tPixelformat : %s", fcc2s(fmt.pixelformat).c_str()); 
     806                printf("\tPixel Format: '%s'", fcc2s(fmt.pixelformat).c_str()); 
    793807                if (fmt.flags) 
    794808                        printf(" (compressed)"); 
     
    10141028} 
    10151029 
    1016 static int parse_subopt(char **subs, char * const *subopts, char **value) 
    1017 { 
    1018         int opt = getsubopt(subs, subopts, value); 
     1030static int parse_subopt(char **subs, const char * const *subopts, char **value) 
     1031{ 
     1032        int opt = getsubopt(subs, (char * const *)subopts, value); 
    10191033 
    10201034        if (opt == -1) { 
     
    10891103 
    10901104    while (*subs != '\0') { 
    1091         static char *const subopts[] = { 
     1105        static const char *const subopts[] = { 
    10921106            "left", 
    10931107            "top", 
     
    11391153        /* command args */ 
    11401154        int ch; 
    1141         char *device = strdup("/dev/video0"); /* -d device */ 
     1155        const char *device = "/dev/video0";   /* -d device */ 
    11421156        struct v4l2_format vfmt;        /* set_format/get_format for video */ 
    11431157        struct v4l2_format vfmt_out;    /* set_format/get_format video output */ 
     
    12151229                        return 0; 
    12161230                case OptSetDevice: 
    1217                         device = strdup(optarg)
     1231                        device = optarg
    12181232                        if (device[0] >= '0' && device[0] <= '9' && device[1] == 0) { 
     1233                                static char newdev[20]; 
    12191234                                char dev = device[0]; 
    12201235 
    1221                                 sprintf(device, "/dev/video%c", dev); 
     1236                                sprintf(newdev, "/dev/video%c", dev); 
     1237                                device = newdev; 
    12221238                        } 
    12231239                        break; 
     
    12251241                        subs = optarg; 
    12261242                        while (*subs != '\0') { 
    1227                                 static char *const subopts[] = { 
     1243                                static const char *const subopts[] = { 
    12281244                                        "width", 
    12291245                                        "height", 
     1246                                        "pixelformat", 
    12301247                                        NULL 
    12311248                                }; 
     
    12401257                                        set_fmts |= FmtHeight; 
    12411258                                        break; 
     1259                                case 2: 
     1260                                        if (strlen(value) == 4) 
     1261                                                vfmt.fmt.pix.pixelformat = 
     1262                                                    v4l2_fourcc(value[0], value[1], 
     1263                                                            value[2], value[3]); 
     1264                                        else 
     1265                                                vfmt.fmt.pix.pixelformat = strtol(value, 0L, 0); 
     1266                                        set_fmts |= FmtPixelFormat; 
     1267                                        break; 
    12421268                                } 
    12431269                        } 
     
    12461272                        subs = optarg; 
    12471273                        while (*subs != '\0') { 
    1248                                 static char *const subopts[] = { 
     1274                                static const char *const subopts[] = { 
    12491275                                        "width", 
    12501276                                        "height", 
     
    12671293                        subs = optarg; 
    12681294                        while (*subs != '\0') { 
    1269                                 static char *const subopts[] = { 
     1295                                static const char *const subopts[] = { 
    12701296                                        "chromakey", 
    12711297                                        "global_alpha", 
     
    12881314                        subs = optarg; 
    12891315                        while (*subs != '\0') { 
    1290                                 static char *const subopts[] = { 
     1316                                static const char *const subopts[] = { 
    12911317                                        "chromakey", 
    12921318                                        "global_alpha", 
     
    13661392                        } 
    13671393                        else { 
    1368                                 std = strtol(optarg, 0L, 0)
     1394                                std = strtol(optarg, 0L, 0) | (1ULL << 63)
    13691395                        } 
    13701396                        break; 
     
    14231449                        subs = optarg; 
    14241450                        while (*subs != '\0') { 
    1425                                 static char *const subopts[] = { 
     1451                                static const char *const subopts[] = { 
    14261452                                        "off", 
    14271453                                        "teletext", 
     
    14871513                exit(1); 
    14881514        } 
    1489         free(device); 
    14901515 
    14911516        doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP"); 
     
    15631588 
    15641589        if (options[OptSetStandard]) { 
    1565                 if (std < 16) { 
    1566                         vs.index = std
     1590                if (std & (1ULL << 63)) { 
     1591                        vs.index = std & 0xffff
    15671592                        if (ioctl(fd, VIDIOC_ENUMSTD, &vs) >= 0) { 
    15681593                                std = vs.id; 
     
    16171642                        if (set_fmts & FmtHeight) 
    16181643                                in_vfmt.fmt.pix.height = vfmt.fmt.pix.height; 
     1644                        if (set_fmts & FmtPixelFormat) { 
     1645                                in_vfmt.fmt.pix.pixelformat = vfmt.fmt.pix.pixelformat; 
     1646                                if (in_vfmt.fmt.pix.pixelformat < 256) { 
     1647                                        struct v4l2_fmtdesc fmt; 
     1648 
     1649                                        fmt.index = in_vfmt.fmt.pix.pixelformat; 
     1650                                        fmt.type = in_vfmt.type; 
     1651                                        if (doioctl(fd, VIDIOC_ENUM_FMT, &fmt, "VIDIOC_ENUM_FMT")) 
     1652                                                goto set_vid_fmt_error; 
     1653                                        in_vfmt.fmt.pix.pixelformat = fmt.pixelformat; 
     1654                                } 
     1655                        } 
    16191656                        doioctl(fd, VIDIOC_S_FMT, &in_vfmt, "VIDIOC_S_FMT"); 
    16201657                } 
    16211658        } 
     1659set_vid_fmt_error: 
    16221660 
    16231661        if (options[OptSetVideoOutFormat]) { 
     
    19872025                if (doioctl(fd, VIDIOC_G_TUNER, &vt, "VIDIOC_G_TUNER") == 0) { 
    19882026                        printf("Tuner:\n"); 
     2027                        printf("\tName                 : %s\n", vt.name); 
    19892028                        printf("\tCapabilities         : %s\n", tcap2s(vt.capability).c_str()); 
    19902029                        if (vt.capability & V4L2_TUNER_CAP_LOW) 
     
    19942033                                printf("\tFrequency range      : %.1f MHz - %.1f MHz\n", 
    19952034                                     vt.rangelow / 16.0, vt.rangehigh / 16.0); 
    1996                         printf("\tSignal strength      : %d%%\n", (int)(vt.signal / 655.35)); 
     2035                        printf("\tSignal strength/AFC  : %d%%/%d\n", (int)(vt.signal / 655.35), vt.afc); 
    19972036                        printf("\tCurrent audio mode   : %s\n", audmode2s(vt.audmode)); 
    19982037                        printf("\tAvailable subchannels: %s\n", 
     
    21082147                        if (vs.index) 
    21092148                                printf("\n"); 
    2110                         printf("\tindex       : %d\n", vs.index); 
     2149                        printf("\tIndex       : %d\n", vs.index); 
    21112150                        printf("\tID          : 0x%016llX\n", (unsigned long long)vs.id); 
    21122151                        printf("\tName        : %s\n", vs.name); 
  • ivtv/trunk/utils/v4l2-dbg.cpp

    r4126 r4129  
    4646#define I2C_DRIVERID_SAA7127   72      /* saa7124 video encoder        */ 
    4747#define I2C_DRIVERID_CX25840   71      /* cx2584x video encoder        */ 
    48  
     48#define I2C_DRIVERID_CS5345    96      /* cs5345 audio processor        */ 
     49 
     50/* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */ 
     51enum { 
     52        /* general idents: reserved range 0-49 */ 
     53        V4L2_IDENT_NONE      = 0,       /* No chip matched */ 
     54        V4L2_IDENT_AMBIGUOUS = 1,       /* Match too general, multiple chips matched */ 
     55        V4L2_IDENT_UNKNOWN   = 2,       /* Chip found, but cannot identify */ 
     56 
     57        /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 
     58        V4L2_IDENT_CX23415 = 415, 
     59        V4L2_IDENT_CX23416 = 416, 
     60        V4L2_IDENT_CX23418 = 418, 
     61}; 
    4962 
    5063struct driverid { 
     
    7790        OptScanChipIdents = 'C', 
    7891        OptGetChipIdent = 'c', 
     92        OptSetStride = 'w', 
    7993        OptHelp = 'h', 
    8094 
     
    100114        {"log-status", no_argument, 0, OptLogStatus}, 
    101115        {"list-driverids", no_argument, 0, OptListDriverIDs}, 
     116        {"wide", required_argument, 0, OptSetStride}, 
    102117        {0, 0, 0, 0} 
    103118}; 
     
    119134        printf("  -c, --get-chip-ident=type=<host/i2cdrv/i2caddr>,chip=<chip>\n"); 
    120135        printf("                     Get the chip identifier [VIDIOC_G_CHIP_IDENT]\n"); 
     136        printf("  -w, --wide=<reg length>\n"); 
     137        printf("                     Sets step between two registers\n"); 
    121138        printf("  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); 
    122139        printf("  --list-driverids   list the known I2C driver IDs for use with the i2cdrv type\n"); 
     
    247264} 
    248265 
    249 static int parse_subopt(char **subs, char * const *subopts, char **value) 
    250 { 
    251         int opt = getsubopt(subs, subopts, value); 
     266static int parse_subopt(char **subs, const char * const *subopts, char **value) 
     267{ 
     268        int opt = getsubopt(subs, (char * const *)subopts, value); 
    252269 
    253270        if (opt == -1) { 
     
    268285{ 
    269286        char *value, *subs; 
    270         int i
     287        int i, forcedstride = 0
    271288 
    272289        int fd = -1; 
     
    274291        /* command args */ 
    275292        int ch; 
    276         char *device = strdup("/dev/video0"); /* -d device */ 
     293        const char *device = "/dev/video0";   /* -d device */ 
    277294        struct v4l2_capability vcap;    /* list_cap */ 
    278295        struct v4l2_register set_reg; 
     
    313330                        return 0; 
    314331                case OptSetDevice: 
    315                         device = strdup(optarg)
     332                        device = optarg
    316333                        if (device[0] >= '0' && device[0] <= '9' && device[1] == 0) { 
     334                                static char newdev[20]; 
    317335                                char dev = device[0]; 
    318336 
    319                                 sprintf(device, "/dev/video%c", dev); 
     337                                sprintf(newdev, "/dev/video%c", dev); 
     338                                device = newdev; 
    320339                        } 
    321340                        break; 
     
    324343                        set_reg.match_type = V4L2_CHIP_MATCH_I2C_DRIVER; 
    325344                        while (*subs != '\0') { 
    326                                 static char *const subopts[] = { 
     345                                static const char * const subopts[] = { 
    327346                                        "type", 
    328347                                        "chip", 
     
    347366                                } 
    348367                        } 
     368                case OptSetStride: 
     369                        forcedstride = strtoull(optarg, 0L, 0); 
    349370                        break; 
    350371                case OptListRegisters: 
     
    352373                        get_reg.match_type = V4L2_CHIP_MATCH_I2C_DRIVER; 
    353374                        while (*subs != '\0') { 
    354                                 static char *const subopts[] = { 
     375                                static const char * const subopts[] = { 
    355376                                        "type", 
    356377                                        "chip", 
     
    369390                                case 2: 
    370391                                        reg_min = strtoull(value, 0L, 0); 
     392                                        if (reg_max == 0) 
     393                                                reg_max = reg_min + 0xff; 
    371394                                        break; 
    372395                                case 3: 
     
    380403                        set_reg.match_type = V4L2_CHIP_MATCH_I2C_DRIVER; 
    381404                        while (*subs != '\0') { 
    382                                 static char *const subopts[] = { 
     405                                static const char *const subopts[] = { 
    383406                                        "type", 
    384407                                        "chip", 
     
    422445                exit(1); 
    423446        } 
    424         free(device); 
    425447 
    426448        doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP"); 
     
    476498        if (options[OptListRegisters]) { 
    477499                int stride = 1; 
    478  
    479                 if (get_reg.match_type == V4L2_CHIP_MATCH_HOST) stride = 4; 
     500                if (forcedstride) { 
     501                        stride = forcedstride; 
     502                } else { 
     503                        if (get_reg.match_type == V4L2_CHIP_MATCH_HOST) 
     504                                stride = 4; 
     505                } 
    480506                printf("ioctl: VIDIOC_DBG_G_REGISTER\n"); 
    481                 if (reg_max == 0) { 
    482                         switch (get_reg.match_chip) { 
    483                         case I2C_DRIVERID_SAA711X: 
    484                                 print_regs(fd, &get_reg, 0, 0xff, stride); 
    485                                 break; 
    486                         case I2C_DRIVERID_SAA717X: 
    487                                 // FIXME: use correct reg regions 
    488                                 print_regs(fd, &get_reg, 0, 0xff, stride); 
    489                                 break; 
    490                         case I2C_DRIVERID_SAA7127: 
    491                                 print_regs(fd, &get_reg, 0, 0x7f, stride); 
    492                                 break; 
    493                         case I2C_DRIVERID_CX25840: 
    494                                 print_regs(fd, &get_reg, 0, 2, stride); 
    495                                 print_regs(fd, &get_reg, 0x100, 0x15f, stride); 
    496                                 print_regs(fd, &get_reg, 0x200, 0x23f, stride); 
    497                                 print_regs(fd, &get_reg, 0x400, 0x4bf, stride); 
    498                                 print_regs(fd, &get_reg, 0x800, 0x9af, stride); 
    499                                 break; 
    500                         case 0: 
    501                                 print_regs(fd, &get_reg, 0x02000000, 0x020000ff, stride); 
    502                                 break; 
    503                         } 
    504                 } 
    505                 else { 
     507 
     508                if (reg_max != 0) { 
     509                        /* Explicit memory range: just do it */ 
    506510