Skip to content

Commit 43b9236

Browse files
author
Thinner77
authored
V4L: allow setting of V4L device input, Fixes #537 (#540)
1 parent a25481c commit 43b9236

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Diff for: sources/grabber/v4l2/V4L2Grabber.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ bool V4L2Grabber::init()
275275
try
276276
{
277277
Info(_log, "*************************************************************************************************");
278-
Info(_log, "Starting V4L2 grabber. Selected: %s [%s] %d x %d @ %d fps %s", QSTRING_CSTR(foundDevice), QSTRING_CSTR(dev.name),
278+
Info(_log, "Starting V4L2 grabber. Selected: %s [%s] %d x %d @ %d fps %s input %d", QSTRING_CSTR(foundDevice), QSTRING_CSTR(dev.name),
279279
dev.valid[foundIndex].x, dev.valid[foundIndex].y, dev.valid[foundIndex].fps,
280-
QSTRING_CSTR(pixelFormatToString(dev.valid[foundIndex].pf)));
280+
QSTRING_CSTR(pixelFormatToString(dev.valid[foundIndex].pf)), _input);
281281
Info(_log, "*************************************************************************************************");
282282

283283
if (init_device(foundDevice, dev.valid[foundIndex]))
@@ -548,11 +548,14 @@ void V4L2Grabber::enumerateV4L2devices(bool silent)
548548
if (properties.valid.size() == 0 && realName.indexOf("usbtv ", 0, Qt::CaseInsensitive) == 0)
549549
{
550550
Warning(_log, "To have proper colors when using UTV007 grabber, you may need to add 'sudo systemctl stop hyperhdr@pi && v4l2-ctl -s pal-B && sudo systemctl start hyperhdr@pi' to /etc/rc.local or run it manually to set the PAL standard");
551-
{ DevicePropertiesItem diL; diL.x = 320; diL.y = 240; diL.fps = 30; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = 0; properties.valid.append(diL); }
552-
{ DevicePropertiesItem diL; diL.x = 320; diL.y = 288; diL.fps = 25; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = 0; properties.valid.append(diL); }
553-
{ DevicePropertiesItem diL; diL.x = 360; diL.y = 240; diL.fps = 30; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = 0; properties.valid.append(diL); }
554-
{ DevicePropertiesItem diL; diL.x = 720; diL.y = 480; diL.fps = 30; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = 0; properties.valid.append(diL); }
555-
{ DevicePropertiesItem diL; diL.x = 720; diL.y = 576; diL.fps = 25; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = 0; properties.valid.append(diL); }
551+
for (int input = 0; input < properties.inputs.size(); input++)
552+
{
553+
{ DevicePropertiesItem diL; diL.x = 320; diL.y = 240; diL.fps = 30; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = input; properties.valid.append(diL); }
554+
{ DevicePropertiesItem diL; diL.x = 320; diL.y = 288; diL.fps = 25; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = input; properties.valid.append(diL); }
555+
{ DevicePropertiesItem diL; diL.x = 360; diL.y = 240; diL.fps = 30; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = input; properties.valid.append(diL); }
556+
{ DevicePropertiesItem diL; diL.x = 720; diL.y = 480; diL.fps = 30; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = input; properties.valid.append(diL); }
557+
{ DevicePropertiesItem diL; diL.x = 720; diL.y = 576; diL.fps = 25; diL.pf = identifyFormat(V4L2_PIX_FMT_YUYV); diL.v4l2PixelFormat = V4L2_PIX_FMT_YUYV; diL.input = input; properties.valid.append(diL); }
558+
}
556559
}
557560

558561
_deviceProperties.insert(realName, properties);
@@ -562,7 +565,7 @@ void V4L2Grabber::enumerateV4L2devices(bool silent)
562565
for (int i = 0; i < properties.valid.count(); i++)
563566
{
564567
const auto& di = properties.valid[i];
565-
Info(_log, "%s [%s] %d x %d @ %d fps %s", QSTRING_CSTR(realName), QSTRING_CSTR(properties.name), di.x, di.y, di.fps, QSTRING_CSTR(pixelFormatToString(di.pf)));
568+
Info(_log, "%s [%s] %d x %d @ %d fps %s input %d", QSTRING_CSTR(realName), QSTRING_CSTR(properties.name), di.x, di.y, di.fps, QSTRING_CSTR(pixelFormatToString(di.pf)), di.input);
566569
}
567570
}
568571
}

Diff for: www/js/grabber.js

+8
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,14 @@ $(document).ready( function(){
747747
if (checkExists(window.schema.videoGrabber.properties.videoEncoding.enum, name))
748748
window.schema.videoGrabber.properties.videoEncoding.options.enum_titles.push(name);
749749
}
750+
751+
for(var i = 0; i < currentInfo.inputs.length && currentInfo.inputs.length > 1; i++)
752+
{
753+
var inputnr = parseInt((currentInfo.inputs[i].inputIndex).toString());
754+
var name = (currentInfo.inputs[i].inputName).toString();
755+
if (checkExists(window.schema.videoGrabber.properties.input.enum, inputnr))
756+
window.schema.videoGrabber.properties.input.options.enum_titles.push(inputnr.toString() + ": " + name);
757+
}
750758
}
751759

752760

0 commit comments

Comments
 (0)