Bug fixes and new implementations

- Video format MJPEG implemented (libjpeg/qimage)
- Inactive priorities are now skipped correctly (PriorityMuxer.cpp line 297)
- v4l configuration section replaced with an object (preparation for #542)
This commit is contained in:
Paulchen-Panther
2019-04-28 19:53:45 +02:00
parent 4aab0ad55c
commit 0a8af60726
15 changed files with 587 additions and 415 deletions

View File

@@ -60,7 +60,7 @@ int main(int argc, char** argv)
Option & argDevice = parser.add<Option> ('d', "device", "The device to use, can be /dev/video0 [default: %1 (auto detected)]", "auto");
SwitchOption<VideoStandard> & argVideoStandard= parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC, SECAM or no-change. [default: %1]", "no-change");
SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32 or no-change. [default: %1]", "no-change");
SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32, MJPEG or no-change. [default: %1]", "no-change");
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0");
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)");
@@ -96,6 +96,9 @@ int main(int argc, char** argv)
argPixelFormat.addSwitch("yuyv", PIXELFORMAT_YUYV);
argPixelFormat.addSwitch("uyvy", PIXELFORMAT_UYVY);
argPixelFormat.addSwitch("rgb32", PIXELFORMAT_RGB32);
#ifdef HAVE_JPEG
argPixelFormat.addSwitch("mjpeg", PIXELFORMAT_MJPEG);
#endif
argPixelFormat.addSwitch("no-change", PIXELFORMAT_NO_CHANGE);
// parse all options
@@ -212,9 +215,11 @@ int main(int argc, char** argv)
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&grabber, SIGNAL(newFrame(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
if (grabber.start())
QCoreApplication::exec();
grabber.stop();
// Start the capturing
grabber.start();
// Start the application
app.exec();
}
}
catch (const std::runtime_error & e)

View File

@@ -57,7 +57,7 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
, _webserver(nullptr)
, _jsonServer(nullptr)
, _udpListener(nullptr)
, _v4l2Grabbers()
, _v4l2Grabbers(nullptr)
, _dispmanx(nullptr)
, _x11Grabber(nullptr)
, _amlGrabber(nullptr)
@@ -162,14 +162,10 @@ void HyperionDaemon::freeObjects()
delete _fbGrabber;
delete _osxGrabber;
delete _qtGrabber;
for(V4L2Wrapper* grabber : _v4l2Grabbers)
{
delete grabber;
}
delete _v4l2Grabbers;
delete _stats;
_v4l2Grabbers.clear();
_v4l2Grabbers = nullptr;
_bonjourBrowserWrapper = nullptr;
_amlGrabber = nullptr;
_dispmanx = nullptr;
@@ -386,19 +382,9 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
}
else if(type == settings::V4L2)
{
// stop
if(_v4l2Grabbers.size()>0)
return;
unsigned v4lEnableCount = 0;
const QJsonArray & v4lArray = config.array();
for ( signed idx=0; idx<v4lArray.size(); idx++)
{
#ifdef ENABLE_V4L2
const QJsonObject & grabberConfig = v4lArray.at(idx).toObject();
bool enableV4l = grabberConfig["enable"].toBool(true);
#ifdef ENABLE_V4L2
const QJsonObject & grabberConfig = config.object();
V4L2Wrapper* grabber = new V4L2Wrapper(
grabberConfig["device"].toString("auto"),
@@ -425,15 +411,9 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
// connect to HyperionDaemon signal
connect(this, &HyperionDaemon::videoMode, grabber, &V4L2Wrapper::setVideoMode);
connect(this, &HyperionDaemon::settingsChanged, grabber, &V4L2Wrapper::handleSettingsUpdate);
if (enableV4l)
v4lEnableCount++;
_v4l2Grabbers.push_back(grabber);
#endif
}
ErrorIf( (v4lEnableCount>0 && _v4l2Grabbers.size()==0), _log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
#else
Error(_log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
#endif
}
}
@@ -449,7 +429,7 @@ void HyperionDaemon::createGrabberDispmanx()
Info(_log, "DISPMANX frame grabber created");
#else
Error( _log, "The dispmanx framegrabber can not be instantiated, because it has been left out from the build");
Error(_log, "The dispmanx framegrabber can not be instantiated, because it has been left out from the build");
#endif
}
@@ -466,7 +446,7 @@ void HyperionDaemon::createGrabberAmlogic()
Info(_log, "AMLOGIC grabber created");
#else
Error( _log, "The AMLOGIC grabber can not be instantiated, because it has been left out from the build");
Error(_log, "The AMLOGIC grabber can not be instantiated, because it has been left out from the build");
#endif
}

View File

@@ -137,7 +137,7 @@ private:
WebServer* _webserver;
JsonServer* _jsonServer;
UDPListener* _udpListener;
std::vector<V4L2Wrapper*> _v4l2Grabbers;
V4L2Wrapper* _v4l2Grabbers;
DispmanxWrapper* _dispmanx;
X11Wrapper* _x11Grabber;
AmlogicWrapper* _amlGrabber;