mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge branch 'mediafoundation' of https://github.com/Paulchen-Panther/hyperion.ng into mediafoundation
This commit is contained in:
commit
6c6689f3bb
@ -61,10 +61,10 @@ 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}}; }
|
||||
QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const override { return { {devicePath, 0} }; }
|
||||
QStringList getAvailableEncodingFormats(const QString& devicePath, const int& /*deviceInput*/) const override;
|
||||
QMultiMap<int, int> 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;
|
||||
QIntList getAvailableDeviceFramerates(const QString& devicePath, const int& /*deviceInput*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
|
||||
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold, int noSignalCounterThreshold) override;
|
||||
void setSignalDetectionOffset( double verticalMin, double horizontalMin, double verticalMax, double horizontalMax) override;
|
||||
void setSignalDetectionEnable(bool enable) override;
|
||||
|
@ -14,7 +14,7 @@
|
||||
// util includes
|
||||
#include <utils/PixelFormat.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
#include <grabber/VideoStandard.h>
|
||||
#include <utils/VideoStandard.h>
|
||||
#include <utils/Components.h>
|
||||
#include <cec/CECEvent.h>
|
||||
|
||||
@ -50,6 +50,7 @@ public:
|
||||
struct InputProperties
|
||||
{
|
||||
QString inputName = QString();
|
||||
QList<VideoStandard> standards = QList<VideoStandard>();
|
||||
struct EncodingProperties
|
||||
{
|
||||
unsigned int width = 0;
|
||||
@ -142,6 +143,11 @@ public:
|
||||
///
|
||||
QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QList<VideoStandard> getAvailableDeviceStandards(const QString& devicePath, const int& deviceInput) const override;
|
||||
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
@ -155,7 +161,7 @@ public:
|
||||
///
|
||||
/// @brief overwrite Grabber.h implementation
|
||||
///
|
||||
QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
|
||||
QIntList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const override;
|
||||
|
||||
|
||||
public slots:
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/Image.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <grabber/VideoStandard.h>
|
||||
#include <utils/VideoStandard.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
@ -145,6 +145,14 @@ public:
|
||||
///
|
||||
virtual QMultiMap<QString, int> getDeviceInputs(const QString& /*devicePath*/) const { return QMultiMap<QString, int>(); }
|
||||
|
||||
///
|
||||
/// @brief Get a list of available device video standards depends on device input
|
||||
/// @param devicePath The device path
|
||||
/// @param inputIndex The device input index
|
||||
/// @return List of video standards on success else empty List
|
||||
///
|
||||
virtual QList<VideoStandard> getAvailableDeviceStandards(const QString& /*devicePath*/, const int& /*deviceInput*/) const { return QList<VideoStandard>(); }
|
||||
|
||||
///
|
||||
/// @brief Get a list of all available device encoding formats depends on device input
|
||||
/// @param devicePath The device path
|
||||
@ -171,7 +179,7 @@ public:
|
||||
/// @param heigth The device heigth
|
||||
/// @return List of framerates on success else empty List
|
||||
///
|
||||
virtual QStringList getAvailableDeviceFramerates(const QString& /*devicePath*/, const int& /*deviceInput*/, const PixelFormat& /*encFormat*/, const unsigned /*width*/, const unsigned /*height*/) const { return QStringList(); }
|
||||
virtual QIntList getAvailableDeviceFramerates(const QString& /*devicePath*/, const int& /*deviceInput*/, const PixelFormat& /*encFormat*/, const unsigned /*width*/, const unsigned /*height*/) const { return QIntList(); }
|
||||
|
||||
protected:
|
||||
ImageResampler _imageResampler;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/PixelFormat.h>
|
||||
#include <utils/settings.h>
|
||||
#include <utils/VideoStandard.h>
|
||||
|
||||
class Grabber;
|
||||
class GlobalSignals;
|
||||
@ -77,6 +78,14 @@ public:
|
||||
///
|
||||
virtual QMultiMap<QString, int> getDeviceInputs(const QString& devicePath) const;
|
||||
|
||||
///
|
||||
/// @brief Get a list of available device video standards depends on device input
|
||||
/// @param devicePath The device path
|
||||
/// @param inputIndex The device input index
|
||||
/// @return List of video standards on success else empty List
|
||||
///
|
||||
virtual QList<VideoStandard> getAvailableDeviceStandards(const QString& devicePath, const int& deviceInput) const;
|
||||
|
||||
///
|
||||
/// @brief Get a list of all available device encoding formats depends on device input
|
||||
/// @param devicePath The device path
|
||||
@ -95,7 +104,7 @@ public:
|
||||
virtual QMultiMap<int, int> getAvailableDeviceResolutions(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat) const;
|
||||
|
||||
///
|
||||
/// @brief Get a list of available device framerates depends on encoding format and resolution
|
||||
/// @brief Get a list of available device framerates depends on device input, encoding format and resolution
|
||||
/// @param devicePath The device path
|
||||
/// @param inputIndex The device input index
|
||||
/// @param encFormat The device encoding format
|
||||
@ -103,7 +112,7 @@ public:
|
||||
/// @param heigth The device heigth
|
||||
/// @return List of framerates on success else empty List
|
||||
///
|
||||
virtual QStringList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const;
|
||||
virtual QIntList getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const;
|
||||
|
||||
///
|
||||
/// @brief Get active grabber name
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
/**
|
||||
* Enumeration of the possible video standards the grabber can be set to
|
||||
*/
|
||||
@ -13,17 +15,17 @@ enum class VideoStandard {
|
||||
inline VideoStandard parseVideoStandard(const QString& videoStandard)
|
||||
{
|
||||
// convert to lower case
|
||||
QString standard = videoStandard.toLower();
|
||||
QString standard = videoStandard.toUpper();
|
||||
|
||||
if (standard == "pal")
|
||||
if (standard == "PAL")
|
||||
{
|
||||
return VideoStandard::PAL;
|
||||
}
|
||||
else if (standard == "ntsc")
|
||||
else if (standard == "NTSC")
|
||||
{
|
||||
return VideoStandard::NTSC;
|
||||
}
|
||||
else if (standard == "secam")
|
||||
else if (standard == "SECAM")
|
||||
{
|
||||
return VideoStandard::SECAM;
|
||||
}
|
||||
@ -31,3 +33,14 @@ inline VideoStandard parseVideoStandard(const QString& videoStandard)
|
||||
// return the default NO_CHANGE
|
||||
return VideoStandard::NO_CHANGE;
|
||||
}
|
||||
|
||||
inline QString VideoStandard2String(VideoStandard videoStandard)
|
||||
{
|
||||
switch (videoStandard)
|
||||
{
|
||||
case VideoStandard::PAL: return "PAL";
|
||||
case VideoStandard::NTSC: return "NTSC";
|
||||
case VideoStandard::SECAM: return "SECAM";
|
||||
default: return "NO_CHANGE";
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define QSTRING_CSTR(str) str.toLocal8Bit().constData()
|
||||
typedef QList< int > QIntList;
|
||||
|
||||
|
||||
|
@ -508,6 +508,13 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
|
||||
in["name"] = input.key();
|
||||
in["inputIdx"] = input.value();
|
||||
|
||||
QJsonArray standards;
|
||||
QList<VideoStandard> videoStandards = GrabberWrapper::getInstance()->getAvailableDeviceStandards(devicePath, input.value());
|
||||
for (auto standard : videoStandards)
|
||||
{
|
||||
standards.append(VideoStandard2String(standard));
|
||||
}
|
||||
|
||||
QJsonArray formats;
|
||||
QStringList encodingFormats = GrabberWrapper::getInstance()->getAvailableEncodingFormats(devicePath, input.value());
|
||||
for (auto encodingFormat : encodingFormats)
|
||||
@ -521,10 +528,10 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
|
||||
{
|
||||
QJsonObject resolution;
|
||||
resolution["width"] = width_height.key();
|
||||
resolution["heigth"] = width_height.value();
|
||||
resolution["height"] = width_height.value();
|
||||
|
||||
QJsonArray fps;
|
||||
QStringList framerates = GrabberWrapper::getInstance()->getAvailableDeviceFramerates(devicePath, input.value(), parsePixelFormat(encodingFormat), width_height.key(), width_height.value());
|
||||
QIntList framerates = GrabberWrapper::getInstance()->getAvailableDeviceFramerates(devicePath, input.value(), parsePixelFormat(encodingFormat), width_height.key(), width_height.value());
|
||||
for (auto framerate : framerates)
|
||||
{
|
||||
fps.append(framerate);
|
||||
@ -538,6 +545,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
|
||||
formats.append(format);
|
||||
}
|
||||
|
||||
in["standards"] = standards;
|
||||
in["formats"] = formats;
|
||||
video_inputs.append(in);
|
||||
}
|
||||
|
@ -718,14 +718,14 @@ QMultiMap<int, int> MFGrabber::getAvailableDeviceResolutions(const QString& devi
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList MFGrabber::getAvailableDeviceFramerates(const QString& devicePath, const int& /*device input not used on windows*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
|
||||
QIntList MFGrabber::getAvailableDeviceFramerates(const QString& devicePath, const int& /*device input not used on windows*/, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
|
||||
{
|
||||
QStringList result = QStringList();
|
||||
QIntList result = QIntList();
|
||||
|
||||
for(int i = 0; i < _deviceProperties[devicePath].count(); ++i )
|
||||
{
|
||||
QString fps = QString::number(_deviceProperties[devicePath][i].numerator / _deviceProperties[devicePath][i].denominator);
|
||||
if(!result.contains(fps, Qt::CaseInsensitive) && _deviceProperties[devicePath][i].pf == encFormat && _deviceProperties[devicePath][i].width == width && _deviceProperties[devicePath][i].height == height)
|
||||
int fps = _deviceProperties[devicePath][i].numerator / _deviceProperties[devicePath][i].denominator;
|
||||
if(!result.contains(fps) && _deviceProperties[devicePath][i].pf == encFormat && _deviceProperties[devicePath][i].width == width && _deviceProperties[devicePath][i].height == height)
|
||||
result << fps;
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,26 @@ void V4L2Grabber::getV4Ldevices()
|
||||
V4L2Grabber::DeviceProperties::InputProperties inputProperties;
|
||||
inputProperties.inputName = QString((char*)input.name);
|
||||
|
||||
// Enumerate video standards
|
||||
struct v4l2_standard standard;
|
||||
CLEAR(standard);
|
||||
|
||||
standard.index = 0;
|
||||
while (xioctl(fd, VIDIOC_ENUMSTD, &standard) >= 0)
|
||||
{
|
||||
if (standard.id & input.std)
|
||||
{
|
||||
if (standard.id == V4L2_STD_PAL)
|
||||
inputProperties.standards.append(VideoStandard::PAL);
|
||||
else if (standard.id == V4L2_STD_NTSC)
|
||||
inputProperties.standards.append(VideoStandard::NTSC);
|
||||
else if (standard.id == V4L2_STD_SECAM)
|
||||
inputProperties.standards.append(VideoStandard::SECAM);
|
||||
}
|
||||
|
||||
standard.index++;
|
||||
}
|
||||
|
||||
// Enumerate pixel formats
|
||||
struct v4l2_fmtdesc desc;
|
||||
CLEAR(desc);
|
||||
@ -1437,6 +1457,21 @@ QMultiMap<QString, int> V4L2Grabber::getDeviceInputs(const QString& devicePath)
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<VideoStandard> V4L2Grabber::getAvailableDeviceStandards(const QString& devicePath, const int& deviceInput) const
|
||||
{
|
||||
QList<VideoStandard> result =QList<VideoStandard>();
|
||||
|
||||
for(auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it)
|
||||
if (it.key() == devicePath)
|
||||
for (auto input = it.value().inputs.begin(); input != it.value().inputs.end(); input++)
|
||||
if (input.key() == deviceInput)
|
||||
for (auto standard = input.value().standards.begin(); standard != input.value().standards.end(); standard++)
|
||||
if(!result.contains(*standard))
|
||||
result << *standard;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList V4L2Grabber::getAvailableEncodingFormats(const QString& devicePath, const int& deviceInput) const
|
||||
{
|
||||
QStringList result = QStringList();
|
||||
@ -1467,9 +1502,9 @@ QMultiMap<int, int> V4L2Grabber::getAvailableDeviceResolutions(const QString& de
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList V4L2Grabber::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
|
||||
QIntList V4L2Grabber::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
|
||||
{
|
||||
QStringList result = QStringList();
|
||||
QIntList result = QIntList();
|
||||
|
||||
for(auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it)
|
||||
if (it.key() == devicePath)
|
||||
@ -1478,8 +1513,8 @@ QStringList V4L2Grabber::getAvailableDeviceFramerates(const QString& devicePath,
|
||||
for (auto enc = input.value().encodingFormats.begin(); enc != input.value().encodingFormats.end(); enc++)
|
||||
if(enc.key() == encFormat && enc.value().width == width && enc.value().height == height)
|
||||
for (auto fps = enc.value().framerates.begin(); fps != enc.value().framerates.end(); fps++)
|
||||
if(!result.contains(QString::number(*fps)))
|
||||
result << QString::number(*fps);
|
||||
if(!result.contains(*fps))
|
||||
result << *fps;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -246,6 +246,14 @@ QMultiMap<QString, int> GrabberWrapper::getDeviceInputs(const QString& devicePat
|
||||
return QMultiMap<QString, int>();
|
||||
}
|
||||
|
||||
QList<VideoStandard> GrabberWrapper::getAvailableDeviceStandards(const QString& devicePath, const int& deviceInput) const
|
||||
{
|
||||
if(_grabberName.startsWith("V4L"))
|
||||
return _ggrabber->getAvailableDeviceStandards(devicePath, deviceInput);
|
||||
|
||||
return QList<VideoStandard>();
|
||||
}
|
||||
|
||||
QStringList GrabberWrapper::getAvailableEncodingFormats(const QString& devicePath, const int& deviceInput) const
|
||||
{
|
||||
if(_grabberName.startsWith("V4L"))
|
||||
@ -262,10 +270,10 @@ QMultiMap<int, int> GrabberWrapper::getAvailableDeviceResolutions(const QString&
|
||||
return QMultiMap<int, int>();
|
||||
}
|
||||
|
||||
QStringList GrabberWrapper::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
|
||||
QIntList GrabberWrapper::getAvailableDeviceFramerates(const QString& devicePath, const int& deviceInput, const PixelFormat& encFormat, const unsigned width, const unsigned height) const
|
||||
{
|
||||
if(_grabberName.startsWith("V4L"))
|
||||
return _ggrabber->getAvailableDeviceFramerates(devicePath, deviceInput, encFormat, width, height);
|
||||
|
||||
return QStringList();
|
||||
return QIntList();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user