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
|
|
|
|
*/
|
|
|
|
enum PixelFormat {
|
|
|
|
PIXELFORMAT_YUYV,
|
|
|
|
PIXELFORMAT_UYVY,
|
2015-01-24 23:42:22 +01:00
|
|
|
PIXELFORMAT_BGR16,
|
|
|
|
PIXELFORMAT_BGR24,
|
2016-05-26 23:44:27 +02:00
|
|
|
PIXELFORMAT_RGB32,
|
|
|
|
PIXELFORMAT_BGR32,
|
|
|
|
PIXELFORMAT_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
|
|
|
|
|
|
|
if (pixelFormat == "yuyv")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_YUYV;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "uyvy")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_UYVY;
|
|
|
|
}
|
2016-05-26 23:44:27 +02:00
|
|
|
else if (pixelFormat == "bgr16")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_BGR16;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "bgr24")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_BGR24;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "rgb32")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_RGB32;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "bgr32")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_BGR32;
|
|
|
|
}
|
2014-03-31 17:36:36 +02:00
|
|
|
|
|
|
|
// return the default NO_CHANGE
|
|
|
|
return PIXELFORMAT_NO_CHANGE;
|
|
|
|
}
|