13 #define LOC QString("AnalogSigMon[%1](%2): ") \
14 .arg(m_inputid).arg(m_channel->GetDevice())
20 :
SignalMonitor(db_cardnum, _channel, _release_stream, _flags)
29 m_usingV4l2 = ((caps & V4L2_CAP_VIDEO_CAPTURE) != 0U);
30 LOG(VB_RECORD, LOG_INFO, QString(
"card '%1' driver '%2' version '%3'")
37 struct v4l2_queryctrl qctrl {};
38 qctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
40 int audtype = V4L2_MPEG_AUDIO_ENCODING_AC3;
42 if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) != 0)
44 LOG(VB_GENERAL, LOG_ERR,
LOC +
45 "Unable to get supported audio codecs for verification." +
ENO);
49 struct v4l2_ext_control ext_ctrl {};
50 struct v4l2_ext_controls ext_ctrls {};
52 ext_ctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
54 ext_ctrls.reserved[0] = 0;
56 ext_ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
57 ext_ctrls.controls = &ext_ctrl;
59 if (ioctl(videofd, VIDIOC_G_EXT_CTRLS, &ext_ctrls) != 0)
61 LOG(VB_GENERAL, LOG_ERR,
LOC +
62 "Unable to get current audio codecs for verification." +
ENO);
66 int current_audio = ext_ctrls.controls->value;
68 if (audtype != current_audio)
70 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Audio desired %1, current %2 "
78 ext_ctrl.id = V4L2_CID_MPEG_AUDIO_ENCODING;
79 ext_ctrl.value = audtype;
80 if (ioctl(videofd, VIDIOC_S_EXT_CTRLS, &ext_ctrls) == 0)
82 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Changed audio encoding "
90 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Failed to changed audio "
91 "encoding from %1 to %2.")
111 struct v4l2_format vfmt {};
112 vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
114 if ((ioctl(videofd, VIDIOC_G_FMT, &vfmt) == 0) &&
115 vfmt.fmt.pix.width &&
m_width == vfmt.fmt.pix.width &&
120 LOG(VB_RECORD, LOG_ERR, QString(
"hd-pvr resolution %1 x %2")
121 .arg(vfmt.fmt.pix.width).arg(vfmt.fmt.pix.height));
127 LOG(VB_RECORD, LOG_ERR, QString(
"hd-pvr stable at %1 x %2")
128 .arg(vfmt.fmt.pix.width).arg(vfmt.fmt.pix.height));
142 LOG(VB_RECORD, LOG_ERR,
"hd-pvr waiting for valid resolution");
171 bool isLocked =
false;
178 struct v4l2_tuner tuner {};
180 if (ioctl(videofd, VIDIOC_G_TUNER, &tuner, 0) < 0)
182 LOG(VB_GENERAL, LOG_ERR,
"Failed to probe signal (v4l2)" +
ENO);
186 isLocked = (tuner.signal != 0);