Changeset 4340
- Timestamp:
- 12/15/08 02:16:08 (4 years ago)
- Files:
-
- 1 modified
-
vic/branches/mpeg4/video/grabber-v4l2.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vic/branches/mpeg4/video/grabber-v4l2.cpp
r4339 r4340 78 78 }; 79 79 80 #define NTSC_WIDTH 64081 #define NTSC_HEIGHT 48082 #define PAL_WIDTH 76883 #define PAL_HEIGHT 57680 #define PAL_BT601_WIDTH 720 81 #define PAL_BT601_HEIGHT 576 82 #define VGA_WIDTH 640 83 #define VGA_HEIGHT 480 84 84 #define CIF_WIDTH 352 85 85 #define CIF_HEIGHT 288 … … 88 88 #define CF_420 1 89 89 #define CF_CIF 2 90 91 #define CS_VC 0 /* 4CIF (704x576), CIF (352x288), QCIF (176x144) */ 92 #define CS_VGA 1 /* VGA (640x480), 1/4 VGA (320x240), 1/16 VGA (160x120) */ 93 #define CS_BT601_PAL 2 /* ITU-R Recommendation BT.601 720x576 (plus 360x288 & 180x144) */ 90 94 91 95 /* YUV Byte order */ … … 362 366 v4l2_ioctl(fd_, VIDIOC_G_FMT, &fmt); 363 367 364 unsigned int test_width[] = {CIF_WIDTH, 320,0};365 unsigned int test_height[] = {CIF_HEIGHT, 240, 0};368 unsigned int test_width[] = {CIF_WIDTH, PAL_BT601_WIDTH/2, VGA_WIDTH/2, 0}; 369 unsigned int test_height[] = {CIF_HEIGHT, PAL_BT601_HEIGHT/2, VGA_HEIGHT/2, 0}; 366 370 for (unsigned int i = 0; test_width[i] != 0; i++) { 367 371 fmt.fmt.pix.width = test_width[i]; … … 1110 1114 int input; 1111 1115 int format_ok = 0; 1112 int try_ntsc = 0;1116 int capture_standard = CS_VC; // initially try video conferencing resolutions 1113 1117 1114 1118 switch (cformat_) { … … 1204 1208 switch(decimate_) { 1205 1209 case 1: 1206 if (!try_ntsc) { 1207 debug_msg("V4L2: trying NTSC resolution ...\n"); 1208 width_ = NTSC_WIDTH; 1209 height_ = NTSC_HEIGHT; 1210 try_ntsc = 1; 1211 } else { 1210 switch (capture_standard) { 1211 case CS_VC : 1212 debug_msg("V4L2: trying VGA resolution ...\n"); 1213 width_ = VGA_WIDTH; 1214 height_ = VGA_HEIGHT; 1215 capture_standard = CS_VGA; 1216 break; 1217 case CS_VGA : 1218 debug_msg("V4L2: trying ITU-R BT.601 PAL resolution ...\n"); 1219 width_ = PAL_BT601_WIDTH; 1220 height_ = PAL_BT601_HEIGHT; 1221 capture_standard = CS_BT601_PAL; 1222 break; 1223 default : 1212 1224 debug_msg("V4L2: trying resolution under ...\n"); 1213 1225 decimate_ = 2; 1214 try_ntsc = 0;1226 capture_standard = CS_VC; 1215 1227 } 1216 1228 break; 1217 1229 case 2: 1218 if (!try_ntsc) { 1219 debug_msg("V4L2: trying 1/4 NTSC resolution ...\n"); 1220 width_ = NTSC_WIDTH / 2; 1221 height_ = NTSC_HEIGHT / 2; 1222 try_ntsc = 1; 1223 } else { 1230 switch (capture_standard) { 1231 case CS_VC : 1232 debug_msg("V4L2: trying 1/4 VGA resolution ...\n"); 1233 width_ = VGA_WIDTH / 2; 1234 height_ = VGA_HEIGHT / 2; 1235 capture_standard = CS_VGA; 1236 break; 1237 case CS_VGA : 1238 debug_msg("V4L2: trying 1/4 ITU-R BT.601 PAL resolution ...\n"); 1239 width_ = PAL_BT601_WIDTH / 2; 1240 height_ = PAL_BT601_HEIGHT / 2; 1241 capture_standard = CS_BT601_PAL; 1242 break; 1243 default : 1224 1244 debug_msg("V4L2: trying resolution under ...\n"); 1225 1245 decimate_ = 4; 1226 try_ntsc = 0;1246 capture_standard = CS_VC; 1227 1247 } 1228 1248 break; 1229 1249 default: 1230 if (!try_ntsc) { 1231 debug_msg("V4L2: trying 1/16 NTSC resolution ...\n"); 1232 width_ = NTSC_WIDTH / 4; 1233 height_ = NTSC_HEIGHT / 4; 1234 try_ntsc = 0; 1235 } else { 1250 switch (capture_standard) { 1251 case CS_VC : 1252 debug_msg("V4L2: trying 1/16 VGA resolution ...\n"); 1253 width_ = VGA_WIDTH / 4; 1254 height_ = VGA_HEIGHT / 4; 1255 capture_standard = CS_VGA; 1256 break; 1257 case CS_VGA : 1258 debug_msg("V4L2: trying 1/16 ITU-R BT.601 PAL resolution ...\n"); 1259 width_ = PAL_BT601_WIDTH / 4; 1260 height_ = PAL_BT601_HEIGHT / 4; 1261 capture_standard = CS_BT601_PAL; 1262 break; 1263 default : 1236 1264 debug_msg("V4L2: giving up ...\n"); 1237 1265 format_ok = 1; 1266 capture_standard = CS_VC; 1238 1267 } 1239 1268 break;
