14 #include <QRegularExpression>
16 #define LOC QString("V4L2(%1): ").arg(m_deviceName)
26 Open(dev_name, vbi_dev_name);
41 m_fd = open(dev_name.toLatin1().constData(), O_RDWR);
44 LOG(VB_CHANNEL, LOG_INFO,
LOC +
45 QString(
"Could not open '%1': ").arg(dev_name) +
ENO);
50 struct v4l2_query_ext_ctrl qc {};
51 qc.id = V4L2_CTRL_FLAG_NEXT_CTRL | V4L2_CTRL_FLAG_NEXT_COMPOUND;
59 struct v4l2_capability capability {};
60 if (ioctl(
m_fd, VIDIOC_QUERYCAP, &capability) >= 0)
62 m_cardName = QString::fromLatin1((
const char*)capability.card);
63 m_driverName = QString::fromLatin1((
const char*)capability.driver);
73 static const QRegularExpression kDigitsRE { R
"(\[[0-9]\]$)" };
79 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Opened");
88 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Closed");
99 struct v4l2_requestbuffers reqbuf {};
101 if (-1 == ioctl (
m_fd, VIDIOC_REQBUFS, &reqbuf))
105 LOG(VB_CHANNEL, LOG_INFO,
LOC +
106 "Video capturing or mmap-streaming is not supported");
110 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
"VIDIOC_REQBUFS" +
ENO);
124 uint32_t mask,
const QString& desc)
128 if (!result.isEmpty())
166 case V4L2_CTRL_TYPE_INTEGER:
168 case V4L2_CTRL_TYPE_INTEGER64:
170 case V4L2_CTRL_TYPE_STRING:
172 case V4L2_CTRL_TYPE_BOOLEAN:
174 case V4L2_CTRL_TYPE_MENU:
176 case V4L2_CTRL_TYPE_INTEGER_MENU:
178 case V4L2_CTRL_TYPE_BUTTON:
180 case V4L2_CTRL_TYPE_BITMASK:
182 case V4L2_CTRL_TYPE_U8:
184 case V4L2_CTRL_TYPE_U16:
186 case V4L2_CTRL_TYPE_U32:
196 struct v4l2_querymenu qmenu {};
197 QString nameStr((
char *)queryctrl.name);
199 qmenu.id = queryctrl.id;
202 static const QRegularExpression kNonPrintableRE {
"[^a-zA-Z\\d\\s]" };
203 nameStr.replace(kNonPrintableRE,
"_");
208 drv_opt.
m_step = queryctrl.step;
211 if (nameStr ==
"Stream Type")
213 else if (nameStr ==
"Video Encoding")
215 else if (nameStr ==
"Video Aspect")
217 else if (nameStr ==
"Video B Frames")
219 else if (nameStr ==
"Video GOP Size")
221 else if (nameStr ==
"Video Bitrate Mode")
223 else if (nameStr ==
"Video Bitrate")
225 else if (nameStr ==
"Video Peak Bitrate")
227 else if (nameStr ==
"Audio Encoding")
229 else if (nameStr ==
"Audio Bitrate Mode")
231 else if (nameStr ==
"Audio Bitrate")
233 else if (nameStr ==
"Brightness")
235 else if (nameStr ==
"Contrast")
237 else if (nameStr ==
"Saturation")
239 else if (nameStr ==
"Hue")
241 else if (nameStr ==
"Sharpness")
243 else if (nameStr ==
"Volume")
248 switch (queryctrl.type)
250 case V4L2_CTRL_TYPE_INTEGER:
251 case V4L2_CTRL_TYPE_INTEGER64:
252 case V4L2_CTRL_TYPE_U8:
253 case V4L2_CTRL_TYPE_U16:
254 case V4L2_CTRL_TYPE_U32:
255 msg = QString(
"%1 : min=%2 max=%3 step=%4 default=%5")
256 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '))
257 .arg(queryctrl.minimum)
258 .arg(queryctrl.maximum)
260 .arg(queryctrl.default_value);
263 case V4L2_CTRL_TYPE_STRING:
264 msg = QString(
"%1 : min=%2 max=%3 step=%4")
265 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '))
266 .arg(queryctrl.minimum)
267 .arg(queryctrl.maximum)
268 .arg(queryctrl.step);
271 case V4L2_CTRL_TYPE_BOOLEAN:
272 msg = QString(
"%1 : default=%2")
273 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '))
274 .arg(queryctrl.default_value);
277 case V4L2_CTRL_TYPE_MENU:
278 case V4L2_CTRL_TYPE_INTEGER_MENU:
280 msg = QString(
"%1 : min=%3 max=%4 default=%5")
281 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '))
282 .arg(queryctrl.minimum)
283 .arg(queryctrl.maximum)
284 .arg(queryctrl.default_value);
286 struct v4l2_querymenu querymenu = { 0, };
287 memset (&querymenu, 0,
sizeof (querymenu));
288 querymenu.id = queryctrl.id;
290 for (querymenu.index = queryctrl.minimum;
291 static_cast<int>(querymenu.index) <= queryctrl.maximum;
294 drv_opt.menu.clear();
295 if (0 == ioctl(
m_fd, VIDIOC_QUERYMENU, &querymenu))
297 msg += QString(
" menu>%1").arg((
char *)querymenu.name);
298 drv_opt.menu[querymenu.index] =
299 QString((
char *)querymenu.name);
306 case V4L2_CTRL_TYPE_BUTTON:
307 msg = QString(
"%1 :")
308 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '));
311 case V4L2_CTRL_TYPE_BITMASK:
312 msg = QString(
"%1 : max=0x%2 default=0x%3")
313 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '))
314 .arg(queryctrl.maximum, 8, 16, QChar(
' '))
315 .arg(queryctrl.default_value, 8, 16, QChar(
' '));
320 msg = QString(
"%1 : type=%2")
321 .arg(QString(
"%1 (%2)").arg(nameStr,
queryctrl_toString(queryctrl.type)), 31, QChar(
' '))
322 .arg(queryctrl.type);
330 if (queryctrl.type == V4L2_CTRL_TYPE_MENU ||
331 queryctrl.type == V4L2_CTRL_TYPE_INTEGER_MENU)
333 for (
int idx = queryctrl.minimum; idx <= queryctrl.maximum; ++idx)
336 if (ioctl(
m_fd, VIDIOC_QUERYMENU, &qmenu))
339 drv_opt.
m_menu[idx] = QString((
char *)qmenu.name);
340 if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
341 msg += QString(
"\t\t%1: %2").arg(idx).arg((
char *)qmenu.name);
344 msg += QString(
"\t\t%1: %2 (0x%3)")
345 .arg(idx).arg(qmenu.value)
346 .arg(qmenu.value, 0, 16, QChar(
'0'));
351 LOG(VB_CHANNEL, LOG_INFO,
LOC + msg);
357 struct v4l2_control ctrl {};
358 struct v4l2_ext_control ext_ctrl {};
359 struct v4l2_ext_controls ctrls {};
361 if (qctrl.flags& V4L2_CTRL_FLAG_DISABLED)
363 msg += QString(
"'%1' Disabled").arg((
char *)qctrl.name);
367 if (qctrl.type == V4L2_CTRL_TYPE_CTRL_CLASS)
369 msg += QString(
"'%1' V4L2_CTRL_TYPE_CTRL_CLASS").arg((
char *)qctrl.name);
373 ext_ctrl.id = qctrl.id;
374 if ((qctrl.flags& V4L2_CTRL_FLAG_WRITE_ONLY) ||
375 qctrl.type == V4L2_CTRL_TYPE_BUTTON)
381 if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES)
387 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(qctrl.id);
389 ctrls.controls = &ext_ctrl;
390 if (qctrl.type == V4L2_CTRL_TYPE_INTEGER64 ||
391 qctrl.type == V4L2_CTRL_TYPE_STRING ||
392 (V4L2_CTRL_ID2CLASS(qctrl.id) != V4L2_CTRL_CLASS_USER &&
393 qctrl.id < V4L2_CID_PRIVATE_BASE))
395 if (qctrl.type == V4L2_CTRL_TYPE_STRING)
397 ext_ctrl.size = qctrl.maximum + 1;
398 ext_ctrl.string = (
char *)malloc(ext_ctrl.size);
399 ext_ctrl.string[0] = 0;
401 if (ioctl(
m_fd, VIDIOC_G_EXT_CTRLS, &ctrls))
403 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
404 QString(
"Failed to get ext_ctr %1: ")
405 .arg((
char *)qctrl.name) +
ENO);
411 if (ioctl(
m_fd, VIDIOC_G_CTRL, &ctrl))
413 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
414 QString(
"Failed to get ctrl %1: ")
415 .arg((
char *)qctrl.name) +
ENO);
418 ext_ctrl.value = ctrl.value;
422 if (qctrl.type == V4L2_CTRL_TYPE_STRING)
423 free(ext_ctrl.string);
434 drv_opt.
m_name =
"Video Encoding";
436 V4L2_MPEG_VIDEO_ENCODING_MPEG_2;
447 drv_opt.
m_name =
"Audio Encoding";
449 V4L2_MPEG_AUDIO_ENCODING_LAYER_2;
454 drv_opt.
m_name =
"Audio Bitrate";
456 V4L2_MPEG_AUDIO_ENCODING_LAYER_2;
462 drv_opt.
m_name =
"MPEG Audio sampling frequency";
464 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000;
470 drv_opt.
m_name =
"Tuner Audio Modes";
472 V4L2_TUNER_MODE_STEREO;
477 DriverOption::Options::iterator Iopt =
options.begin();
478 for ( ; Iopt !=
options.end(); ++Iopt)
481 if (!(*Iopt).m_menu.isEmpty())
483 int minimum = INT_MAX;
486 DriverOption::menu_t::iterator Imenu = (*Iopt).m_menu.begin();
487 for ( ; Imenu != (*Iopt).m_menu.end(); ++Imenu)
489 minimum = std::min(Imenu.key(), minimum);
490 maximum = std::max(Imenu.key(), maximum);
492 if ((*Iopt).m_minimum != minimum)
494 LOG(VB_CHANNEL, LOG_INFO,
LOC +
495 QString(
"%1 menu options overrides minimum from %2 to %3")
496 .arg((*Iopt).m_name).arg((*Iopt).m_minimum).arg(minimum));
497 (*Iopt).m_minimum = minimum;
499 if ((*Iopt).m_maximum != maximum)
501 LOG(VB_CHANNEL, LOG_INFO,
LOC +
502 QString(
"%1 menu options overrides maximum from %2 to %3")
503 .arg((*Iopt).m_name).arg((*Iopt).m_maximum).arg(maximum));
504 (*Iopt).m_maximum = maximum;
512 struct v4l2_fmtdesc vid_fmtdesc {};
513 const std::array<const QString,2> flags {
"uncompressed",
"compressed"};
515 vid_fmtdesc.index = 0;
516 vid_fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
517 while(ioctl(
m_fd, VIDIOC_ENUM_FMT, &vid_fmtdesc) == 0)
519 formats << QString(
"%1 (%2)").arg((
char *)vid_fmtdesc.description,
520 flags[vid_fmtdesc.flags]);
531 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"GetFormats: %1")
539 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Options");
547 struct v4l2_queryctrl qctrl {};
548 qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
549 while (0 == ioctl (
m_fd, VIDIOC_QUERYCTRL, &qctrl))
557 qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
572 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
573 QString(
"Driver does not support option."));
578 DriverOption::menu_t::iterator Imenu = drv_opt.
m_menu.begin();
579 for ( ; Imenu != drv_opt.
m_menu.end(); ++Imenu)
581 if ((*Imenu) == desc)
583 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"GetOptionValue '%1' = %2")
584 .arg(desc).arg(Imenu.key()));
589 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
590 QString(
"'%1' not found in driver options menu.").arg(desc));
596 v4l2_std_id std_id = 0;
597 struct v4l2_standard standard {};
599 if (-1 == ioctl (
m_fd, VIDIOC_G_STD, &std_id))
604 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
605 "GetVideoStandard: Failed to detect signal." +
ENO);
611 while (0 == ioctl (
m_fd, VIDIOC_ENUMSTD, &standard))
613 if (standard.id & std_id)
615 name = (
char *)standard.name;
624 if (errno == EINVAL || standard.index == 0)
626 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
627 "GetVideoStandard: Failed to find signal." +
ENO);
637 struct v4l2_tuner tuner {};
639 if (ioctl(
m_fd, VIDIOC_G_TUNER, &tuner, 0) != 0)
641 LOG(VB_GENERAL, LOG_ERR,
"GetSignalStrength() : "
642 "Failed to probe signal (v4l2)" +
ENO);
646 tuner.signal /= 655.35;
648 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"GetSignalStrength() : "
656 struct v4l2_format vfmt {};
658 vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
659 if (ioctl(
m_fd, VIDIOC_G_FMT, &vfmt) != 0)
661 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
662 "Failed to determine resolution: " +
ENO);
667 width = vfmt.fmt.pix.width;
668 height = vfmt.fmt.pix.height;
669 LOG(VB_CHANNEL, LOG_INFO,
LOC +
670 QString(
"Resolution: %1x%2").arg(width).arg(height));
701 struct v4l2_queryctrl qctrl {};
703 qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL;
704 return (0 == ioctl (
m_fd, VIDIOC_QUERYCTRL, &qctrl) &&
705 V4L2_CTRL_ID2CLASS (qctrl.id) == V4L2_CTRL_CLASS_MPEG);
718 struct v4l2_ext_control ctrl {};
719 struct v4l2_ext_controls ctrls {};
724 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
725 ctrls.controls = &ctrl;
727 if (ioctl(
m_fd, VIDIOC_G_EXT_CTRLS, &ctrls) != 0)
729 LOG(VB_GENERAL, LOG_ERR,
LOC +
730 QString(
"Failed to retrieve current %1 value.")
731 .arg(ctrl_desc) +
ENO);
735 return ctrls.controls->value;
740 const QString& value_desc)
744 if (current_value < 0)
746 if (current_value == value)
748 LOG(VB_CHANNEL, LOG_INFO,
LOC +
749 QString(
"%1 value is already %2 (%3).")
750 .arg(ctrl_desc, value_desc, QString::number(value)));
754 struct v4l2_ext_control ctrl {};
755 struct v4l2_ext_controls ctrls {};
761 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
762 ctrls.controls = &ctrl;
764 if (ioctl(
m_fd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0)
766 LOG(VB_GENERAL, LOG_ERR,
LOC +
767 QString(
"Failed to set %1 value to %2 (%3).")
768 .arg(ctrl_desc, value_desc, QString::number(value)) +
ENO);
772 LOG(VB_CHANNEL, LOG_INFO,
LOC +
773 QString(
"%1 value set to %2 (%3).")
774 .arg(ctrl_desc, value_desc, QString::number(value)));
783 case V4L2_MPEG_STREAM_TYPE_MPEG2_PS:
784 return "MPEG-2 program stream";
785 case V4L2_MPEG_STREAM_TYPE_MPEG2_TS:
786 return "MPEG-2 transport stream";
787 case V4L2_MPEG_STREAM_TYPE_MPEG1_SS:
788 return "MPEG-1 system stream";
789 case V4L2_MPEG_STREAM_TYPE_MPEG2_DVD:
790 return "MPEG-2 DVD-compatible stream";
791 case V4L2_MPEG_STREAM_TYPE_MPEG1_VCD:
792 return "MPEG-1 VCD-compatible stream";
793 case V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD:
794 return "MPEG-2 SVCD-compatible stream";
801 int type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS;
806 type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS;
813 LOG(VB_CHANNEL, LOG_INFO,
LOC +
814 QString(
"MPEG Stream Type is currently set to %1 (%2)")
826 value = V4L2_MPEG_STREAM_TYPE_MPEG2_PS;
839 case V4L2_MPEG_VIDEO_ASPECT_1x1:
842 case V4L2_MPEG_VIDEO_ASPECT_4x3:
845 case V4L2_MPEG_VIDEO_ASPECT_16x9:
848 case V4L2_MPEG_VIDEO_ASPECT_221x100:
856 "Video Aspect ratio", desc);
864 case V4L2_MPEG_VIDEO_BITRATE_MODE_VBR:
867 case V4L2_MPEG_VIDEO_BITRATE_MODE_CBR:
872 return SetExtControl(V4L2_CID_MPEG_VIDEO_BITRATE_MODE, value,
873 "Video Bitrate Mode", desc);
878 QString desc = QString(
"%1").arg(value);
880 "Video Average Bitrate", desc);
885 QString desc = QString(
"%1").arg(value);
886 return SetExtControl(V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, value,
887 "Video Peak Bitrate", desc);
892 struct v4l2_format vfmt {};
894 vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
896 if (ioctl(
m_fd, VIDIOC_G_FMT, &vfmt) < 0)
898 LOG(VB_GENERAL, LOG_ERR,
LOC +
899 "SetResolution() -- Error getting format" +
ENO);
903 if ((vfmt.fmt.pix.width == width) && (vfmt.fmt.pix.height == height))
905 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"Resolution is already %1x%2")
906 .arg(width).arg(height));
910 vfmt.fmt.pix.width = width;
911 vfmt.fmt.pix.height = height;
913 if (ioctl(
m_fd, VIDIOC_S_FMT, &vfmt) < 0)
915 LOG(VB_GENERAL, LOG_ERR,
LOC +
916 "SetResolution() -- Error setting format" +
ENO);
920 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"Resolution set to %1x%2")
921 .arg(width).arg(height));
928 struct v4l2_audio ain {};
931 if (ioctl(
m_fd, VIDIOC_ENUMAUDIO, &ain) < 0)
933 LOG(VB_GENERAL, LOG_WARNING,
LOC +
934 QString(
"Failed to retrieve audio input.") +
ENO);
939 if (ioctl(
m_fd, VIDIOC_S_AUDIO, &ain) < 0)
941 LOG(VB_GENERAL, LOG_WARNING,
942 LOC + QString(
"Failed to set audio input to %1.").arg(value) +
ENO);
946 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"Audio input set to %1.")
955 value = V4L2_MPEG_AUDIO_ENCODING_LAYER_2;
961 case V4L2_MPEG_AUDIO_ENCODING_LAYER_1:
964 case V4L2_MPEG_AUDIO_ENCODING_LAYER_2:
967 case V4L2_MPEG_AUDIO_ENCODING_LAYER_3:
970 case V4L2_MPEG_AUDIO_ENCODING_AAC:
973 case V4L2_MPEG_AUDIO_ENCODING_AC3:
984 LOG(VB_CHANNEL, LOG_INFO,
LOC +
985 QString(
"Overriding AudioCodec for %1 to %2")
991 "Audio Codec", desc);
998 struct v4l2_queryctrl qctrl {};
999 qctrl.id = V4L2_CID_AUDIO_VOLUME;
1000 if ((ioctl(
m_fd, VIDIOC_QUERYCTRL, &qctrl) < 0) ||
1001 (qctrl.flags & V4L2_CTRL_FLAG_DISABLED))
1003 LOG(VB_CHANNEL, LOG_WARNING,
1004 LOC +
"SetRecordingVolume() -- Audio volume control not supported.");
1009 int range = qctrl.maximum - qctrl.minimum;
1010 int value = (int) ((range * volume * 0.01F) + qctrl.minimum);
1011 int ctrl_volume =
std::clamp(value, qctrl.minimum, qctrl.maximum);
1014 struct v4l2_control ctrl {};
1015 ctrl.id = V4L2_CID_AUDIO_VOLUME;
1016 ctrl.value = ctrl_volume;
1018 if (ioctl(
m_fd, VIDIOC_S_CTRL, &ctrl) < 0)
1020 LOG(VB_GENERAL, LOG_WARNING,
LOC +
1021 "SetRecordingVolume() -- Failed to set recording volume" +
ENO);
1026 LOG(VB_RECORD, LOG_INFO,
LOC +
"SetRecordingVolume() -- volume set.");
1032 struct v4l2_tuner vt {};
1034 if (ioctl(
m_fd, VIDIOC_G_TUNER, &vt) < 0)
1036 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
1037 "SetLanguageMode() -- Failed to retrieve audio mode" +
ENO);
1043 if (ioctl(
m_fd, VIDIOC_S_TUNER, &vt) < 0)
1045 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
1046 "SetLanguageMode -- Failed to set audio mode" +
ENO);
1053 case V4L2_TUNER_MODE_MONO:
1056 case V4L2_TUNER_MODE_STEREO:
1060 case V4L2_TUNER_MODE_LANG2:
1064 case V4L2_TUNER_MODE_SAP:
1067 case V4L2_TUNER_MODE_LANG1:
1070 case V4L2_TUNER_MODE_LANG1_LANG2:
1071 desc =
"LANG1&Lang2";
1078 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"Language Mode set to %1 (%2)")
1079 .arg(desc).arg(mode));
1089 value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000;
1094 case V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100:
1097 case V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000:
1100 case V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000:
1110 LOG(VB_CHANNEL, LOG_INFO,
LOC +
1111 QString(
"Overriding sampling frequence for %1 to %2")
1116 return SetExtControl(V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, value,
1117 "Audio Sample Rate", desc);
1125 case V4L2_MPEG_AUDIO_L2_BITRATE_32K:
1128 case V4L2_MPEG_AUDIO_L2_BITRATE_48K:
1131 case V4L2_MPEG_AUDIO_L2_BITRATE_56K:
1134 case V4L2_MPEG_AUDIO_L2_BITRATE_64K:
1137 case V4L2_MPEG_AUDIO_L2_BITRATE_80K:
1140 case V4L2_MPEG_AUDIO_L2_BITRATE_96K:
1143 case V4L2_MPEG_AUDIO_L2_BITRATE_112K:
1146 case V4L2_MPEG_AUDIO_L2_BITRATE_128K:
1149 case V4L2_MPEG_AUDIO_L2_BITRATE_160K:
1152 case V4L2_MPEG_AUDIO_L2_BITRATE_192K:
1155 case V4L2_MPEG_AUDIO_L2_BITRATE_224K:
1158 case V4L2_MPEG_AUDIO_L2_BITRATE_256K:
1161 case V4L2_MPEG_AUDIO_L2_BITRATE_320K:
1164 case V4L2_MPEG_AUDIO_L2_BITRATE_384K:
1172 "Audio L2 Bitrate", desc);
1178 struct v4l2_encoder_cmd command {};
1181 if (ioctl(
m_fd, VIDIOC_ENCODER_CMD, &command) != 0 && errno != ENOTTY)
1186 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
1187 QString(
"SetEncoderState(%1) -- failed").arg(desc) +
ENO);
1190 LOG(VB_CHANNEL, LOG_INFO,
LOC +
1191 QString(
"SetEncoderState(%1) -- success").arg(desc));
1222 struct v4l2_format vbifmt {};
1224 vbifmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
1226 V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525;
1230 if (ioctl(fd, VIDIOC_S_FMT, &vbifmt) < 0)
1232 LOG(VB_CHANNEL, LOG_WARNING,
LOC +
"ConfigureVBI() -- " +
1233 "Failed to enable VBI embedding (/dev/videoX)" +
ENO);
1237 if (ioctl(fd, VIDIOC_G_FMT, &vbifmt) >= 0)
1239 LOG(VB_RECORD, LOG_INFO,
1240 LOC + QString(
"VBI service: %1, io size: %2")
1241 .arg(vbifmt.fmt.sliced.service_set)
1242 .arg(vbifmt.fmt.sliced.io_size));
1247 V4L2_MPEG_STREAM_VBI_FMT_IVTV,
1248 "MPEG Stream VBI format",
1249 "VBI in private packets, IVTV form");