hyperion.ng/src/hyperion-v4l2/VideoStandardParameter.h
johan e58f84d5c8 Merge branch 'master' into merge_v4l2
Former-commit-id: 97b281cc14b3bc239fc5eab1f66c9d15e67f753f
2014-02-23 21:53:13 +01:00

40 lines
1.1 KiB
C++

// getoptPlusPLus includes
#include <getoptPlusPlus/getoptpp.h>
// grabber includes
#include <grabber/VideoStandard.h>
using namespace vlofgren;
/// Data parameter for the video standard
typedef vlofgren::PODParameter<VideoStandard> VideoStandardParameter;
namespace vlofgren {
/// Translates a string (as passed on the commandline) to a color standard
///
/// @param[in] s The string (as passed on the commandline)
/// @return The color standard
/// @throws Parameter::ParameterRejected If the string did not result in a video standard
template<>
VideoStandard VideoStandardParameter::validate(const std::string& s) throw (Parameter::ParameterRejected)
{
QString input = QString::fromStdString(s).toLower();
if (input == "pal")
{
return VIDEOSTANDARD_PAL;
}
else if (input == "ntsc")
{
return VIDEOSTANDARD_NTSC;
}
else if (input == "no-change")
{
return VIDEOSTANDARD_NO_CHANGE;
}
throw Parameter::ParameterRejected("Invalid value for video standard. Valid values are: PAL, NTSC, and NO-CHANGE");
return VIDEOSTANDARD_NO_CHANGE;
}
}