Ticket #3959: mpegrecorder_wolume_ctl.patch

File mpegrecorder_wolume_ctl.patch, 965 bytes (added by mark_kiddy@…, 13 years ago)
  • libs/libmythtv/mpegrecorder.cpp

     
    406406    // Set recording volume
    407407    struct v4l2_control ctrl;
    408408    ctrl.id = V4L2_CID_AUDIO_VOLUME;
     409   
     410    struct v4l2_queryctrl qctrl;
     411    // getting volume max/min value
     412    qctrl.id = V4L2_CID_AUDIO_VOLUME;
     413    if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) < 0)
     414    {
     415    //rather impossible
     416        VERBOSE(VB_IMPORTANT, LOC_WARN +
     417                "Unable to get recording volume parameters(max/min)" + ENO + "\n\t\t\t" +
     418                "using defaults.");
    409419    ctrl.value = 65536 / 100 *audvolume;
     420    } else {
     421    ctrl.value=(qctrl.maximum - qctrl.minimum) * audvolume / 100 + qctrl.minimum;
     422    }
     423       
     424   
     425   
    410426
    411427    if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
    412428    {