mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge branch 'mediafoundation' of https://github.com/Paulchen-Panther/hyperion.ng into mediafoundation
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user