5 #include <linux/videodev2.h>
11 #include <QStringList>
20 explicit V4L2util(
const QString& dev_name);
21 V4L2util(
const QString& dev_name,
const QString& vbi_dev_name);
24 bool Open(
const QString& dev_name,
const QString& vbi_dev_name =
"");
26 int FD(
void)
const {
return m_fd; }
29 bool IsOpen(
void)
const {
return m_fd >= 0; }
33 bool GetFormats(QStringList&
formats);
34 bool GetVideoStandard(QString& name)
const;
35 int GetSignalStrength(
void)
const;
36 bool GetResolution(
int& width,
int& height)
const;
37 uint32_t GetCapabilities(
void)
const;
38 QString GetDeviceName(
void)
const;
39 QString GetDriverName(
void)
const;
41 bool HasTuner(
void)
const;
42 bool HasAudioSupport(
void)
const;
43 bool HasStreaming(
void)
const;
44 bool HasSlicedVBI(
void)
const;
45 bool IsEncoder(
void)
const;
46 bool UserAdjustableResolution(
void)
const;
49 QString
CardName(
void)
const {
return m_cardName; }
50 QString
ProfileName(
void)
const {
return "V4L2:" + m_driverName; }
52 int GetStreamType(
void)
const;
53 bool SetStreamType(
int value);
55 bool SetVideoAspect(
int value);
56 bool SetVideoBitrateMode(
int value);
57 bool SetVideoBitrate(
int value);
58 bool SetVideoBitratePeak(
int value);
59 bool SetResolution(uint32_t width, uint32_t height);
61 bool SetAudioInput(
int value);
62 bool SetAudioCodec(
int value);
63 bool SetVolume(
int volume);
64 bool SetLanguageMode(
int mode);
65 bool SetAudioSamplingRate(
int value);
66 bool SetAudioBitrateL2(
int value);
69 bool StartEncoding(
void);
70 bool StopEncoding(
void);
71 bool PauseEncoding(
void);
72 bool ResumeEncoding(
void);
74 static QString StreamTypeDesc(
int value);
78 static bool OpenVBI(
const QString& vbi_dev_name);
81 int GetExtControl(
int request,
const QString& ctrl_desc =
"")
const;
82 bool SetExtControl(
int request,
int value,
const QString& ctrl_desc,
83 const QString& value_desc);
84 bool SetEncoderState(
int mode,
const QString& desc);
87 static void bitmask_toString(QString& result, uint32_t flags,
88 uint32_t mask,
const QString& desc);
89 static QString ctrlflags_toString(uint32_t flags);
90 static QString queryctrl_toString(
int type);
92 void log_qctrl(
struct v4l2_queryctrl& queryctrl,
DriverOption& drv_opt,
94 bool log_control(
struct v4l2_queryctrl& qctrl,
DriverOption& drv_opt,
96 void log_controls(
bool show_menus);
106 uint32_t m_capabilities {0};
107 bool m_haveQueryExtCtrl {
false};
110 #endif // V4L2_UTIL_H