Changeset 4089
- Timestamp:
- 08/15/07 08:35:11 (6 years ago)
- Location:
- vic/branches/mpeg4
- Files:
-
- 3 modified
-
tcl/ui-grabber.tcl (modified) (3 diffs)
-
tcl/ui-resource.tcl (modified) (1 diff)
-
video/grabber-v4l2.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vic/branches/mpeg4/tcl/ui-grabber.tcl
r4085 r4089 97 97 set f [smallfont] 98 98 global contrast brightness v4l2gamma hue saturation v4l2gain norm 99 global antiflicker 99 100 set contrast [resource contrast] 100 101 set brightness [resource brightness] … … 104 105 set v4l2gain [resource v4l2gain] 105 106 set norm 0 107 set antiflicker [resource antiflicker] 106 108 107 109 label $w.title -text "Video4Linux2 grabber controls" … … 111 113 frame $w.f.left -relief flat 112 114 113 114 button $w.f.left.reset -font $f -width 10 -text "Reset" -command "set contrast 128; set brightness 128;set v4l2gamma 128; set hue 128; set saturation 128; set v4l2gain 128; grabber controls reset" -padx 1 -pady 1 115 set m $w.f.left.antiflicker.menu 116 menubutton $w.f.left.antiflicker -menu $m -text "Anti-flicker..." \ 117 -relief raised -width 14 -font $f -padx 1 -pady 1 118 menu $m 119 $m add radiobutton -label "disabled" -command "grabber antiflicker 0" \ 120 -value "disabled" -variable antiflicker -font $f 121 $m add radiobutton -label "50 Hz" -command "grabber antiflicker 1" \ 122 -value "50Hz" -variable antiflicker -font $f 123 $m add radiobutton -label "60 Hz" -command "grabber antiflicker 2" \ 124 -value "60Hz" -variable antiflicker -font $f 125 pack $w.f.left.antiflicker 126 127 if [grabber get haveantiflicker] { 128 $w.f.left.antiflicker configure -state normal 129 } else { 130 $w.f.left.antiflicker configure -state disabled 131 } 132 133 button $w.f.left.reset -font $f -width 14 -text "Reset" -command "set contrast 128; set brightness 128;set v4l2gamma 128; set hue 128; set saturation 128; set v4l2gain 128; grabber controls reset" -padx 1 -pady 1 115 134 pack $w.f.left.reset 116 135 -
vic/branches/mpeg4/tcl/ui-resource.tcl
r4036 r4089 188 188 option add Vic.luma_contrast "0" startupFile 189 189 190 option add Vic.antiflicker "disabled" startupFile 191 option add Vic.v4l2gain "128" startupFile 192 option add Vic.v4l2gamma "128" startupFile 193 190 194 # 191 195 # color resources -
vic/branches/mpeg4/video/grabber-v4l2.cpp
r4062 r4089 85 85 #define BYTE_ORDER_UYVY 2 86 86 #define BYTE_ORDER_VYUY 3 87 88 /* V4L2 driver specific controls */ 89 #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE + 1) 87 90 88 91 typedef struct tag_vimage … … 314 317 } else { 315 318 if ( !(cap.capabilities & V4L2_CAP_READWRITE) && !(cap.capabilities & V4L2_CAP_STREAMING)) { 316 debug_msg(" v4l2: fatal: device does not support read()/write() calls or streaming capture.\n");319 debug_msg("V4L2: fatal: device does not support read()/write() calls or streaming capture.\n"); 317 320 status_=-1; 318 321 return; … … 511 514 } 512 515 516 if (strcmp(argv[1], "antiflicker") == 0) { 517 struct v4l2_queryctrl qctrl; 518 struct v4l2_control ctrl; 519 520 if (-1 != ioctl(fd_, VIDIOC_QUERYCTRL, &qctrl)) { 521 if (strcmp((char *)qctrl.name, "Power Line Frequency") == 0) { 522 ctrl.id = V4L2_CID_POWER_LINE_FREQUENCY; 523 ctrl.value = atoi(argv[2]); 524 if (-1 == ioctl(fd_, VIDIOC_S_CTRL, &ctrl)) 525 perror("ioctl VIDIOC_S_CTRL"); 526 else 527 debug_msg( "V4L2: V4L2_CID_POWER_LINE_FREQUENCY = %d\n", ctrl.value); 528 } 529 } 530 return (TCL_OK); 531 } 513 532 514 533 if (strcmp(argv[1], "controls") == 0) { … … 571 590 572 591 if (fd_ > 0 ) { 573 debug_msg("\n v4l2: start\n");592 debug_msg("\nV4L2: start\n"); 574 593 575 594 format(); … … 600 619 601 620 if ((long)vimage[i].data == -1) { 602 debug_msg(" v4l2: mmap() returned error %l\n", errno);621 debug_msg("V4L2: mmap() returned error %l\n", errno); 603 622 return; 604 } else debug_msg(" v4l2: mmap()'ed buffer at 0x%x (%d bytes)\n", (long)vimage[i].data, vimage[i].vidbuf.length);623 } else debug_msg("V4L2: mmap()'ed buffer at 0x%x (%d bytes)\n", (long)vimage[i].data, vimage[i].vidbuf.length); 605 624 } 606 625 … … 621 640 debug_msg("malloc(%d) failed\n", fmt.fmt.pix.sizeimage); 622 641 return; 623 } else debug_msg(" v4l2: malloc()'ed buffer (%d bytes)\n", fmt.fmt.pix.sizeimage);642 } else debug_msg("V4L2: malloc()'ed buffer (%d bytes)\n", fmt.fmt.pix.sizeimage); 624 643 } 625 644 … … 1052 1071 height_ = CIF_HEIGHT *2 / decimate_; 1053 1072 1054 debug_msg(" v4l2: format");1073 debug_msg("V4L2: format"); 1055 1074 switch (cformat_) { 1056 1075 case CF_CIF: … … 1075 1094 if (-1 == ioctl(fd_, VIDIOC_S_STD, &standard.id)) 1076 1095 perror("ioctl VIDIOC_S_STD"); 1077 else debug_msg(" v4l2: setting norm to %s\n",standard.name);1096 else debug_msg("V4L2: setting norm to %s\n",standard.name); 1078 1097 } 1079 1098 … … 1081 1100 if ((err = ioctl(fd_, VIDIOC_S_INPUT, &input)) ) 1082 1101 debug_msg("S_INPUT returned error %d\n",errno); 1083 else debug_msg(" v4l2: setting input port to %d\n", port_);1102 else debug_msg("V4L2: setting input port to %d\n", port_); 1084 1103 1085 1104 for (i = 0, err = 0; err == 0; ++i) { … … 1101 1120 1102 1121 if ( (err = ioctl(fd_, VIDIOC_S_FMT, &fmt) ) ) 1103 debug_msg("\n v4l2: Failed to set format\n");1122 debug_msg("\nV4L2: Failed to set format\n"); 1104 1123 1105 1124 if ( ( fmt.fmt.pix.width != (unsigned int)width_ ) || 1106 1125 ( fmt.fmt.pix.height != (unsigned int)height_ ) ) { 1107 1126 1108 debug_msg(" v4l2: failed to set format! requested %dx%d, got %dx%d\n", width_, height_, fmt.fmt.pix.width, fmt.fmt.pix.height);1127 debug_msg("V4L2: failed to set format! requested %dx%d, got %dx%d\n", width_, height_, fmt.fmt.pix.width, fmt.fmt.pix.height); 1109 1128 1110 1129 1111 1130 switch(decimate_) { 1112 1131 case 2: 1113 debug_msg(" v4l2: trying resolution under ...\n");1132 debug_msg("V4L2: trying resolution under ...\n"); 1114 1133 decimate_ = 4; 1115 1134 break; 1116 1135 case 1: 1117 debug_msg(" v4l2: trying resolution under ...\n");1136 debug_msg("V4L2: trying resolution under ...\n"); 1118 1137 decimate_ = 2; 1119 1138 break; 1120 1139 default: 1121 debug_msg(" v4l2: giving up ...\n");1140 debug_msg("V4L2: giving up ...\n"); 1122 1141 format_ok = 1; 1123 1142 } 1124 1143 1125 1144 } else { 1126 debug_msg(" v4l2: setting format: width=%d height=%d\n", fmt.fmt.pix.width, fmt.fmt.pix.height);1145 debug_msg("V4L2: setting format: width=%d height=%d\n", fmt.fmt.pix.width, fmt.fmt.pix.height); 1127 1146 format_ok = 1; 1128 1147 }
