mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Utils/Obs: Add scaleX
and scaleY
plus new util
This commit is contained in:
parent
45f7661a5d
commit
5faadc12de
@ -10,6 +10,8 @@
|
||||
|
||||
#define CASE(x) case x: return #x;
|
||||
|
||||
#define RET_COMPARE(str, x) if (str == #x) return x;
|
||||
|
||||
std::vector<std::string> ConvertStringArray(char **array)
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
@ -154,6 +156,19 @@ std::string Utils::Obs::StringHelper::GetOutputTimecodeString(obs_output_t *outp
|
||||
return formatted.toStdString();
|
||||
}
|
||||
|
||||
enum obs_bounds_type Utils::Obs::EnumHelper::GetSceneItemBoundsType(std::string boundsType)
|
||||
{
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_NONE);
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_STRETCH);
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_INNER);
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_OUTER);
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_TO_WIDTH);
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_TO_HEIGHT);
|
||||
RET_COMPARE(boundsType, OBS_BOUNDS_MAX_ONLY);
|
||||
|
||||
return OBS_BOUNDS_NONE;
|
||||
}
|
||||
|
||||
uint64_t Utils::Obs::NumberHelper::GetOutputDuration(obs_output_t *output)
|
||||
{
|
||||
if (!output || !obs_output_active(output))
|
||||
@ -400,6 +415,9 @@ json Utils::Obs::DataHelper::GetSceneItemTransform(obs_sceneitem_t *item)
|
||||
|
||||
ret["rotation"] = osi.rot;
|
||||
|
||||
ret["scaleX"] = osi.scale.x;
|
||||
ret["scaleY"] = osi.scale.y;
|
||||
|
||||
ret["width"] = osi.scale.x * sourceWidth;
|
||||
ret["height"] = osi.scale.y * sourceHeight;
|
||||
|
||||
|
@ -39,6 +39,10 @@ namespace Utils {
|
||||
std::string GetOutputTimecodeString(obs_output_t *output);
|
||||
}
|
||||
|
||||
namespace EnumHelper {
|
||||
enum obs_bounds_type GetSceneItemBoundsType(std::string boundsType);
|
||||
}
|
||||
|
||||
namespace NumberHelper {
|
||||
uint64_t GetOutputDuration(obs_output_t *output);
|
||||
size_t GetSceneCount();
|
||||
|
Loading…
Reference in New Issue
Block a user