- Timestamp:
- 08/23/07 23:18:06 (1 year ago)
- Files:
-
- ivtvtv/trunk/ivtv-fb.h (modified) (3 diffs)
- ivtvtv/trunk/ivtv.h (modified) (1 diff)
- ivtvtv/trunk/ivtvtv.cpp (modified) (11 diffs)
- ivtvtv/trunk/video.h (modified) (6 diffs)
- ivtvtv/trunk/videodev2.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ivtvtv/trunk/ivtv-fb.h
r3872 r4015 1 1 /* 2 2 On Screen Display cx23415 Framebuffer driver 3 3 4 4 Copyright (C) 2006 Ian Armstrong <ian@iarmst.demon.co.uk> 5 5 … … 24 24 /* Framebuffer external API */ 25 25 26 struct ivtvfb_ ioctl_dma_host_to_ivtv_args{26 struct ivtvfb_dma_frame { 27 27 void __user *source; 28 28 unsigned long dest_offset; … … 30 30 }; 31 31 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) 34 33 35 34 #endif ivtvtv/trunk/ivtv.h
r3872 r4015 2 2 Public ivtv API header 3 3 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> 7 5 8 6 This program is free software; you can redistribute it and/or modify ivtvtv/trunk/ivtvtv.cpp
r3907 r4015 5 5 #include <fcntl.h> 6 6 #include <sys/ioctl.h> 7 #include <sys/time.h> 7 8 #include <errno.h> 8 9 … … 12 13 #include "ivtv-fb.h" 13 14 #include <linux/fb.h> 15 #include <linux/matroxfb.h> 14 16 } 15 17 … … 26 28 { 27 29 struct video_command cmd; 30 struct timeval tv1, tv2; 28 31 29 32 memset(&cmd, 0, sizeof(cmd)); 30 33 34 gettimeofday(&tv1, NULL); 31 35 switch (ch) { 32 36 case 'p': … … 45 49 speed = cmd.play.speed; 46 50 break; 51 case 'c': 52 cmd.cmd = VIDEO_CMD_CONTINUE; 53 ioctl(fh, VIDEO_COMMAND, &cmd); 54 break; 47 55 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); 48 65 cmd.cmd = VIDEO_CMD_PLAY; 49 66 cmd.play.speed = 1000; … … 96 113 break; 97 114 } 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); 98 119 printf("speed = %d\n", speed); 99 120 } … … 149 170 150 171 //if (fin > fmax) fmax = fin; 151 fout = open("/dev/video1 6", O_WRONLY | O_NONBLOCK);172 fout = open("/dev/video18", O_WRONLY | O_NONBLOCK); 152 173 if (fout < 0) { 153 fprintf(stderr, "Cannot open /dev/video1 6\n");174 fprintf(stderr, "Cannot open /dev/video17\n"); 154 175 exit(1); 155 176 } … … 166 187 for (int x = 0; x < 720; x++) { 167 188 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 168 194 } 169 195 } 170 196 #if 1 171 struct ivtvfb_ ioctl_dma_host_to_ivtv_argsfbargs;197 struct ivtvfb_dma_frame fbargs; 172 198 struct fb_fix_screeninfo si; 199 struct fb_var_screeninfo vi; 173 200 struct v4l2_framebuffer fbuf; 174 201 struct v4l2_format fmt; … … 176 203 fbargs.source = osd; 177 204 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)); 180 208 for (fbi = 0; fbi < 10; fbi++) { 181 209 char buf[99]; … … 186 214 continue; 187 215 ioctl(ffb, FBIOGET_FSCREENINFO, &si); 216 printf("%lx %p\n", si.smem_start, fbuf.base); 188 217 if (si.smem_start == (unsigned long)fbuf.base) 189 218 break; … … 195 224 exit(1); 196 225 } 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 } 198 236 fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; 199 237 ioctl(fout, VIDIOC_G_FMT, &fmt); … … 203 241 fmt.fmt.win.chromakey, 204 242 fmt.fmt.win.global_alpha); 205 fbuf.flags = V4L2_FBUF_FLAG_ GLOBAL_ALPHA;//V4L2_FBUF_FLAG_CHROMAKEY;243 fbuf.flags = V4L2_FBUF_FLAG_CHROMAKEY; 206 244 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; 209 247 ioctl(fout, VIDIOC_S_FMT, &fmt); 210 248 //exit(0); ivtvtv/trunk/video.h
r3872 r4015 25 25 #define _DVBVIDEO_H_ 26 26 27 #include <linux/compiler.h> 28 29 #ifdef __KERNEL__ 30 #include <linux/types.h> 31 #else 27 32 28 #include <stdint.h> 33 29 #include <time.h> 34 #endif35 30 36 31 … … 111 106 112 107 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; 114 114 __u32 format; 115 115 } play; … … 121 121 }; 122 122 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) 123 130 124 131 struct video_event { … … 132 139 video_size_t size; 133 140 unsigned int frame_rate; /* in frames per 1000sec */ 141 unsigned char vsync_field; /* unknown/odd/even/progressive */ 134 142 } u; 135 143 }; … … 146 154 147 155 struct video_still_picture { 148 char __user*iFrame; /* pointer to a single iframe in memory */156 char *iFrame; /* pointer to a single iframe in memory */ 149 157 int32_t size; 150 158 }; … … 179 187 typedef struct video_spu_palette { /* SPU Palette information */ 180 188 int length; 181 uint8_t __user*palette;189 uint8_t *palette; 182 190 } video_spu_palette_t; 183 191 ivtvtv/trunk/videodev2.h
r3872 r4015 146 146 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, 147 147 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, 148 #if 1 /*KEEP*/148 #if 1 149 149 /* Experimental */ 150 150 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, … … 268 268 enum v4l2_colorspace colorspace; 269 269 __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 */272 270 }; 273 271 … … 334 332 #define V4L2_FMT_FLAG_COMPRESSED 0x0001 335 333 336 #if 1 /*KEEP*/334 #if 1 337 335 /* Experimental Frame Size and frame rate enumeration */ 338 336 /* … … 1227 1225 * NOTE: EXPERIMENTAL API 1228 1226 */ 1229 #if 1 /*KEEP*/1227 #if 1 1230 1228 #define V4L2_ENC_IDX_FRAME_I (0) 1231 1229 #define V4L2_ENC_IDX_FRAME_P (1) … … 1388 1386 /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1389 1387 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 */ 1394 1391 1395 1392 struct v4l2_register { … … 1471 1468 #define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1472 1469 #define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 1473 #if 1 /*KEEP*/1470 #if 1 1474 1471 #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1475 1472 #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
