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:
@@ -2,7 +2,7 @@
|
||||
#include <getoptPlusPlus/getoptpp.h>
|
||||
|
||||
// grabber includes
|
||||
#include <grabber/PixelFormat.h>
|
||||
#include <utils/PixelFormat.h>
|
||||
|
||||
using namespace vlofgren;
|
||||
|
||||
@@ -10,34 +10,34 @@ using namespace vlofgren;
|
||||
typedef vlofgren::PODParameter<PixelFormat> PixelFormatParameter;
|
||||
|
||||
namespace vlofgren {
|
||||
/// Translates a string (as passed on the commandline) to a pixel format
|
||||
///
|
||||
/// @param[in] s The string (as passed on the commandline)
|
||||
/// @return The pixel format
|
||||
/// @throws Parameter::ParameterRejected If the string did not result in a pixel format
|
||||
template<>
|
||||
PixelFormat PixelFormatParameter::validate(const std::string& s) throw (Parameter::ParameterRejected)
|
||||
{
|
||||
QString input = QString::fromStdString(s).toLower();
|
||||
/// Translates a string (as passed on the commandline) to a pixel format
|
||||
///
|
||||
/// @param[in] s The string (as passed on the commandline)
|
||||
/// @return The pixel format
|
||||
/// @throws Parameter::ParameterRejected If the string did not result in a pixel format
|
||||
template<>
|
||||
PixelFormat PixelFormatParameter::validate(const std::string& s) throw (Parameter::ParameterRejected)
|
||||
{
|
||||
QString input = QString::fromStdString(s).toLower();
|
||||
|
||||
if (input == "yuyv")
|
||||
{
|
||||
return PIXELFORMAT_YUYV;
|
||||
}
|
||||
else if (input == "uyvy")
|
||||
{
|
||||
return PIXELFORMAT_UYVY;
|
||||
}
|
||||
else if (input == "rgb32")
|
||||
{
|
||||
return PIXELFORMAT_RGB32;
|
||||
}
|
||||
else if (input == "no-change")
|
||||
{
|
||||
return PIXELFORMAT_NO_CHANGE;
|
||||
}
|
||||
if (input == "yuyv")
|
||||
{
|
||||
return PIXELFORMAT_YUYV;
|
||||
}
|
||||
else if (input == "uyvy")
|
||||
{
|
||||
return PIXELFORMAT_UYVY;
|
||||
}
|
||||
else if (input == "rgb32")
|
||||
{
|
||||
return PIXELFORMAT_RGB32;
|
||||
}
|
||||
else if (input == "no-change")
|
||||
{
|
||||
return PIXELFORMAT_NO_CHANGE;
|
||||
}
|
||||
|
||||
throw Parameter::ParameterRejected("Invalid value for pixel format. Valid values are: YUYV, UYVY, RGB32, and NO-CHANGE");
|
||||
return PIXELFORMAT_NO_CHANGE;
|
||||
}
|
||||
throw Parameter::ParameterRejected("Invalid value for pixel format. Valid values are: YUYV, UYVY, RGB32, and NO-CHANGE");
|
||||
return PIXELFORMAT_NO_CHANGE;
|
||||
}
|
||||
}
|
||||
|
@@ -102,6 +102,7 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// cropping values if not defined
|
||||
if (!argCropLeft.isSet()) argCropLeft.setDefault(argCropWidth.getValue());
|
||||
if (!argCropRight.isSet()) argCropRight.setDefault(argCropWidth.getValue());
|
||||
if (!argCropTop.isSet()) argCropTop.setDefault(argCropHeight.getValue());
|
||||
|
Reference in New Issue
Block a user