V4l2 input (#825)

This commit is contained in:
Paulchen Panther
2020-06-17 20:55:57 +02:00
committed by GitHub
parent 423a59fa34
commit 756247aa1e
18 changed files with 252 additions and 77 deletions

View File

@@ -8,6 +8,7 @@ Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int c
, _width(width)
, _height(height)
, _fps(15)
, _input(-1)
, _cropLeft(0)
, _cropRight(0)
, _cropTop(0)
@@ -70,6 +71,17 @@ void Grabber::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTo
}
}
bool Grabber::setInput(int input)
{
if((input >= 0) && (_input != input))
{
_input = input;
return true;
}
return false;
}
bool Grabber::setWidthHeight(int width, int height)
{
// eval changes with crop
@@ -91,7 +103,10 @@ bool Grabber::setWidthHeight(int width, int height)
bool Grabber::setFramerate(int fps)
{
if((fps > 0) && (_fps != fps))
{
_fps = fps;
return true;
}
return (fps > 0) && (_fps != fps);
return false;
}

View File

@@ -160,6 +160,9 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
obj["cropTop"].toInt(0),
obj["cropBottom"].toInt(0));
// device input
_ggrabber->setInput(obj["input"].toInt(-1));
// device resolution
_ggrabber->setWidthHeight(obj["width"].toInt(0), obj["height"].toInt(0));
@@ -236,6 +239,14 @@ QString GrabberWrapper::getV4L2deviceName(QString devicePath)
return QString();
}
QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(QString devicePath)
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2deviceInputs(devicePath);
return QMultiMap<QString, int>();
}
QStringList GrabberWrapper::getResolutions(QString devicePath)
{
if(_grabberName.startsWith("V4L"))

View File

@@ -14,7 +14,19 @@
},
"required" : true,
"propertyOrder" : 2,
"comment" : "The 'available_device' settings are dynamically inserted into the WebUI under PropertyOrder '1'."
"comment" : "The 'available_devices' settings are dynamically inserted into the WebUI under PropertyOrder '1'."
},
"input" :
{
"type" : "integer",
"title" : "edt_conf_enum_custom",
"default" : 0,
"options" : {
"hidden":true
},
"required" : true,
"propertyOrder" : 4,
"comment" : "The 'device_inputs' settings are dynamically inserted into the WebUI under PropertyOrder '3'."
},
"standard" :
{
@@ -26,7 +38,7 @@
"enum_titles" : ["edt_conf_enum_NO_CHANGE", "edt_conf_enum_PAL", "edt_conf_enum_NTSC", "edt_conf_enum_SECAM"]
},
"required" : true,
"propertyOrder" : 3
"propertyOrder" : 5
},
"width" :
{
@@ -39,8 +51,8 @@
"hidden":true
},
"required" : true,
"propertyOrder" : 5,
"comment" : "The 'resolution' settings are dynamically inserted into the WebUI under PropertyOrder '4'."
"propertyOrder" : 7,
"comment" : "The 'resolutions' settings are dynamically inserted into the WebUI under PropertyOrder '6'."
},
"height" :
{
@@ -53,7 +65,7 @@
"hidden":true
},
"required" : true,
"propertyOrder" : 6
"propertyOrder" : 8
},
"fps" :
{
@@ -66,8 +78,8 @@
"hidden":true
},
"required" : true,
"propertyOrder" : 8,
"comment" : "The 'frames per second' setting is dynamically inserted into the WebUI under PropertyOrder '7'."
"propertyOrder" : 10,
"comment" : "The 'framerates' setting is dynamically inserted into the WebUI under PropertyOrder '9'."
},
"sizeDecimation" :
{
@@ -77,7 +89,7 @@
"maximum" : 30,
"default" : 6,
"required" : true,
"propertyOrder" : 9
"propertyOrder" : 11
},
"cropLeft" :
{
@@ -87,7 +99,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 10
"propertyOrder" : 12
},
"cropRight" :
{
@@ -97,7 +109,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 11
"propertyOrder" : 13
},
"cropTop" :
{
@@ -107,7 +119,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 12
"propertyOrder" : 14
},
"cropBottom" :
{
@@ -117,7 +129,7 @@
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 13
"propertyOrder" : 15
},
"signalDetection" :
{
@@ -125,7 +137,7 @@
"title" : "edt_conf_v4l2_signalDetection_title",
"default" : false,
"required" : true,
"propertyOrder" : 14
"propertyOrder" : 16
},
"redSignalThreshold" :
{
@@ -141,7 +153,7 @@
}
},
"required" : true,
"propertyOrder" : 15
"propertyOrder" : 17
},
"greenSignalThreshold" :
{
@@ -157,7 +169,7 @@
}
},
"required" : true,
"propertyOrder" : 16
"propertyOrder" : 18
},
"blueSignalThreshold" :
{
@@ -173,7 +185,7 @@
}
},
"required" : true,
"propertyOrder" : 17
"propertyOrder" : 19
},
"sDVOffsetMin" :
{
@@ -189,7 +201,7 @@
}
},
"required" : true,
"propertyOrder" : 18
"propertyOrder" : 20
},
"sDVOffsetMax" :
{
@@ -205,7 +217,7 @@
}
},
"required" : true,
"propertyOrder" : 19
"propertyOrder" : 21
},
"sDHOffsetMin" :
{
@@ -221,7 +233,7 @@
}
},
"required" : true,
"propertyOrder" : 20
"propertyOrder" : 22
},
"sDHOffsetMax" :
{
@@ -237,7 +249,7 @@
}
},
"required" : true,
"propertyOrder" : 21
"propertyOrder" : 23
}
},
"additionalProperties" : true