mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor V4L2 grabber (part 1) (#62)
This commit is contained in:
@@ -61,6 +61,7 @@ public:
|
||||
bool getCecDetectionEnabled() const { return _cecDetectionEnabled; }
|
||||
QStringList getDevices() const override;
|
||||
QString getDeviceName(const QString& devicePath) const override { return devicePath; }
|
||||
QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const override { return {{ devicePath, 0}}; }
|
||||
QStringList getAvailableEncodingFormats(const QString& devicePath, const int& /*deviceInput*/) const override;
|
||||
QStringList getAvailableDeviceResolutions(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat) const override;
|
||||
QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
|
||||
|
@@ -35,9 +35,10 @@
|
||||
#include <turbojpeg.h>
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Capture class for V4L2 devices
|
||||
///
|
||||
/// @see http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html
|
||||
|
||||
class V4L2Grabber : public Grabber
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -45,10 +46,19 @@ class V4L2Grabber : public Grabber
|
||||
public:
|
||||
struct DeviceProperties
|
||||
{
|
||||
QString name = QString();
|
||||
QMultiMap<QString, int> inputs = QMultiMap<QString, int>();
|
||||
QStringList resolutions = QStringList();
|
||||
QStringList framerates = QStringList();
|
||||
QString name = QString();
|
||||
struct InputProperties
|
||||
{
|
||||
QString inputName = QString();
|
||||
struct EncodingProperties
|
||||
{
|
||||
unsigned int width = 0;
|
||||
unsigned int height = 0;
|
||||
QList<int> framerates = QList<int>();
|
||||
};
|
||||
QMultiMap<PixelFormat, EncodingProperties> encodingFormats = QMultiMap<PixelFormat, EncodingProperties>();
|
||||
};
|
||||
QMap<int, InputProperties> inputs = QMap<int, InputProperties>();
|
||||
};
|
||||
|
||||
V4L2Grabber(const QString & device, const unsigned width, const unsigned height, const unsigned fps, const unsigned input, VideoStandard videoStandard, PixelFormat pixelFormat, int pixelDecimation);
|
||||
@@ -120,27 +130,33 @@ public:
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QStringList getV4L2devices() const override;
|
||||
QStringList getDevices() const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QString getV4L2deviceName(const QString& devicePath) const override;
|
||||
QString getDeviceName(const QString& devicePath) const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QMultiMap<QString, int> getV4L2deviceInputs(const QString& devicePath) const override;
|
||||
QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QStringList getResolutions(const QString& devicePath) const override;
|
||||
QStringList getAvailableEncodingFormats(const QString& devicePath, const int& deviceInput) const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QStringList getFramerates(const QString& devicePath) const override;
|
||||
QMultiMap<int, int> getAvailableDeviceResolutions(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat) const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -275,5 +291,5 @@ private:
|
||||
bool _deviceAutoDiscoverEnabled;
|
||||
|
||||
protected:
|
||||
void enumFrameIntervals(QStringList &framerates, int fileDescriptor, int pixelformat, int width, int height);
|
||||
void enumFrameIntervals(QList<int> &framerates, int fileDescriptor, int pixelformat, int width, int height);
|
||||
};
|
||||
|
Reference in New Issue
Block a user