Changeset 4015 for ivtvtv

Show
Ignore:
Timestamp:
08/23/07 23:18:06 (1 year ago)
Author:
hverkuil
Message:

Updates.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ivtvtv/trunk/ivtv-fb.h

    r3872 r4015  
    11/* 
    22    On Screen Display cx23415 Framebuffer driver 
    3      
     3 
    44    Copyright (C) 2006  Ian Armstrong <ian@iarmst.demon.co.uk> 
    55 
     
    2424/* Framebuffer external API */ 
    2525 
    26 struct ivtvfb_ioctl_dma_host_to_ivtv_args
     26struct ivtvfb_dma_frame
    2727        void __user *source; 
    2828        unsigned long dest_offset; 
     
    3030}; 
    3131 
    32 /* Framebuffer ioctls should use the range 1 - 28 */ 
    33 #define IVTVFB_IOCTL_PREP_FRAME         _IOW('@', 3, struct ivtvfb_ioctl_dma_host_to_ivtv_args) 
     32#define IVTVFB_IOC_DMA_FRAME  _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) 
    3433 
    3534#endif 
  • ivtvtv/trunk/ivtv.h

    r3872 r4015  
    22    Public ivtv API header 
    33    Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com> 
    4  
    5     VBI portions: 
    6     Copyright (C) 2004  Hans Verkuil <hverkuil@xs4all.nl> 
     4    Copyright (C) 2004-2007  Hans Verkuil <hverkuil@xs4all.nl> 
    75 
    86    This program is free software; you can redistribute it and/or modify 
  • ivtvtv/trunk/ivtvtv.cpp

    r3907 r4015  
    55#include <fcntl.h> 
    66#include <sys/ioctl.h> 
     7#include <sys/time.h> 
    78#include <errno.h> 
    89 
     
    1213#include "ivtv-fb.h" 
    1314#include <linux/fb.h> 
     15#include <linux/matroxfb.h> 
    1416} 
    1517 
     
    2628{ 
    2729        struct video_command cmd; 
     30        struct timeval tv1, tv2; 
    2831 
    2932        memset(&cmd, 0, sizeof(cmd)); 
    3033 
     34        gettimeofday(&tv1, NULL); 
    3135        switch (ch) { 
    3236        case 'p': 
     
    4549                speed = cmd.play.speed; 
    4650                break; 
     51        case 'c': 
     52                cmd.cmd = VIDEO_CMD_CONTINUE; 
     53                ioctl(fh, VIDEO_COMMAND, &cmd); 
     54                break; 
    4755        case 'r': 
     56                cmd.cmd = VIDEO_CMD_PLAY; 
     57                cmd.play.speed = 1000; 
     58                ioctl(fh, VIDEO_COMMAND, &cmd); 
     59                speed = cmd.play.speed; 
     60                break; 
     61        case 't': 
     62                cmd.cmd = VIDEO_CMD_STOP; 
     63                cmd.flags = VIDEO_CMD_STOP_IMMEDIATELY|VIDEO_CMD_STOP_TO_BLACK; 
     64                ioctl(fh, VIDEO_COMMAND, &cmd); 
    4865                cmd.cmd = VIDEO_CMD_PLAY; 
    4966                cmd.play.speed = 1000; 
     
    96113                break; 
    97114        } 
     115        gettimeofday(&tv2, NULL); 
     116        double t1 = tv1.tv_sec * 1000 + tv1.tv_usec / 1000; 
     117        double t2 = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; 
     118        printf("op = %f\n", t2 - t1); 
    98119        printf("speed = %d\n", speed); 
    99120} 
     
    149170 
    150171        //if (fin > fmax) fmax = fin; 
    151         fout = open("/dev/video16", O_WRONLY | O_NONBLOCK); 
     172        fout = open("/dev/video18", O_WRONLY | O_NONBLOCK); 
    152173        if (fout < 0) { 
    153                 fprintf(stderr, "Cannot open /dev/video16\n"); 
     174                fprintf(stderr, "Cannot open /dev/video17\n"); 
    154175                exit(1); 
    155176        } 
     
    166187                for (int x = 0; x < 720; x++) { 
    167188                        osd[y][x] = ((x >> 2) &1) ? 0xff00ff00: 0xff0000ff; 
     189                        osd[y][x] = 0x000000ff; //b 
     190                        osd[y][x] = 0x0000ff00; //g 
     191                        osd[y][x] = 0x00ff0000; //r 
     192                        osd[y][x] = 0x04040404; //r 
     193                        //osd[y][x] = 0xff000000; //a 
    168194                } 
    169195        } 
    170196#if 1 
    171         struct ivtvfb_ioctl_dma_host_to_ivtv_args fbargs; 
     197        struct ivtvfb_dma_frame fbargs; 
    172198        struct fb_fix_screeninfo si; 
     199        struct fb_var_screeninfo vi; 
    173200        struct v4l2_framebuffer fbuf; 
    174201        struct v4l2_format fmt; 
     
    176203        fbargs.source = osd; 
    177204        fbargs.dest_offset = 0; 
    178         fbargs.count = sizeof(osd); 
    179         ioctl(fout, VIDIOC_G_FBUF, &fbuf); 
     205        errno = 0; 
     206        int e = ioctl(fout, VIDIOC_G_FBUF, &fbuf); 
     207        printf("%d %s\n", e, strerror(errno)); 
    180208        for (fbi = 0; fbi < 10; fbi++) { 
    181209                char buf[99]; 
     
    186214                        continue; 
    187215                ioctl(ffb, FBIOGET_FSCREENINFO, &si); 
     216                printf("%lx %p\n", si.smem_start, fbuf.base); 
    188217                if (si.smem_start == (unsigned long)fbuf.base) 
    189218                        break; 
     
    195224                exit(1); 
    196225        } 
    197         ioctl(ffb, IVTVFB_IOCTL_PREP_FRAME, &fbargs); 
     226        ioctl(ffb, FBIOGET_VSCREENINFO, &vi); 
     227        printf("%d %d %d %d\n", vi.xres_virtual, vi.yres_virtual, vi.xres, vi.yres); 
     228        fbargs.count = vi.xres_virtual * vi.yres_virtual * 1; 
     229        for (int i = 0; i < 32; i++) { 
     230                memset(osd, (unsigned char)i, fbargs.count); 
     231                printf("byte = %02x\n", i); 
     232        ioctl(ffb, IVTVFB_IOC_DMA_FRAME, &fbargs); 
     233        for (int j = 0; j < 16; j++) 
     234        ioctl(ffb, FBIO_WAITFORVSYNC, 0); 
     235        } 
    198236        fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; 
    199237        ioctl(fout, VIDIOC_G_FMT, &fmt); 
     
    203241                        fmt.fmt.win.chromakey, 
    204242                        fmt.fmt.win.global_alpha); 
    205         fbuf.flags = V4L2_FBUF_FLAG_GLOBAL_ALPHA;//V4L2_FBUF_FLAG_CHROMAKEY; 
     243        fbuf.flags = V4L2_FBUF_FLAG_CHROMAKEY; 
    206244        ioctl(fout, VIDIOC_S_FBUF, &fbuf); 
    207         fmt.fmt.win.chromakey = 0xff0000ff
    208         fmt.fmt.win.global_alpha = 0
     245        fmt.fmt.win.chromakey = 63
     246        fmt.fmt.win.global_alpha = 0xff
    209247        ioctl(fout, VIDIOC_S_FMT, &fmt); 
    210248        //exit(0); 
  • ivtvtv/trunk/video.h

    r3872 r4015  
    2525#define _DVBVIDEO_H_ 
    2626 
    27 #include <linux/compiler.h> 
    28  
    29 #ifdef __KERNEL__ 
    30 #include <linux/types.h> 
    31 #else 
     27 
    3228#include <stdint.h> 
    3329#include <time.h> 
    34 #endif 
    3530 
    3631 
     
    111106 
    112107                struct { 
    113                         __u32 speed; 
     108                        /* 0 or 1000 specifies normal speed, 
     109                           1 specifies forward single stepping, 
     110                           -1 specifies backward single stepping, 
     111                           >1: playback at speed/1000 of the normal speed, 
     112                           <-1: reverse playback at (-speed/1000) of the normal speed. */ 
     113                        __s32 speed; 
    114114                        __u32 format; 
    115115                } play; 
     
    121121}; 
    122122 
     123/* FIELD_UNKNOWN can be used if the hardware does not know whether 
     124   the Vsync is for an odd, even or progressive (i.e. non-interlaced) 
     125   field. */ 
     126#define VIDEO_VSYNC_FIELD_UNKNOWN       (0) 
     127#define VIDEO_VSYNC_FIELD_ODD           (1) 
     128#define VIDEO_VSYNC_FIELD_EVEN          (2) 
     129#define VIDEO_VSYNC_FIELD_PROGRESSIVE   (3) 
    123130 
    124131struct video_event { 
     
    132139                video_size_t size; 
    133140                unsigned int frame_rate;        /* in frames per 1000sec */ 
     141                unsigned char vsync_field;      /* unknown/odd/even/progressive */ 
    134142        } u; 
    135143}; 
     
    146154 
    147155struct video_still_picture { 
    148         char __user *iFrame;        /* pointer to a single iframe in memory */ 
     156        char *iFrame;        /* pointer to a single iframe in memory */ 
    149157        int32_t size; 
    150158}; 
     
    179187typedef struct video_spu_palette {      /* SPU Palette information */ 
    180188        int length; 
    181         uint8_t __user *palette; 
     189        uint8_t *palette; 
    182190} video_spu_palette_t; 
    183191 
  • ivtvtv/trunk/videodev2.h

    r3872 r4015  
    146146        V4L2_BUF_TYPE_SLICED_VBI_CAPTURE   = 6, 
    147147        V4L2_BUF_TYPE_SLICED_VBI_OUTPUT    = 7, 
    148 #if 1 /*KEEP*/ 
     148#if 1 
    149149        /* Experimental */ 
    150150        V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, 
     
    268268        enum v4l2_colorspace    colorspace; 
    269269        __u32                   priv;           /* private data, depends on pixelformat */ 
    270         __u32                   left;   /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */ 
    271         __u32                   top;    /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */ 
    272270}; 
    273271 
     
    334332#define V4L2_FMT_FLAG_COMPRESSED 0x0001 
    335333 
    336 #if 1 /*KEEP*/ 
     334#if 1 
    337335        /* Experimental Frame Size and frame rate enumeration */ 
    338336/* 
     
    12271225 *      NOTE: EXPERIMENTAL API 
    12281226 */ 
    1229 #if 1 /*KEEP*/ 
     1227#if 1 
    12301228#define V4L2_ENC_IDX_FRAME_I    (0) 
    12311229#define V4L2_ENC_IDX_FRAME_P    (1) 
     
    13881386/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 
    13891387 
    1390 #define V4L2_CHIP_MATCH_ALWAYS     0  /* Match always (match_chip is not used) */ 
    1391 #define V4L2_CHIP_MATCH_HOST       1  /* Match against chip ID on host (0 for the host) */ 
    1392 #define V4L2_CHIP_MATCH_I2C_DRIVER 2  /* Match against I2C driver ID */ 
    1393 #define V4L2_CHIP_MATCH_I2C_ADDR   3  /* Match against I2C 7-bit address */ 
     1388#define V4L2_CHIP_MATCH_HOST       0  /* Match against chip ID on host (0 for the host) */ 
     1389#define V4L2_CHIP_MATCH_I2C_DRIVER 1  /* Match against I2C driver ID */ 
     1390#define V4L2_CHIP_MATCH_I2C_ADDR   2  /* Match against I2C 7-bit address */ 
    13941391 
    13951392struct v4l2_register { 
     
    14711468#define VIDIOC_S_EXT_CTRLS      _IOWR ('V', 72, struct v4l2_ext_controls) 
    14721469#define VIDIOC_TRY_EXT_CTRLS    _IOWR ('V', 73, struct v4l2_ext_controls) 
    1473 #if 1 /*KEEP*/ 
     1470#if 1 
    14741471#define VIDIOC_ENUM_FRAMESIZES  _IOWR ('V', 74, struct v4l2_frmsizeenum) 
    14751472#define VIDIOC_ENUM_FRAMEINTERVALS      _IOWR ('V', 75, struct v4l2_frmivalenum)