| 406 | // Get volume min/max values |
| 407 | struct v4l2_queryctrl qctrl; |
| 408 | qctrl.id = V4L2_CID_AUDIO_VOLUME; |
| 409 | if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) < 0) |
| 410 | { |
| 411 | VERBOSE(VB_IMPORTANT, LOC_WARN + |
| 412 | "Unable to get recording volume parameters(max/min)" + ENO + |
| 413 | "\n\t\t\tusing default range [0,65535]."); |
| 414 | qctrl.maximum = 65535; |
| 415 | qctrl.minimum = 0; |
| 416 | } |
| 417 | |
| 418 | // calculate volume in card units. |
| 419 | int range = qctrl.maximum - qctrl.minimum; |
| 420 | int value = (int) ((range * audvolume * 0.01f) + qctrl.minimum); |
| 421 | int ctrl_volume = min(qctrl.maximum, max(qctrl.minimum, value)); |
| 422 | |