From patchwork Fri Aug 26 07:49:03 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Alberto Reguero X-Patchwork-Id: 11990 Received: from stress.telefonica.net ([213.4.129.135] helo=telesmtp3.mail.isp) by www.linuxtv.org with esmtp (Exim 4.34) id 1E8Yxa-00012m-61 for vdr@linuxtv.org; Fri, 26 Aug 2005 09:49:10 +0200 Received: from jar.dominio ([80.25.230.35]) by telesmtp3.mail.isp (terra.es) with ESMTP id ILTKDT02.03H for ; Fri, 26 Aug 2005 09:49:05 +0200 From: Jose Alberto Reguero To: Klaus Schmidinger's VDR Date: Fri, 26 Aug 2005 09:49:03 +0200 User-Agent: KMail/1.8.2 MIME-Version: 1.0 Message-Id: <200508260949.03732.jareguero@telefonica.net> Subject: [vdr] Patch for pvrinput X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2005 07:49:10 -0000 Status: O X-Status: X-Keywords: X-UID: 4470 Patch for pvrinput to work with the new 0.3 drivers and a small fix for inputs other than tuner. Jose Alberto diff -aur pvrinput-0.0.3/device.c pvrinput-0.0.3.coque/device.c --- pvrinput-0.0.3/device.c 2005-07-23 11:19:07.000000000 +0200 +++ pvrinput-0.0.3.coque/device.c 2005-08-26 09:34:48.000000000 +0200 @@ -194,7 +194,11 @@ if (vbi_fd >= 0) { +#if 0 r = read(vbi_fd, buffer, fmt.io_size); +#else + r = read(vbi_fd, buffer, fmt.io_size * 32); +#endif if (r == -1) { log(0, "Error reading from vbi device, %d:%s", errno, strerror(errno)); @@ -262,6 +266,7 @@ vpid(-1), apid(-1), tpid(-1), + lastInput(-1), dvrOpen(false), delivered(false) { @@ -513,7 +518,7 @@ codec.bitrate_mode = bitrateCBR; codec.framespergop = PvrSetup.FramesPerGop; // 15 for NTSC - codec.bframes = PvrSetup.BFrames + 1; + codec.bframes = PvrSetup.BFrames; codec.gop_closure = PvrSetup.GopClosure; codec.dnr_mode = PvrSetup.DnrMode; @@ -670,6 +675,11 @@ } else // don't use tuner { + if (radio_fd >= 0) + { + close(radio_fd); + radio_fd = -1; + } if (input != lastInput) { if (SetInput(input) == false) diff -aur pvrinput-0.0.3/ivtv.h pvrinput-0.0.3.coque/ivtv.h --- pvrinput-0.0.3/ivtv.h 2005-06-05 15:37:58.000000000 +0200 +++ pvrinput-0.0.3.coque/ivtv.h 2005-08-22 21:28:23.000000000 +0200 @@ -41,37 +41,52 @@ #define IVTV_SLICED_CAPTION_525 (1 << 2) #define IVTV_SLICED_WSS_625 (1 << 3) #define IVTV_SLICED_VPS (1 << 4) +#define IVTV_SLICED_UNKNOWN (~0) +#define IVTV_SLICED_625 (IVTV_SLICED_TELETEXT_B| \ + IVTV_SLICED_WSS_625|IVTV_SLICED_VPS) +#define IVTV_SLICED_525 (IVTV_SLICED_CAPTION_525) + +#define IVTV_YUV_TYPE_HME12 0 /* Hauppauge macro block format */ +#define IVTV_YUV_TYPE_FOURCC_YV12 1 struct ivtv_sliced_vbi_format { - unsigned long service_set; /* one or more of the IVTV_SLICED_ defines */ - unsigned long packet_size; /* the size in bytes of the ivtv_sliced_data packet */ - unsigned long io_size; /* maximum number of bytes passed by one read() call */ - unsigned long reserved; + uint32_t service_set; /* one or more of the IVTV_SLICED_ defines */ + uint32_t packet_size; /* the size in bytes of the ivtv_sliced_data packet */ + uint32_t io_size; /* maximum number of bytes passed by one read() call */ + uint32_t reserved; }; /* This structure is the same as the proposed v4l2_sliced_data structure */ /* id is one of the VBI_SLICED_ flags. */ struct ivtv_sliced_data { - unsigned long id; - unsigned long line; + uint32_t id; + uint32_t line; unsigned char data[0]; }; +struct ivtv_sliced_fmt { + uint32_t service_set; /* one or more of the IVTV_SLICED_ defines */ + uint32_t service_lines[2][24]; + uint32_t packet_size; /* the size in bytes of the ivtv_sliced_data packet */ + uint32_t io_size; /* maximum number of bytes passed by one read() call */ + uint32_t reserved; +}; + /* The four bit VBI data type found in the embedded VBI data of an MPEG stream has one of the following values: */ -#define VBI_TYPE_TELETEXT 0x1 // Teletext (uses lines 6-22 for PAL, 10-21 for NTSC) -#define VBI_TYPE_CC 0x4 // Closed Captions (line 21 NTSC, line 22 PAL) -#define VBI_TYPE_WSS 0x5 // Wide Screen Signal (line 20 NTSC, line 23 PAL) -#define VBI_TYPE_VPS 0x7 // Video Programming System (PAL) (line 16) +#define VBI_TYPE_TELETEXT 0x1 // Teletext (uses lines 6-22 for PAL, 10-21 for NTSC) +#define VBI_TYPE_CC 0x4 // Closed Captions (line 21 NTSC, line 22 PAL) +#define VBI_TYPE_WSS 0x5 // Wide Screen Signal (line 20 NTSC, line 23 PAL) +#define VBI_TYPE_VPS 0x7 // Video Programming System (PAL) (line 16) /* These data types are not (yet?) used but are already reserved for future use. */ #ifdef IVTV_INTERNAL -#define VBI_TYPE_NABST 0x2 // NABST (NTSC) -#define VBI_TYPE_MOJI 0x3 // MOJI (NTSC) -#define VBI_TYPE_VITC 0x6 // Vertical Interval Time Code -#define VBI_TYPE_GEMSTAR2X 0x7 // Gemstar TV Guide (NTSC) -#define VBI_TYPE_GEMSTAR1X 0x8 // Gemstar TV Guide (NTSC) +#define VBI_TYPE_NABST 0x2 // NABST (NTSC) +#define VBI_TYPE_MOJI 0x3 // MOJI (NTSC) +#define VBI_TYPE_VITC 0x6 // Vertical Interval Time Code +#define VBI_TYPE_GEMSTAR2X 0x7 // Gemstar TV Guide (NTSC) +#define VBI_TYPE_GEMSTAR1X 0x8 // Gemstar TV Guide (NTSC) #endif /* device ioctls should use the range 29-199 */ @@ -83,6 +98,10 @@ #define IVTV_IOC_DEC_FLUSH _IOW ('@', 34, int) #define IVTV_IOC_S_VBI_MODE _IOWR('@', 35, struct ivtv_sliced_vbi_format) #define IVTV_IOC_G_VBI_MODE _IOR ('@', 36, struct ivtv_sliced_vbi_format) +#define IVTV_IOC_S_VBI_FMT _IOWR('@', 75, struct ivtv_sliced_fmt) +#define IVTV_IOC_G_VBI_FMT _IOR ('@', 76, struct ivtv_sliced_fmt) +#define IVTV_IOC_TRY_VBI_FMT _IOWR('@', 77, struct ivtv_sliced_fmt) +#define IVTV_IOC_G_VBI_CAP _IOR ('@', 78, struct ivtv_sliced_fmt) #define IVTV_IOC_PLAY _IO ('@', 37) #define IVTV_IOC_PAUSE _IO ('@', 38) #define IVTV_IOC_FRAMESYNC _IOR ('@', 39, struct ivtv_ioctl_framesync) @@ -101,20 +120,24 @@ #define IVTV_IOC_G_VBI_EMBED _IOR ('@', 55, int) #define IVTV_IOC_PAUSE_ENCODE _IO ('@', 56) #define IVTV_IOC_RESUME_ENCODE _IO ('@', 57) +#define IVTV_IOC_DEC_SPLICE _IOW ('@', 58, int) +#define IVTV_IOC_DEC_FAST_STOP _IOW ('@', 59, int) +#define IVTV_IOC_PREP_FRAME_YUV _IOW ('@', 60, struct ivtvyuv_ioctl_dma_host_to_ivtv_args) -#define PACK_ME __attribute__((packed)) // Note: You only append to this structure, you never reorder the members, // you never play tricks with its alignment, you never change the size of // anything. #define IVTV_DRIVER_INFO_MAX_COMMENT_LENGTH 100 struct ivtv_driver_info { - uint32_t size; // size of this structure - uint32_t version; // version bits 31-16 = major, 15-8 = minor, - // 7-0 = patchlevel + uint32_t size; // size of this structure + uint32_t version; // version bits 31-16 = major, 15-8 = minor, + // 7-0 = patchlevel char comment[IVTV_DRIVER_INFO_MAX_COMMENT_LENGTH]; -} PACK_ME; + uint32_t cardnr; // the ivtv card number (0-based) +} __attribute__((packed)); #define IVTV_DRIVER_INFO_V1_SIZE 108 +#define IVTV_DRIVER_INFO_V2_SIZE 112 #define IVTV_IOC_G_DRIVER_INFO _IOWR('@', 100, struct ivtv_driver_info *) @@ -187,98 +210,124 @@ }; struct ivtv_speed { - int scale; /* 1-?? (50 for now) */ - int smooth; /* Smooth mode when in slow/fast mode */ - int speed; /* 0 = slow, 1 = fast */ - int direction; /* 0 = forward, 1 = reverse (not supportd */ - int fr_mask; /* 0 = I, 1 = I,P, 2 = I,P,B 2 = default!*/ - int b_per_gop; /* frames per GOP (reverse only) */ - int aud_mute; /* Mute audio while in slow/fast mode */ - int fr_field; /* 1 = show every field, 0 = show every frame */ - int mute; /* # of audio frames to mute on playback resume */ + int scale; /* 1-?? (50 for now) */ + int smooth; /* Smooth mode when in slow/fast mode */ + int speed; /* 0 = slow, 1 = fast */ + int direction; /* 0 = forward, 1 = reverse (not supportd */ + int fr_mask; /* 0 = I, 1 = I,P, 2 = I,P,B 2 = default! */ + int b_per_gop; /* frames per GOP (reverse only) */ + int aud_mute; /* Mute audio while in slow/fast mode */ + int fr_field; /* 1 = show every field, 0 = show every frame */ + int mute; /* # of audio frames to mute on playback resume */ }; struct ivtv_slow_fast { - int speed; /* 0 = slow, 1 = fast */ - int scale; /* 1-?? (50 for now) */ -}; + int speed; /* 0 = slow, 1 = fast */ + int scale; /* 1-?? (50 for now) */ +}; struct ivtv_cfg_start_decode { - uint32_t gop_offset; /*Frames in GOP to skip before starting */ - uint32_t muted_audio_frames;/* #of audio frames to mute */ + uint32_t gop_offset; /*Frames in GOP to skip before starting */ + uint32_t muted_audio_frames; /* #of audio frames to mute */ }; struct ivtv_cfg_stop_decode { - int hide_last; /* 1 = show black after stop, - 0 = show last frame */ - uint64_t pts_stop; /* PTS to stop at */ + int hide_last; /* 1 = show black after stop, + 0 = show last frame */ + uint64_t pts_stop; /* PTS to stop at */ }; - /* For use with IVTV_IOC_G_CODEC and IVTV_IOC_S_CODEC */ struct ivtv_ioctl_codec { - uint32_t aspect; - uint32_t audio_bitmask; - uint32_t bframes; - uint32_t bitrate_mode; - uint32_t bitrate; - uint32_t bitrate_peak; - uint32_t dnr_mode; - uint32_t dnr_spatial; - uint32_t dnr_temporal; - uint32_t dnr_type; - uint32_t framerate; /* read only, ignored on write */ - uint32_t framespergop; /* read only, ignored on write */ - uint32_t gop_closure; - uint32_t pulldown; - uint32_t stream_type; + uint32_t aspect; + uint32_t audio_bitmask; + uint32_t bframes; + uint32_t bitrate_mode; + uint32_t bitrate; + uint32_t bitrate_peak; + uint32_t dnr_mode; + uint32_t dnr_spatial; + uint32_t dnr_temporal; + uint32_t dnr_type; + uint32_t framerate; /* read only, ignored on write */ + uint32_t framespergop; /* read only, ignored on write */ + uint32_t gop_closure; + uint32_t pulldown; + uint32_t stream_type; }; - /* Framebuffer external API */ struct ivtvfb_ioctl_state_info { - unsigned long status; - unsigned long alpha; + unsigned long status; + unsigned long alpha; +}; + +struct ivtvfb_ioctl_colorkey { + int state; + uint32_t colorKey; }; struct ivtvfb_ioctl_blt_copy_args { - int x, y, width, height, source_offset, source_stride; + int x, y, width, height, source_offset, source_stride; }; struct ivtvfb_ioctl_blt_fill_args { - int rasterop, alpha_mode, alpha_mask, width, height, x, y; - unsigned int destPixelMask, colour; + int rasterop, alpha_mode, alpha_mask, width, height, x, y; + unsigned int destPixelMask, colour; }; struct ivtvfb_ioctl_dma_host_to_ivtv_args { - void* source; - unsigned long dest_offset; - int count; + void *source; + unsigned long dest_offset; + int count; +}; + +struct ivtvyuv_ioctl_dma_host_to_ivtv_args { + void *y_source; + void *uv_source; + unsigned int yuv_type; + int src_x; + int src_y; + int src_w; + int src_h; + int dst_x; + int dst_y; + int dst_w; + int dst_h; + int srcBuf_width; + int srcBuf_height; }; struct ivtvfb_ioctl_get_frame_buffer { - void* mem; - int size; - int sizex; - int sizey; + void *mem; + int size; + int sizex; + int sizey; }; struct ivtv_osd_coords { - unsigned long offset; - unsigned long max_offset; - int pixel_stride; - int lines; - int x; - int y; + unsigned long offset; + unsigned long max_offset; + int pixel_stride; + int lines; + int x; + int y; }; struct rectangle { - int x0; - int y0; - int x1; - int y1; + int x0; + int y0; + int x1; + int y1; +}; + +struct ivtvfb_ioctl_set_window { + int width; + int height; + int left; + int top; }; /* Framebuffer ioctls should use the range 1 - 28 */ @@ -290,6 +339,10 @@ #define IVTVFB_IOCTL_SET_ACTIVE_BUFFER _IOW('@', 6, struct ivtv_osd_coords) #define IVTVFB_IOCTL_GET_FRAME_BUFFER _IOR('@', 7, struct ivtvfb_ioctl_get_frame_buffer) #define IVTVFB_IOCTL_BLT_FILL _IOW('@', 8, struct ivtvfb_ioctl_blt_fill_args) +#define IVTVFB_IOCTL_PREP_FRAME_BUF _IOW('@', 9, struct ivtvfb_ioctl_dma_host_to_ivtv_args) +#define IVTVFB_IOCTL_SET_WINDOW _IOW('@', 11, struct ivtvfb_ioctl_set_window) +#define IVTVFB_IOCTL_GET_COLORKEY _IOW('@', 12, struct ivtvfb_ioctl_colorkey) +#define IVTVFB_IOCTL_SET_COLORKEY _IOW('@', 13, struct ivtvfb_ioctl_colorkey) #define IVTVFB_STATUS_ENABLED (1 << 0) #define IVTVFB_STATUS_GLOBAL_ALPHA (1 << 1) @@ -300,6 +353,25 @@ /* Do not use these structures and ioctls in code that you want to release. Only to be used for testing and by the utilities ivtvctl, ivtvfbctl and fwapi. */ +#define IVTV_ENC_STREAM_TYPE_MPG 0 +#define IVTV_ENC_STREAM_TYPE_YUV 1 +#define IVTV_ENC_STREAM_TYPE_VBI 2 +#define IVTV_ENC_STREAM_TYPE_PCM 3 +#define IVTV_ENC_STREAM_TYPE_RAD 4 +#define IVTV_DEC_STREAM_TYPE_MPG 5 +#define IVTV_DEC_STREAM_TYPE_VBI 6 +#define IVTV_DEC_STREAM_TYPE_VOUT 7 +#define IVTV_DEC_STREAM_TYPE_YUV 8 +#define IVTV_DEC_STREAM_TYPE_OSD 9 + +struct ivtv_stream_info { + uint32_t size; + uint32_t type; +} __attribute__((packed)); + +#define IVTV_STREAM_INFO_V1_SIZE 8 +#define IVTV_IOC_G_STREAM_INFO _IOWR('@', 101, struct ivtv_stream_info *) + #define IVTV_MBOX_MAX_DATA 16 struct ivtv_ioctl_fwapi { @@ -310,14 +382,14 @@ }; struct ivtv_ioctl_event { - uint32_t type; - uint32_t mbox; + uint32_t type; + uint32_t mbox; struct ivtv_ioctl_fwapi api; }; struct ivtv_saa71xx_reg { - unsigned char reg; - unsigned char val; + uint32_t reg; + uint32_t val; }; struct ivtv_itvc_reg { @@ -325,34 +397,25 @@ uint32_t val; }; -/** IOCTL argument structure to get settings from the CX25840 driver. This is from cx25840.h! */ -struct ivtv_cx25840_reg -{ - /** Index of register if known. Otherwise -1 for unknown (on set). */ - int index; - /** Setting name. If settingIndex is known on set, this value is ignored. */ - char name[ 80 ]; - /** Setting value. */ - int value; - /** Value description (for get). */ - char description[ 120 ]; +struct ivtv_cx25840_setting { + uint32_t index; + uint32_t value; }; - struct ivtv_msp_matrix { int input; int output; }; /* Debug flags */ -#define IVTV_DEBUG_ERR (1 << 0) -#define IVTV_DEBUG_INFO (1 << 1) -#define IVTV_DEBUG_API (1 << 2) -#define IVTV_DEBUG_DMA (1 << 3) -#define IVTV_DEBUG_IOCTL (1 << 4) -#define IVTV_DEBUG_I2C (1 << 5) -#define IVTV_DEBUG_IRQ (1 << 6) -#define IVTV_DEBUG_DEC (1 << 7) +#define IVTV_DBGFLG_WARN (1 << 0) +#define IVTV_DBGFLG_INFO (1 << 1) +#define IVTV_DBGFLG_API (1 << 2) +#define IVTV_DBGFLG_DMA (1 << 3) +#define IVTV_DBGFLG_IOCTL (1 << 4) +#define IVTV_DBGFLG_I2C (1 << 5) +#define IVTV_DBGFLG_IRQ (1 << 6) +#define IVTV_DBGFLG_DEC (1 << 7) /* BLT RasterOps */ #define IVTV_BLT_RASTER_ZERO 0 @@ -363,7 +426,7 @@ #define IVTV_BLT_RASTER_NOTSRC 5 #define IVTV_BLT_RASTER_DEST_XOR_SRC 6 #define IVTV_BLT_RASTER_NOTDEST_OR_NOTSRC 7 -/* #define IVTV_BLT_RASTER_NOTDEST_AND_NOTSRC 8 */ /* Same as 1 */ + /* #define IVTV_BLT_RASTER_NOTDEST_AND_NOTSRC 8 *//* Same as 1 */ #define IVTV_BLT_RASTER_DEST_XNOR_SRC 9 #define IVTV_BLT_RASTER_SRC 10 #define IVTV_BLT_RASTER_NOTDEST_OR_SRC 11 @@ -376,14 +439,13 @@ #define IVTV_BLT_ALPHABLEND_SRC 0x01 #define IVTV_BLT_ALPHABLEND_DEST 0x10 -#define IVTV_BLT_ALPHABLEND_DEST_X_SRC 0x11 /* dest x src +1 , = zero if both zero */ - +#define IVTV_BLT_ALPHABLEND_DEST_X_SRC 0x11 /* dest x src +1 , = zero if both zero */ /* Internal ioctls should use the range 200-255 */ #define IVTV_IOC_S_DEBUG_LEVEL _IOWR('@', 200, int) #define IVTV_IOC_G_DEBUG_LEVEL _IOR ('@', 201, int) #define IVTV_IOC_RELOAD_FW _IO ('@', 202) -#define IVTV_IOC_ZCOUNT _IO ('@', 203) +#define IVTV_IOC_ZCOUNT _IO ('@', 203) #define IVTV_IOC_FWAPI _IOWR('@', 204, struct ivtv_ioctl_fwapi) #define IVTV_IOC_EVENT_SETUP _IOWR('@', 205, struct ivtv_ioctl_event) #define IVTV_IOC_G_SAA7115_REG _IOWR('@', 206, struct ivtv_saa71xx_reg) @@ -393,10 +455,11 @@ #define IVTV_IOC_S_MSP_MATRIX _IOW ('@', 210, struct ivtv_msp_matrix) #define IVTV_IOC_G_ITVC_REG _IOWR('@', 211, struct ivtv_itvc_reg) #define IVTV_IOC_S_ITVC_REG _IOW ('@', 212, struct ivtv_itvc_reg) -#define IVTV_IOC_G_CX25840_REG _IOWR('@', 213, struct ivtv_cx25840_reg) -#define IVTV_IOC_S_CX25840_REG _IOW ('@', 214, struct ivtv_cx25840_reg) +#define IVTV_IOC_G_CX25840_SETTING _IOWR('@', 213, struct ivtv_cx25840_setting) +#define IVTV_IOC_S_CX25840_SETTING _IOW ('@', 214, struct ivtv_cx25840_setting) +#define IVTV_IOC_G_VIDEO_STATUS _IOR ('@', 215, int *) +#define IVTV_IOC_RESET_IR _IO ('@', 216) #endif #endif -