base ¶
Classes:
-
PropEnum–Base class for enumerations representing frame or clip properties in VapourSynth.
PropEnum ¶
Bases: CustomIntEnum
Base class for enumerations representing frame or clip properties in VapourSynth.
Methods:
-
apply–Applies the property to the VideoNode.
-
ensure_presence–Ensure the presence of the property in the VideoNode.
-
ensure_presences–Ensure the presence of multiple PropEnums at once.
-
from_param_or_video–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_param_with_fallback–Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted
-
from_res–Get an enum member from the video resolution with heuristics.
-
from_video–Get an enum member from the frame properties or optionally fall back to resolution when strict=False.
-
is_unspecified–Whether the value is unspecified.
-
pretty_string–Get a pretty, displayable string of the enum member.
-
prop_key–The key used in props to store the enum.
-
string–Get the string representation used in resize plugin/encoders.
Source code in vstools/enums/base.py
34 35 36 | |
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
67 68 69 70 71 | |
ensure_presence classmethod ¶
ensure_presence(
clip: VideoNode, value: Any, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
153 154 155 156 157 158 159 160 | |
ensure_presences staticmethod ¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[PropEnum] | PropEnum],
func: FuncExcept | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code in vstools/enums/base.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
from_param_or_video classmethod ¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Self
Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
If strict=False, gather the heuristics using the clip's size or format.
Parameters:
-
(value¶Any) –Value to cast.
-
(src¶VideoNode | VideoFrame | Mapping[str, Any]) –Clip to get prop from.
-
(strict¶bool, default:False) –Be strict about the frame properties. Default: False.
-
(func_except¶FuncExcept | None, default:None) –Function returned for custom error handling.
Source code in vstools/enums/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
from_param_with_fallback classmethod ¶
Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted or represents an unspecified enum member.
Parameters:
-
(value¶Any) –The input value to convert into an enum member.
-
(fallback¶T | None, default:None) –The value to return if the input cannot be converted. Defaults to
None.
Returns:
-
Self | T | None–The corresponding enum member if conversion succeeds, otherwise the provided
fallbackvalue.
Source code in vstools/enums/base.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
from_res abstractmethod classmethod ¶
from_res(frame: VideoNode | VideoFrame) -> Self
Get an enum member from the video resolution with heuristics.
Source code in vstools/enums/base.py
79 80 81 82 83 84 | |
from_video abstractmethod classmethod ¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Self
Get an enum member from the frame properties or optionally fall back to resolution when strict=False.
Source code in vstools/enums/base.py
86 87 88 89 90 91 92 93 | |
is_unspecified ¶
is_unspecified() -> bool
Whether the value is unspecified.
Source code in vstools/enums/base.py
73 74 75 76 77 | |
pretty_string ¶
pretty_string() -> str
Get a pretty, displayable string of the enum member.
Source code in vstools/enums/base.py
45 46 47 48 49 50 | |