2014-03-31 17:36:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
#include <QString>
|
2014-03-31 17:36:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration of the possible pixel formats the grabber can be set to
|
|
|
|
*/
|
2020-06-28 23:05:32 +02:00
|
|
|
enum class PixelFormat {
|
|
|
|
YUYV,
|
|
|
|
UYVY,
|
|
|
|
BGR16,
|
|
|
|
BGR24,
|
|
|
|
RGB32,
|
|
|
|
BGR32,
|
2020-03-27 23:13:58 +01:00
|
|
|
#ifdef HAVE_JPEG_DECODER
|
2020-06-28 23:05:32 +02:00
|
|
|
MJPEG,
|
2019-04-28 19:53:45 +02:00
|
|
|
#endif
|
2020-06-28 23:05:32 +02:00
|
|
|
NO_CHANGE
|
2014-03-31 17:36:36 +02:00
|
|
|
};
|
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
inline PixelFormat parsePixelFormat(QString pixelFormat)
|
2014-03-31 17:36:36 +02:00
|
|
|
{
|
|
|
|
// convert to lower case
|
2017-03-04 22:17:42 +01:00
|
|
|
pixelFormat = pixelFormat.toLower();
|
2014-03-31 17:36:36 +02:00
|
|
|
|
2020-06-28 23:05:32 +02:00
|
|
|
if (pixelFormat.compare("yuyv") )
|
2014-03-31 17:36:36 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::YUYV;
|
2014-03-31 17:36:36 +02:00
|
|
|
}
|
2020-06-28 23:05:32 +02:00
|
|
|
else if (pixelFormat.compare("uyvy") )
|
2014-03-31 17:36:36 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::UYVY;
|
2014-03-31 17:36:36 +02:00
|
|
|
}
|
2020-06-28 23:05:32 +02:00
|
|
|
else if (pixelFormat.compare("bgr16") )
|
2016-05-26 23:44:27 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::BGR16;
|
2016-05-26 23:44:27 +02:00
|
|
|
}
|
2020-06-28 23:05:32 +02:00
|
|
|
else if (pixelFormat.compare("bgr24") )
|
2016-05-26 23:44:27 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::BGR24;
|
2016-05-26 23:44:27 +02:00
|
|
|
}
|
2020-06-28 23:05:32 +02:00
|
|
|
else if (pixelFormat.compare("rgb32") )
|
2016-05-26 23:44:27 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::RGB32;
|
2016-05-26 23:44:27 +02:00
|
|
|
}
|
2020-06-28 23:05:32 +02:00
|
|
|
else if (pixelFormat.compare("bgr32") )
|
2016-05-26 23:44:27 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::BGR32;
|
2016-05-26 23:44:27 +02:00
|
|
|
}
|
2020-03-27 23:13:58 +01:00
|
|
|
#ifdef HAVE_JPEG_DECODER
|
2020-06-28 23:05:32 +02:00
|
|
|
else if (pixelFormat.compare("mjpeg") )
|
2019-04-28 19:53:45 +02:00
|
|
|
{
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::MJPEG;
|
2019-04-28 19:53:45 +02:00
|
|
|
}
|
|
|
|
#endif
|
2014-03-31 17:36:36 +02:00
|
|
|
|
|
|
|
// return the default NO_CHANGE
|
2020-06-28 23:05:32 +02:00
|
|
|
return PixelFormat::NO_CHANGE;
|
2014-03-31 17:36:36 +02:00
|
|
|
}
|