base ¶
Classes:
-
PropEnum–
PropEnum ¶
Bases: CustomIntEnum
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_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_unknown–Whether the value represents an unknown value.
-
is_valid–Check if the given value is a valid int value of this enum.
-
prop_key–The key used in props to store the enum.
Attributes:
-
pretty_string(str) –Get a pretty, displayable string of the enum member.
-
string(str) –Get the string representation used in resize plugin/encoders.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
96 97 98 99 100 101 | |
ensure_presence classmethod ¶
ensure_presence(
clip: VideoNode, value: int | Self | None, /, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
84 85 86 87 88 89 90 91 92 93 94 | |
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
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
from_param_or_video classmethod ¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | FrameProps,
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 | FrameProps) –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
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
from_res classmethod ¶
from_res(frame: VideoNode | VideoFrame) -> Self
Get an enum member from the video resolution with heuristics.
Source code in vstools/enums/base.py
40 41 42 43 44 45 46 | |
from_video 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
48 49 50 51 52 53 54 55 56 | |
is_unknown classmethod ¶
Whether the value represents an unknown value.
Source code in vstools/enums/base.py
13 14 15 16 17 18 19 | |
is_valid classmethod ¶
Check if the given value is a valid int value of this enum.
Source code in vstools/enums/base.py
139 140 141 142 143 144 | |