mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Extract ImageResampler from X11Grabber
Former-commit-id: 63e95fa85fc0ef5a66f6eb8b396cf4b6370cf5dd
This commit is contained in:
41
include/utils/PixelFormat.h
Normal file
41
include/utils/PixelFormat.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
* Enumeration of the possible pixel formats the grabber can be set to
|
||||
*/
|
||||
enum PixelFormat {
|
||||
PIXELFORMAT_YUYV,
|
||||
PIXELFORMAT_UYVY,
|
||||
PIXELFORMAT_RGB32,
|
||||
PIXELFORMAT_BGR32,
|
||||
PIXELFORMAT_NO_CHANGE
|
||||
};
|
||||
|
||||
inline PixelFormat parsePixelFormat(std::string pixelFormat)
|
||||
{
|
||||
// convert to lower case
|
||||
std::transform(pixelFormat.begin(), pixelFormat.end(), pixelFormat.begin(), ::tolower);
|
||||
|
||||
if (pixelFormat == "yuyv")
|
||||
{
|
||||
return PIXELFORMAT_YUYV;
|
||||
}
|
||||
else if (pixelFormat == "uyvy")
|
||||
{
|
||||
return PIXELFORMAT_UYVY;
|
||||
}
|
||||
else if (pixelFormat == "rgb32")
|
||||
{
|
||||
return PIXELFORMAT_RGB32;
|
||||
}
|
||||
else if (pixelFormat == "bgr32")
|
||||
{
|
||||
return PIXELFORMAT_BGR32;
|
||||
}
|
||||
|
||||
// return the default NO_CHANGE
|
||||
return PIXELFORMAT_NO_CHANGE;
|
||||
}
|
Reference in New Issue
Block a user