Ticket #2954: 2954-v2.patch
File 2954-v2.patch, 35.7 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/cardutil.h
177 177 178 178 // V4L info 179 179 static bool hasV4L2(int videofd); 180 static bool GetV4LInfo(int videofd, QString &card,QString &driver); 180 static bool GetV4LInfo(int videofd, QString &card, QString &driver, 181 uint32_t &version); 182 static bool GetV4LInfo(int videofd, QString &card, QString &driver) 183 { uint32_t dummy; return GetV4LInfo(videofd, card, driver, dummy); } 181 184 static InputNames probeV4LInputs(int videofd, bool &ok); 182 185 183 186 private: -
libs/libmythtv/dbcheck.cpp
10 10 #include "mythdbcon.h" 11 11 12 12 /// This is the DB schema version expected by the running MythTV instance. 13 const QString currentDatabaseVersion = "117 5";13 const QString currentDatabaseVersion = "1176"; 14 14 15 15 static bool UpdateDBVersionNumber(const QString &newnumber); 16 16 static bool performActualUpdate(const QString updates[], QString version, … … 2803 2803 return false; 2804 2804 } 2805 2805 2806 if (dbver == "1175") 2807 { 2808 QString thequery = 2809 "SELECT id " 2810 "FROM recordingprofiles " 2811 "WHERE profilegroup=2"; 2812 2813 MSqlQuery query(MSqlQuery::InitCon()); 2814 query.prepare(thequery); 2815 if (!query.exec()) 2816 { 2817 QString msg = 2818 QString("DB Error (Performing database upgrade): \n" 2819 "Query was: %1 \nError was: %2 \nnew version: %3") 2820 .arg(thequery) 2821 .arg(MythContext::DBErrorMessage(query.lastError())) 2822 .arg("1176"); 2823 VERBOSE(VB_IMPORTANT, msg); 2824 return false; 2825 } 2826 2827 MSqlQuery query2(MSqlQuery::InitCon()); 2828 QString in = "("; 2829 while (query.next()) 2830 { 2831 uint profile = query.value(0).toUInt(); 2832 QString generic = 2833 "SELECT value " 2834 "FROM codecparams " 2835 "WHERE name='%1' AND profile = '%2'"; 2836 QString wquery = generic.arg("width").arg(profile); 2837 QString hquery = generic.arg("height").arg(profile); 2838 int width = 0, height = 0; 2839 if (query2.exec(wquery) && query2.next()) 2840 width = query2.value(0).toInt(); 2841 if (query2.exec(hquery) && query2.next()) 2842 height = query2.value(0).toInt(); 2843 2844 if (width && height && (width == 480) && (height == 480)) 2845 in += QString::number(profile) + ","; 2846 } 2847 2848 thequery = ""; 2849 if (in.length() > 2) 2850 { 2851 in.truncate(in.length() - 1); 2852 thequery = 2853 "DELETE FROM codecparams " 2854 "WHERE name in ('width','height') AND" 2855 " profile IN " + in + ")"; 2856 } 2857 2858 const QString updates[] = { 2859 thequery, 2860 ""}; 2861 2862 if (!performActualUpdate(updates, "1176", dbver)) 2863 return false; 2864 } 2865 2866 2806 2867 //"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22 2807 2868 //"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22 2808 2869 //"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22 -
libs/libmythtv/mpegrecorder.h
55 55 bool OpenV4L2DeviceAsInput(void); 56 56 bool SetIVTVDeviceOptions(int chanfd); 57 57 bool SetV4L2DeviceOptions(int chanfd); 58 bool SetVBIOptions(int chanfd); 58 59 59 60 void ResetForNewFile(void); 60 61 61 62 bool deviceIsMpegFile; 62 63 int bufferSize; 63 64 65 // Config 66 bool ignore_vbi_bug; 67 68 // Driver info 69 QString card; 70 QString driver; 71 uint32_t version; 72 bool usingv4l2; 73 bool has_buggy_vbi; 74 bool has_v4l2_vbi; 75 64 76 // State 65 77 bool recording; 66 78 bool encoding; -
libs/libmythtv/ivtv_myth.h
1 #define IVTV_IOC_FWAPI 0xFFEE7701 /*just some values i picked for now*/ 2 #define IVTV_IOC_ZCOUNT 0xFFEE7702 3 #ifdef __FreeBSD__ 4 #define IVTV_IOC_G_CODEC _IOR ('V', 73, struct ivtv_ioctl_codec) 5 #define IVTV_IOC_S_CODEC _IOWR ('V', 74, struct ivtv_ioctl_codec) 6 #else 7 #define IVTV_IOC_G_CODEC 0xFFEE7703 8 #define IVTV_IOC_S_CODEC 0xFFEE7704 9 #endif 1 /* 2 Public ivtv API header 3 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> 10 4 11 #define IVTV_MBOX_MAX_DATA 16 5 VBI portions: 6 Copyright (C) 2004 Hans Verkuil <hverkuil@xs4all.nl> 12 7 13 #define IVTV_SLICED_TELETEXT_B (1 << 0) 14 #define IVTV_SLICED_CAPTION_625 (1 << 1) 15 #define IVTV_SLICED_CAPTION_525 (1 << 2) 16 #define IVTV_SLICED_WSS_625 (1 << 3) 17 #define IVTV_SLICED_VPS (1 << 4) 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 18 12 19 struct ivtv_sliced_vbi_format { 20 unsigned long service_set; /* one or more of the IVTV_SLICED_ defines */ 21 unsigned long packet_size; /* the size in bytes of the ivtv_sliced_data packet */ 22 unsigned long io_size; /* maximum number of bytes passed by one read() call */ 23 unsigned long reserved; 24 }; 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 25 17 26 /* This structure is the same as the proposed v4l2_sliced_data structure */ 27 /* id is one of the VBI_SLICED_ flags. */ 28 struct ivtv_sliced_data { 29 unsigned long id; 30 unsigned long line; 31 unsigned char *data; 32 }; 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 33 22 34 /* The four bit VBI data type found in the embedded VBI data of an 35 MPEG stream has one of the following values: */ 36 #define VBI_TYPE_TELETEXT 0x1 // Teletext (uses lines 6-22 for PAL, 10-21 for NTSC) 37 #define VBI_TYPE_CC 0x4 // Closed Captions (line 21 NTSC, line 22 PAL) 38 #define VBI_TYPE_WSS 0x5 // Wide Screen Signal (line 20 NTSC, line 23 PAL) 39 #define VBI_TYPE_VPS 0x7 // Video Programming System (PAL) (line 16) 23 #ifndef _LINUX_IVTV_H 24 #define _LINUX_IVTV_H 40 25 41 /* allow direct access to the saa7115 registers for testing */ 42 #define SAA7115_GET_REG 0xFFEE7705 43 #define SAA7115_SET_REG 0xFFEE7706 26 #define __u32 uint32_t 27 #define __u64 uint64_t 44 28 45 /* to set audio options */ 46 #define DECODER_SET_AUDIO 0xFFEE7707 47 #define DECODER_AUDIO_32_KHZ 0 48 #define DECODER_AUDIO_441_KHZ 1 49 #define DECODER_AUDIO_48_KHZ 2 29 /* NOTE: the ioctls in this file will eventually be replaced by v4l2 API 30 ioctls. */ 50 31 51 #define IVTV_IOC_PLAY 0xFFEE7781 52 #define IVTV_IOC_ PAUSE 0xFFEE778253 #define IVTV_IOC_ FRAMESYNC 0xFFEE778354 #define IVTV_IOC_G ET_TIMING 0xFFEE778455 #define IVTV_IOC_S_S LOW_FAST 0xFFEE778556 #define IVTV_IOC_ S_START_DECODE 0xFFEE778657 #define IVTV_IOC_ S_STOP_DECODE 0xFFEE778758 #define IVTV_IOC_ S_OSD 0xFFEE778859 #define IVTV_IOC_ GET_FB 0xFFEE778932 /* device ioctls should use the range 29-199 */ 33 #define IVTV_IOC_START_DECODE _IOW ('@', 29, struct ivtv_cfg_start_decode) 34 #define IVTV_IOC_STOP_DECODE _IOW ('@', 30, struct ivtv_cfg_stop_decode) 35 #define IVTV_IOC_G_SPEED _IOR ('@', 31, struct ivtv_speed) 36 #define IVTV_IOC_S_SPEED _IOW ('@', 32, struct ivtv_speed) 37 #define IVTV_IOC_DEC_STEP _IOW ('@', 33, int) 38 #define IVTV_IOC_DEC_FLUSH _IOW ('@', 34, int) 39 #define IVTV_IOC_PAUSE_BLACK _IO ('@', 35) 40 #define IVTV_IOC_STOP _IO ('@', 36) 60 41 61 #define IVTV_IOC_START_DECODE _IOW ('@', 29, struct ivtv_cfg_start_decode) 62 #define IVTV_IOC_STOP_DECODE _IOW ('@', 30, struct ivtv_cfg_stop_decode) 63 #define IVTV_IOC_G_SPEED _IOR ('@', 31, struct ivtv_speed) 64 #define IVTV_IOC_S_SPEED _IOW ('@', 32, struct ivtv_speed) 65 #define IVTV_IOC_DEC_STEP _IOW ('@', 33, int) 66 #define IVTV_IOC_DEC_FLUSH _IOW ('@', 34, int) 67 #define IVTV_IOC_S_VBI_MODE _IOWR('@', 35, struct ivtv_sliced_vbi_format) 68 #define IVTV_IOC_G_VBI_MODE _IOR ('@', 36, struct ivtv_sliced_vbi_format) 69 #define IVTV_IOC_S_VBI_EMBED _IOW ('@', 54, int) 70 #define IVTV_IOC_G_VBI_EMBED _IOR ('@', 55, int) 42 #define IVTV_IOC_S_VBI_MODE _IOWR('@', 35, struct ivtv_sliced_vbi_format) /* old ioctl */ 43 #define IVTV_IOC_G_VBI_MODE _IOR ('@', 36, struct ivtv_sliced_vbi_format) /* old ioctl */ 71 44 72 /* ioctl for MSP_SET_MATRIX will have to be registered */ 73 #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) 45 #define IVTV_IOC_PLAY _IO ('@', 37) 46 #define IVTV_IOC_PAUSE _IO ('@', 38) 47 #define IVTV_IOC_FRAMESYNC _IOR ('@', 39, struct ivtv_ioctl_framesync) 48 #define IVTV_IOC_GET_TIMING _IOR ('@', 40, struct ivtv_ioctl_framesync) 49 #define IVTV_IOC_S_SLOW_FAST _IOW ('@', 41, struct ivtv_slow_fast) 50 #define IVTV_IOC_GET_FB _IOR ('@', 44, int) 51 #define IVTV_IOC_S_GOP_END _IOWR('@', 50, int) 52 #define IVTV_IOC_S_VBI_PASSTHROUGH _IOW ('@', 51, int) 53 #define IVTV_IOC_G_VBI_PASSTHROUGH _IOR ('@', 52, int) 54 #define IVTV_IOC_PASSTHROUGH _IOW ('@', 53, int) 55 #define IVTV_IOC_S_VBI_EMBED _IOW ('@', 54, int) /* old ioctl */ 56 #define IVTV_IOC_G_VBI_EMBED _IOR ('@', 55, int) /* old ioctl */ 57 #define IVTV_IOC_PAUSE_ENCODE _IO ('@', 56) 58 #define IVTV_IOC_RESUME_ENCODE _IO ('@', 57) 59 #define IVTV_IOC_DEC_SPLICE _IOW ('@', 58, int) 60 #define IVTV_IOC_DEC_FAST_STOP _IOW ('@', 59, int) 61 #define IVTV_IOC_PREP_FRAME_YUV _IOW ('@', 60, struct ivtvyuv_ioctl_dma_host_to_ivtv_args) 62 #define IVTV_IOC_G_YUV_INTERLACE _IOR ('@', 61, struct ivtv_ioctl_yuv_interlace) 63 #define IVTV_IOC_S_YUV_INTERLACE _IOW ('@', 62, struct ivtv_ioctl_yuv_interlace) 64 #define IVTV_IOC_G_PTS _IOR ('@', 63, u64) 74 65 75 76 66 /* Custom v4l controls */ 77 67 #ifndef V4L2_CID_PRIVATE_BASE 78 68 #define V4L2_CID_PRIVATE_BASE 0x08000000 79 #endif 69 #endif /* V4L2_CID_PRIVATE_BASE */ 80 70 81 #define V4L2_CID_IVTV_FREQ (V4L2_CID_PRIVATE_BASE )82 #define V4L2_CID_IVTV_ENC (V4L2_CID_PRIVATE_BASE + 1) 83 #define V4L2_CID_IVTV_BITRATE (V4L2_CID_PRIVATE_BASE + 2) 84 #define V4L2_CID_IVTV_MONO (V4L2_CID_PRIVATE_BASE + 3) 85 #define V4L2_CID_IVTV_JOINT (V4L2_CID_PRIVATE_BASE + 4) 86 #define V4L2_CID_IVTV_EMPHASIS (V4L2_CID_PRIVATE_BASE + 5) 87 #define V4L2_CID_IVTV_CRC (V4L2_CID_PRIVATE_BASE + 6) 88 #define V4L2_CID_IVTV_COPYRIGHT (V4L2_CID_PRIVATE_BASE + 7) 89 #define V4L2_CID_IVTV_GEN (V4L2_CID_PRIVATE_BASE + 8) 71 #define V4L2_CID_IVTV_FREQ (V4L2_CID_PRIVATE_BASE + 0) /* old control */ 72 #define V4L2_CID_IVTV_ENC (V4L2_CID_PRIVATE_BASE + 1) /* old control */ 73 #define V4L2_CID_IVTV_BITRATE (V4L2_CID_PRIVATE_BASE + 2) /* old control */ 74 #define V4L2_CID_IVTV_MONO (V4L2_CID_PRIVATE_BASE + 3) /* old control */ 75 #define V4L2_CID_IVTV_JOINT (V4L2_CID_PRIVATE_BASE + 4) /* old control */ 76 #define V4L2_CID_IVTV_EMPHASIS (V4L2_CID_PRIVATE_BASE + 5) /* old control */ 77 #define V4L2_CID_IVTV_CRC (V4L2_CID_PRIVATE_BASE + 6) /* old control */ 78 #define V4L2_CID_IVTV_COPYRIGHT (V4L2_CID_PRIVATE_BASE + 7) /* old control */ 79 #define V4L2_CID_IVTV_GEN (V4L2_CID_PRIVATE_BASE + 8) /* old control */ 90 80 91 #define IVTV_V4L2_AUDIO_MENUCOUNT 9 /* # of v4l controls */ 81 #define V4L2_CID_IVTV_DEC_SMOOTH_FF (V4L2_CID_PRIVATE_BASE + 9) 82 #define V4L2_CID_IVTV_DEC_FR_MASK (V4L2_CID_PRIVATE_BASE + 10) 83 #define V4L2_CID_IVTV_DEC_SP_MUTE (V4L2_CID_PRIVATE_BASE + 11) 84 #define V4L2_CID_IVTV_DEC_FR_FIELD (V4L2_CID_PRIVATE_BASE + 12) 85 #define V4L2_CID_IVTV_DEC_AUD_SKIP (V4L2_CID_PRIVATE_BASE + 13) 86 #define V4L2_CID_IVTV_DEC_NUM_BUFFERS (V4L2_CID_PRIVATE_BASE + 14) 87 #define V4L2_CID_IVTV_DEC_PREBUFFER (V4L2_CID_PRIVATE_BASE + 15) 92 88 93 #define IVTV_DEC_PRIVATE_BASE (V4L2_CID_PRIVATE_BASE + IVTV_V4L2_AUDIO_MENUCOUNT)94 95 #define V4L2_CID_IVTV_DEC_SMOOTH_FF (IVTV_DEC_PRIVATE_BASE + 0)96 #define V4L2_CID_IVTV_DEC_FR_MASK (IVTV_DEC_PRIVATE_BASE + 1)97 #define V4L2_CID_IVTV_DEC_SP_MUTE (IVTV_DEC_PRIVATE_BASE + 2)98 #define V4L2_CID_IVTV_DEC_FR_FIELD (IVTV_DEC_PRIVATE_BASE + 3)99 #define V4L2_CID_IVTV_DEC_AUD_SKIP (IVTV_DEC_PRIVATE_BASE + 4)100 #define V4L2_CID_IVTV_DEC_NUM_BUFFERS (IVTV_DEC_PRIVATE_BASE + 5)101 #define V4L2_CID_IVTV_DEC_PREBUFFER (IVTV_DEC_PRIVATE_BASE + 6)102 103 #define IVTV_V4L2_DEC_MENUCOUNT 7104 105 struct ivtv_ioctl_fwapi {106 uint32_t cmd;107 uint32_t result;108 int32_t args;109 uint32_t data[IVTV_MBOX_MAX_DATA];110 };111 112 89 struct ivtv_ioctl_framesync { 113 uint32_tframe;114 uint64_tpts;115 uint64_tscr;90 __u32 frame; 91 __u64 pts; 92 __u64 scr; 116 93 }; 117 94 118 95 struct ivtv_speed { 119 int scale; /* 1-?? (50 for now) */120 int smooth; /* Smooth mode when in slow/fast mode */121 int speed; /* 0 = slow, 1 = fast */122 int direction; /* 0 = forward, 1 = reverse (not supportd */123 int fr_mask; /* 0 = I, 1 = I,P, 2 = I,P,B 2 = default!*/124 int b_per_gop; /* frames per GOP (reverse only) */125 int aud_mute; /* Mute audio while in slow/fast mode */126 int fr_field; /* 1 = show every field, 0 = show every frame */127 int mute; /* # of audio frames to mute on playback resume */96 int scale; /* 1-?? (50 for now) */ 97 int smooth; /* Smooth mode when in slow/fast mode */ 98 int speed; /* 0 = slow, 1 = fast */ 99 int direction; /* 0 = forward, 1 = reverse (not supportd */ 100 int fr_mask; /* 0 = I, 1 = I,P, 2 = I,P,B 2 = default! */ 101 int b_per_gop; /* frames per GOP (reverse only) */ 102 int aud_mute; /* Mute audio while in slow/fast mode */ 103 int fr_field; /* 1 = show every field, 0 = show every frame */ 104 int mute; /* # of audio frames to mute on playback resume */ 128 105 }; 129 106 130 107 struct ivtv_slow_fast { 131 int speed; 132 int scale; 133 }; 108 int speed; /* 0 = slow, 1 = fast */ 109 int scale; /* 1-?? (50 for now) */ 110 }; 134 111 135 112 struct ivtv_cfg_start_decode { 136 uint32_tgop_offset; /*Frames in GOP to skip before starting */137 uint32_t muted_audio_frames;/* #of audio frames to mute */113 __u32 gop_offset; /*Frames in GOP to skip before starting */ 114 __u32 muted_audio_frames; /* #of audio frames to mute */ 138 115 }; 139 116 140 117 struct ivtv_cfg_stop_decode { 141 int hide_last;/* 1 = show black after stop,142 143 uint64_t pts_stop;/* PTS to stop at */118 int hide_last; /* 1 = show black after stop, 119 0 = show last frame */ 120 __u64 pts_stop; /* PTS to stop at */ 144 121 }; 145 122 146 147 /* For use with IVTV_IOC_G_CODEC and IVTV_IOC_S_CODEC */ 148 struct ivtv_ioctl_codec { 149 uint32_t aspect; 150 uint32_t audio_bitmask; 151 uint32_t bframes; 152 uint32_t bitrate_mode; 153 uint32_t bitrate; 154 uint32_t bitrate_peak; 155 uint32_t dnr_mode; 156 uint32_t dnr_spatial; 157 uint32_t dnr_temporal; 158 uint32_t dnr_type; 159 uint32_t framerate; 160 uint32_t framespergop; 161 uint32_t gop_closure; 162 uint32_t pulldown; 163 uint32_t stream_type; 123 struct ivtv_ioctl_yuv_interlace{ 124 int interlace_mode; /* Takes one of IVTV_YUV_MODE_xxxxxx values */ 125 int threshold; /* If mode is auto then if src_height <= this value treat as progressive otherwise treat as interlaced */ 164 126 }; 127 #define IVTV_YUV_MODE_INTERLACED 0 128 #define IVTV_YUV_MODE_PROGRESSIVE 1 129 #define IVTV_YUV_MODE_AUTO 2 165 130 166 167 struct msp_matrix {168 int input;169 int output;170 };171 172 131 /* Framebuffer external API */ 173 /* NOTE: These must *exactly* match the structures and constants in driver/ivtv.h */174 132 175 133 struct ivtvfb_ioctl_state_info { 176 177 134 unsigned long status; 135 unsigned long alpha; 178 136 }; 179 137 138 struct ivtvfb_ioctl_colorkey { 139 int state; 140 __u32 colorKey; 141 }; 142 180 143 struct ivtvfb_ioctl_blt_copy_args { 181 144 int x, y, width, height, source_offset, source_stride; 182 145 }; 183 146 184 147 struct ivtvfb_ioctl_blt_fill_args { 185 186 148 int rasterop, alpha_mode, alpha_mask, width, height, x, y; 149 unsigned int destPixelMask, colour; 187 150 188 151 }; 189 152 190 153 struct ivtvfb_ioctl_dma_host_to_ivtv_args { 191 void*source;192 193 154 void *source; 155 unsigned long dest_offset; 156 int count; 194 157 }; 195 158 159 struct ivtvyuv_ioctl_dma_host_to_ivtv_args { 160 void *y_source; 161 void *uv_source; 162 unsigned int yuv_type; 163 int src_x; 164 int src_y; 165 unsigned int src_w; 166 unsigned int src_h; 167 int dst_x; 168 int dst_y; 169 unsigned int dst_w; 170 unsigned int dst_h; 171 int srcBuf_width; 172 int srcBuf_height; 173 }; 174 196 175 struct ivtvfb_ioctl_get_frame_buffer { 197 void*mem;198 intsize;199 intsizex;200 intsizey;176 void *mem; 177 int size; 178 int sizex; 179 int sizey; 201 180 }; 202 181 203 182 struct ivtv_osd_coords { 204 205 206 207 208 209 183 unsigned long offset; 184 unsigned long max_offset; 185 int pixel_stride; 186 int lines; 187 int x; 188 int y; 210 189 }; 211 190 212 191 struct rectangle { 213 214 215 216 192 int x0; 193 int y0; 194 int x1; 195 int y1; 217 196 }; 218 197 198 struct ivtvfb_ioctl_set_window { 199 int width; 200 int height; 201 int left; 202 int top; 203 }; 204 205 206 207 /* Framebuffer ioctls should use the range 1 - 28 */ 219 208 #define IVTVFB_IOCTL_GET_STATE _IOR('@', 1, struct ivtvfb_ioctl_state_info) 220 209 #define IVTVFB_IOCTL_SET_STATE _IOW('@', 2, struct ivtvfb_ioctl_state_info) 221 210 #define IVTVFB_IOCTL_PREP_FRAME _IOW('@', 3, struct ivtvfb_ioctl_dma_host_to_ivtv_args) … … 224 213 #define IVTVFB_IOCTL_SET_ACTIVE_BUFFER _IOW('@', 6, struct ivtv_osd_coords) 225 214 #define IVTVFB_IOCTL_GET_FRAME_BUFFER _IOR('@', 7, struct ivtvfb_ioctl_get_frame_buffer) 226 215 #define IVTVFB_IOCTL_BLT_FILL _IOW('@', 8, struct ivtvfb_ioctl_blt_fill_args) 216 #define IVTVFB_IOCTL_PREP_FRAME_BUF _IOW('@', 9, struct ivtvfb_ioctl_dma_host_to_ivtv_args) 217 #define IVTVFB_IOCTL_SET_WINDOW _IOW('@', 11, struct ivtvfb_ioctl_set_window) 218 #define IVTVFB_IOCTL_GET_COLORKEY _IOW('@', 12, struct ivtvfb_ioctl_colorkey) 219 #define IVTVFB_IOCTL_SET_COLORKEY _IOW('@', 13, struct ivtvfb_ioctl_colorkey) 227 220 228 221 #define IVTVFB_STATUS_ENABLED (1 << 0) 229 222 #define IVTVFB_STATUS_GLOBAL_ALPHA (1 << 1) 230 223 #define IVTVFB_STATUS_LOCAL_ALPHA (1 << 2) 231 224 #define IVTVFB_STATUS_FLICKER_REDUCTION (1 << 3) 232 225 233 #define IVTV_IOCTL_SET_DEBUG_LEVEL _IOWR('@', 98, int *) 234 #define IVTV_IOCTL_GET_DEBUG_LEVEL _IOR('@', 99, int *) 226 /********************************************************************/ 227 /* Old stuff */ 228 229 #define IVTV_IOC_G_CODEC _IOR ('V', 73, struct ivtv_ioctl_codec) 230 #define IVTV_IOC_S_CODEC _IOWR ('V', 74, struct ivtv_ioctl_codec) 231 232 #define IVTV_SLICED_TELETEXT_B (1 << 0) 233 #define IVTV_SLICED_CAPTION_625 (1 << 1) 234 #define IVTV_SLICED_CAPTION_525 (1 << 2) 235 #define IVTV_SLICED_WSS_625 (1 << 3) 236 #define IVTV_SLICED_VPS (1 << 4) 237 238 struct ivtv_sliced_vbi_format { 239 unsigned long service_set; /* one or more of the IVTV_SLICED_ defines */ 240 unsigned long packet_size; /* the size in bytes of the ivtv_sliced_data packet */ 241 unsigned long io_size; /* maximum number of bytes passed by one read() call */ 242 unsigned long reserved; 243 }; 244 245 /* This structure is the same as the proposed v4l2_sliced_data structure */ 246 /* id is one of the VBI_SLICED_ flags. */ 247 struct ivtv_sliced_data { 248 unsigned long id; 249 unsigned long line; 250 unsigned char *data; 251 }; 252 253 /* The four bit VBI data type found in the embedded VBI data of an 254 MPEG stream has one of the following values: */ 255 #define VBI_TYPE_TELETEXT 0x1 // Teletext (uses lines 6-22 for PAL, 10-21 for NTSC) 256 #define VBI_TYPE_CC 0x4 // Closed Captions (line 21 NTSC, line 22 PAL) 257 #define VBI_TYPE_WSS 0x5 // Wide Screen Signal (line 20 NTSC, line 23 PAL) 258 #define VBI_TYPE_VPS 0x7 // Video Programming System (PAL) (line 16) 259 260 /* For use with IVTV_IOC_G_CODEC and IVTV_IOC_S_CODEC */ 261 struct ivtv_ioctl_codec { 262 __u32 aspect; 263 __u32 audio_bitmask; 264 __u32 bframes; 265 __u32 bitrate_mode; 266 __u32 bitrate; 267 __u32 bitrate_peak; 268 __u32 dnr_mode; 269 __u32 dnr_spatial; 270 __u32 dnr_temporal; 271 __u32 dnr_type; 272 __u32 framerate; 273 __u32 framespergop; 274 __u32 gop_closure; 275 __u32 pulldown; 276 __u32 stream_type; 277 }; 278 279 #endif /* _LINUX_IVTV_H */ -
libs/libmythtv/cardutil.cpp
462 462 #endif // !USING_V4L 463 463 } 464 464 465 bool CardUtil::GetV4LInfo(int videofd, QString &card, QString &driver) 465 bool CardUtil::GetV4LInfo( 466 int videofd, QString &card, QString &driver, uint32_t &version) 466 467 { 467 468 card = driver = QString::null; 469 version = 0; 468 470 469 471 if (videofd < 0) 470 472 return false; … … 477 479 { 478 480 card.setAscii((char*)capability.card); 479 481 driver.setAscii((char*)capability.driver); 482 version = capability.version; 480 483 } 481 484 else // Fallback to V4L1 query 482 485 { -
libs/libmythtv/mpegrecorder.cpp
33 33 #include "tv_rec.h" 34 34 #include "videodev_myth.h" 35 35 #include "util.h" 36 #include "cardutil.h" 36 37 37 38 // ivtv header 38 39 extern "C" { … … 77 78 // Debugging variables 78 79 deviceIsMpegFile(false), 79 80 bufferSize(4096), 81 // Config 82 ignore_vbi_bug(false), 83 // Driver info 84 card(QString::null), driver(QString::null), 85 version(0), usingv4l2(false), 86 has_buggy_vbi(true), has_v4l2_vbi(false), 80 87 // State 81 88 recording(false), encoding(false), 82 89 errored(false), … … 103 110 buildbuffer(new unsigned char[kBuildBufferMaxSize + 1]), 104 111 buildbuffersize(0) 105 112 { 113 ignore_vbi_bug = gContext->GetNumSetting("IVTVIgnoreVBIBug", 0); 106 114 } 107 115 108 116 MpegRecorder::~MpegRecorder() … … 311 319 return false; 312 320 } 313 321 322 if (CardUtil::GetV4LInfo(chanfd, card, driver, version)) 323 { 324 usingv4l2 = (version >= KERNEL_VERSION(0, 8, 0)); 325 has_v4l2_vbi = (version >= KERNEL_VERSION(0, 3, 8)); 326 has_buggy_vbi = (version < KERNEL_VERSION(0, 10, 0)); 327 } 328 329 VERBOSE(VB_IMPORTANT, QString("IVTV VBI usingv4l2(%1) has_v4l2_vbi(%2) " 330 "has_buggy_vbi(%3)") 331 .arg(usingv4l2).arg(has_v4l2_vbi).arg(has_buggy_vbi)); 332 314 333 struct v4l2_format vfmt; 315 334 bzero(&vfmt, sizeof(vfmt)); 316 335 … … 374 393 "If you are using an AverMedia M179 card this is normal."); 375 394 } 376 395 377 if (!SetV4L2DeviceOptions(chanfd) && !SetIVTVDeviceOptions(chanfd)) 396 bool ok = true; 397 if (usingv4l2) 398 ok = SetV4L2DeviceOptions(chanfd); 399 else 400 ok = SetIVTVDeviceOptions(chanfd); 401 402 if (!ok) 378 403 return false; 379 404 405 SetVBIOptions(chanfd); 406 380 407 readfd = open(videodevice.ascii(), O_RDWR | O_NONBLOCK); 381 408 if (readfd < 0) 382 409 { … … 425 452 426 453 keyframedist = (ivtvcodec.framerate) ? 12 : keyframedist; 427 454 428 if (vbimode) 455 return true; 456 } 457 458 static int streamtype_ivtv_to_v4l2(int st) 459 { 460 switch (st) 429 461 { 430 #ifdef IVTV_IOC_S_VBI_MODE 431 struct ivtv_sliced_vbi_format vbifmt; 432 bzero(&vbifmt, sizeof(struct ivtv_sliced_vbi_format)); 433 vbifmt.service_set = (1 == vbimode) ? VBI_TYPE_TELETEXT : VBI_TYPE_CC; 434 435 if (ioctl(chanfd, IVTV_IOC_S_VBI_MODE, &vbifmt) < 0) 436 #endif // IVTV_IOC_S_VBI_MODE 437 { 438 #ifdef V4L2_CAP_SLICED_VBI_CAPTURE 439 struct v4l2_format vbi_fmt; 440 bzero(&vbi_fmt, sizeof(struct v4l2_format)); 441 vbi_fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; 442 vbi_fmt.fmt.sliced.service_set = (1 == vbimode) ? 443 V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; 444 445 if (ioctl(chanfd, VIDIOC_S_FMT, &vbi_fmt) < 0) 446 #endif // V4L2_CAP_SLICED_VBI_CAPTURE 447 { 448 VERBOSE(VB_IMPORTANT, "Can't enable VBI recording" + ENO); 449 } 450 } 451 452 #ifdef IVTV_IOC_S_VBI_EMBED 453 int embedon = 1; 454 if (ioctl(chanfd, IVTV_IOC_S_VBI_EMBED, &embedon) < 0) 455 #endif // IVTV_IOC_S_VBI_EMBED 456 { 457 VERBOSE(VB_IMPORTANT, LOC + "Can't enable VBI recording (2)"+ENO); 458 } 459 460 #ifdef IVTV_IOC_G_VBI_MODE 461 ioctl(chanfd, IVTV_IOC_G_VBI_MODE, &vbifmt); 462 463 VERBOSE(VB_RECORD, LOC + QString( 464 "VBI service:%1, packet size:%2, io size:%3") 465 .arg(vbifmt.service_set).arg(vbifmt.packet_size) 466 .arg(vbifmt.io_size)); 467 #endif // IVTV_IOC_G_VBI_MODE 462 case 0: return V4L2_MPEG_STREAM_TYPE_MPEG2_PS; 463 case 1: return V4L2_MPEG_STREAM_TYPE_MPEG2_TS; 464 case 2: return V4L2_MPEG_STREAM_TYPE_MPEG1_VCD; 465 case 3: return V4L2_MPEG_STREAM_TYPE_MPEG2_PS; /* PES A/V */ 466 case 5: return V4L2_MPEG_STREAM_TYPE_MPEG2_PS; /* PES V */ 467 case 7: return V4L2_MPEG_STREAM_TYPE_MPEG2_PS; /* PES A */ 468 case 10: return V4L2_MPEG_STREAM_TYPE_MPEG2_DVD; 469 case 11: return V4L2_MPEG_STREAM_TYPE_MPEG1_VCD; /* VCD */ 470 case 12: return V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD; 471 case 13: return V4L2_MPEG_STREAM_TYPE_MPEG2_DVD; /* DVD-Special 1 */ 472 case 14: return V4L2_MPEG_STREAM_TYPE_MPEG2_DVD; /* DVD-Special 2 */ 473 default: return V4L2_MPEG_STREAM_TYPE_MPEG2_TS; 468 474 } 469 470 return true;471 475 } 472 476 473 477 bool MpegRecorder::SetV4L2DeviceOptions(int chanfd) … … 512 516 ext_ctrl[5].value = maxbitrate * 1000; 513 517 514 518 ext_ctrl[6].id = V4L2_CID_MPEG_STREAM_TYPE; 519 ext_ctrl[6].value = streamtype_ivtv_to_v4l2(streamtype); 520 // only PS supported with new API (at least as of 0.8.0) 515 521 ext_ctrl[6].value = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; 516 522 517 523 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; … … 552 558 553 559 keyframedist = ext_ctrl[0].value; 554 560 555 // VBI is not yet working as of July 11th, 2006 with IVTV driver. 556 // V4L2_CID_MPEG_STREAM_VBI_FMT needs to be finished/supported first. 557 if (vbimode) 561 return true; 562 } 563 564 bool MpegRecorder::SetVBIOptions(int chanfd) 565 { 566 if (!vbimode) 567 return true; 568 569 if (has_buggy_vbi && !ignore_vbi_bug) 558 570 { 559 struct v4l2_format vbifmt; 560 bzero(&vbifmt, sizeof(struct v4l2_format)); 561 vbifmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; 562 /* vbifmt.fmt.sliced.service_set = (1==vbimode) ? 563 VBI_TYPE_TELETEXT : VBI_TYPE_CC; */ 564 if (1 == vbimode) 565 vbifmt.fmt.sliced.service_set |= V4L2_SLICED_VBI_625; 566 else 567 vbifmt.fmt.sliced.service_set |= V4L2_SLICED_VBI_525; 571 VERBOSE(VB_IMPORTANT, LOC_WARN + "Not enabling VBI recording.\n\t\t\t" 572 "Please upgrade to ivtv 0.10.0 or later for caption support."); 568 573 569 if (ioctl(chanfd, VIDIOC_S_FMT, &vbifmt) < 0) 574 return false; 575 } 576 577 #ifdef IVTV_IOC_S_VBI_EMBED 578 if (!has_v4l2_vbi) 579 { 580 struct ivtv_sliced_vbi_format vbifmt; 581 bzero(&vbifmt, sizeof(struct ivtv_sliced_vbi_format)); 582 vbifmt.service_set = (1 == vbimode) ? VBI_TYPE_TELETEXT : VBI_TYPE_CC; 583 584 if (ioctl(chanfd, IVTV_IOC_S_VBI_MODE, &vbifmt) < 0) 570 585 { 571 VERBOSE(VB_IMPORTANT, "Can't enable VBI recording" + ENO); 586 VERBOSE(VB_IMPORTANT, LOC_WARN + 587 "Can't enable VBI recording (3)" + ENO); 588 589 return false; 572 590 } 573 591 574 struct v4l2_ext_control vbi_fmt; 575 vbi_fmt.id = V4L2_CID_MPEG_STREAM_VBI_FMT; 576 vbi_fmt.value = V4L2_MPEG_STREAM_VBI_FMT_IVTV; 577 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; 578 ctrls.count = 1; 579 ctrls.controls = &vbi_fmt; 580 if (ioctl(chanfd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0) 592 int embedon = 1; 593 if (ioctl(chanfd, IVTV_IOC_S_VBI_EMBED, &embedon) < 0) 581 594 { 582 VERBOSE(VB_IMPORTANT, LOC + "Can't enable VBI recording (2)"+ENO); 595 VERBOSE(VB_IMPORTANT, LOC_WARN + 596 "Can't enable VBI recording (4)" + ENO); 597 598 return false; 583 599 } 584 600 585 ioctl(chanfd, VIDIOC_G_FMT, &vbifmt); 601 if (ioctl(chanfd, IVTV_IOC_G_VBI_MODE, &vbifmt) >= 0) 602 { 603 VERBOSE(VB_RECORD, LOC + QString( 604 "VBI service:%1, packet size:%2, io size:%3") 605 .arg(vbifmt.service_set).arg(vbifmt.packet_size) 606 .arg(vbifmt.io_size)); 607 } 586 608 587 VERBOSE(VB_RECORD, LOC + QString( 588 "VBI service:%1, io size:%3") 609 return true; 610 } 611 #endif // IVTV_IOC_S_VBI_EMBED 612 613 struct v4l2_format vbifmt; 614 bzero(&vbifmt, sizeof(struct v4l2_format)); 615 vbifmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; 616 vbifmt.fmt.sliced.service_set |= (1 == vbimode) ? 617 V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; 618 619 if (ioctl(chanfd, VIDIOC_S_FMT, &vbifmt) < 0) 620 { 621 VERBOSE(VB_IMPORTANT, LOC_WARN + 622 "Can't enable VBI recording (1)" + ENO); 623 624 return false; 625 } 626 627 struct v4l2_ext_control vbi_ctrl; 628 vbi_ctrl.id = V4L2_CID_MPEG_STREAM_VBI_FMT; 629 vbi_ctrl.value = V4L2_MPEG_STREAM_VBI_FMT_IVTV; 630 631 struct v4l2_ext_controls ctrls; 632 bzero(&ctrls, sizeof(struct v4l2_ext_controls)); 633 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; 634 ctrls.count = 1; 635 ctrls.controls = &vbi_ctrl; 636 637 if (ioctl(chanfd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0) 638 { 639 VERBOSE(VB_IMPORTANT, LOC_WARN + 640 "Can't enable VBI recording (2)" + ENO); 641 642 return false; 643 } 644 645 if (ioctl(chanfd, VIDIOC_G_FMT, &vbifmt) >= 0) 646 { 647 VERBOSE(VB_RECORD, LOC + QString("VBI service: %1, io size: %2") 589 648 .arg(vbifmt.fmt.sliced.service_set) 590 649 .arg(vbifmt.fmt.sliced.io_size)); 591 650 } -
libs/libmythtv/recordingprofile.cpp
847 847 class Width : public SpinBoxSetting, public CodecParamStorage 848 848 { 849 849 public: 850 Width(const RecordingProfile &parent, int maxwidth = 704, 850 Width(const RecordingProfile &parent, 851 uint defaultwidth, uint maxwidth, 851 852 bool transcoding = false) : 852 853 SpinBoxSetting(this, transcoding ? 0 : 160, 853 854 maxwidth, 16, false, … … 855 856 CodecParamStorage(this, parent, "width") 856 857 { 857 858 setLabel(QObject::tr("Width")); 858 setValue(480); 859 if (transcoding) 860 setHelpText(QObject::tr("If the width is set to 'Auto', " 861 "the width will be calculated based on the height " 862 "and the recording's physical aspect ratio.")); 859 setValue(defaultwidth); 860 861 QString help = (transcoding) ? 862 QObject::tr("If the width is set to 'Auto', the width " 863 "will be calculated based on the height and " 864 "the recording's physical aspect ratio.") : 865 QObject::tr("Width to use for encoding. " 866 "Note: PVR-150 and PVR-500 devices do not " 867 "function correctly unless this is set to 720."); 868 869 setHelpText(help); 863 870 }; 864 871 }; 865 872 866 873 class Height: public SpinBoxSetting, public CodecParamStorage 867 874 { 868 875 public: 869 Height(const RecordingProfile &parent, int maxheight=576, 876 Height(const RecordingProfile &parent, 877 uint defaultheight, uint maxheight, 870 878 bool transcoding = false): 871 879 SpinBoxSetting(this, transcoding ? 0 : 160, 872 880 maxheight, 16, false, … … 874 882 CodecParamStorage(this, parent, "height") 875 883 { 876 884 setLabel(QObject::tr("Height")); 877 setValue(480); 878 if (transcoding) 879 setHelpText(QObject::tr("If the height is set to 'Auto', " 880 "the height will be calculated based on the width " 881 "and the recording's physical aspect ratio.")); 885 setValue(defaultheight); 886 887 QString help = (transcoding) ? 888 QObject::tr("If the height is set to 'Auto', the height " 889 "will be calculated based on the width and " 890 "the recording's physical aspect ratio.") : 891 QObject::tr("Height to use for encoding. " 892 "Note: PVR-150 and PVR-500 devices do not " 893 "function correctly unless this is set to " 894 "480 or 576 for NTSC and PAL, respectively."); 895 896 setHelpText(help); 882 897 }; 883 898 }; 884 899 … … 894 909 labelName = profName + "->" + QObject::tr("Image size"); 895 910 setLabel(labelName); 896 911 897 QString fullsize, halfsize; 898 int maxwidth, maxheight; 899 bool transcoding = false; 900 if (profName.left(11) == "Transcoders") { 901 maxwidth = 1920; 902 maxheight = 1088; 903 transcoding = true; 904 } else if ((tvFormat.lower() == "ntsc") || 905 (tvFormat.lower() == "ntsc-jp")) { 906 maxwidth = 720; 907 maxheight = 480; 908 } else if (tvFormat.lower() == "atsc") { 909 maxwidth = 1920; 910 maxheight = 1088; 911 } else { 912 maxwidth = 768; 913 maxheight = 576; 912 QSize defaultsize(768, 576), maxsize(768, 576); 913 bool transcoding = profName.left(11) == "Transcoders"; 914 bool ivtv = profName.left(34) == "MPEG-2 Encoders (PVR-x50, PVR-500)"; 915 916 if (transcoding) 917 { 918 maxsize = QSize(1920, 1088); 919 defaultsize = QSize(480, 480); 914 920 } 921 else if (tvFormat.lower().left(4) == "ntsc") 922 { 923 maxsize = QSize(720, 480); 924 defaultsize = (ivtv) ? QSize(720, 480) : QSize(480, 480); 925 } 926 else if (tvFormat.lower() == "atsc") 927 { 928 maxsize = QSize(1920, 1088); 929 defaultsize = QSize(1920, 1088); 930 } 931 else 932 { 933 maxsize = QSize(768, 576); 934 defaultsize = (ivtv) ? QSize(720, 576) : QSize(480, 576); 935 } 915 936 916 imgSize->addChild(new Width(parent, maxwidth, transcoding)); 917 imgSize->addChild(new Height(parent, maxheight, transcoding)); 937 imgSize->addChild(new Width(parent, defaultsize.width(), 938 maxsize.width(), transcoding)); 939 imgSize->addChild(new Height(parent, defaultsize.height(), 940 maxsize.height(), transcoding)); 941 918 942 addChild(imgSize); 919 943 }; 920 944 }; … … 1001 1025 { 1002 1026 MSqlQuery result(MSqlQuery::InitCon()); 1003 1027 result.prepare( 1004 "SELECT cardtype "1028 "SELECT cardtype, profilegroups.name " 1005 1029 "FROM profilegroups, recordingprofiles " 1006 1030 "WHERE profilegroups.id = recordingprofiles.profilegroup AND " 1007 1031 " recordingprofiles.id = :PROFILEID"); … … 1013 1037 else if (result.next()) 1014 1038 { 1015 1039 type = result.value(0).toString(); 1040 if (profileName.isEmpty()) 1041 profileName = result.value(1).toString(); 1016 1042 isEncoder = CardUtil::IsEncoder(type); 1017 1043 } 1018 1044