typed-ffmpeg-compatible 2.5.0__py3-none-any.whl → 2.6.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- typed_ffmpeg/__init__.py +4 -0
- typed_ffmpeg/base.py +24 -5
- typed_ffmpeg/common/schema.py +25 -9
- typed_ffmpeg/common/serialize.py +9 -4
- typed_ffmpeg/dag/__init__.py +8 -1
- typed_ffmpeg/dag/context.py +7 -2
- typed_ffmpeg/dag/factory.py +29 -9
- typed_ffmpeg/dag/global_runnable/global_args.py +1 -2
- typed_ffmpeg/dag/global_runnable/runnable.py +9 -3
- typed_ffmpeg/dag/io/_input.py +3 -1
- typed_ffmpeg/dag/io/_output.py +3 -1
- typed_ffmpeg/dag/io/output_args.py +7 -4
- typed_ffmpeg/dag/nodes.py +59 -29
- typed_ffmpeg/dag/schema.py +3 -3
- typed_ffmpeg/dag/validate.py +26 -8
- typed_ffmpeg/exceptions.py +1 -1
- typed_ffmpeg/filters.py +304 -72
- typed_ffmpeg/info.py +167 -0
- typed_ffmpeg/probe.py +9 -2
- typed_ffmpeg/schema.py +0 -1
- typed_ffmpeg/streams/audio.py +697 -214
- typed_ffmpeg/streams/video.py +1400 -401
- typed_ffmpeg/utils/escaping.py +6 -5
- typed_ffmpeg/utils/run.py +1 -1
- typed_ffmpeg/utils/snapshot.py +10 -6
- typed_ffmpeg/utils/view.py +7 -2
- {typed_ffmpeg_compatible-2.5.0.dist-info → typed_ffmpeg_compatible-2.6.1.dist-info}/METADATA +1 -1
- typed_ffmpeg_compatible-2.6.1.dist-info/RECORD +46 -0
- typed_ffmpeg_compatible-2.5.0.dist-info/RECORD +0 -45
- {typed_ffmpeg_compatible-2.5.0.dist-info → typed_ffmpeg_compatible-2.6.1.dist-info}/LICENSE +0 -0
- {typed_ffmpeg_compatible-2.5.0.dist-info → typed_ffmpeg_compatible-2.6.1.dist-info}/WHEEL +0 -0
- {typed_ffmpeg_compatible-2.5.0.dist-info → typed_ffmpeg_compatible-2.6.1.dist-info}/entry_points.txt +0 -0
typed_ffmpeg/dag/validate.py
CHANGED
@@ -10,7 +10,9 @@ from .nodes import FilterNode, InputNode
|
|
10
10
|
from .schema import Node, Stream
|
11
11
|
|
12
12
|
|
13
|
-
def remove_split(
|
13
|
+
def remove_split(
|
14
|
+
current_stream: Stream, mapping: dict[Stream, Stream] = None
|
15
|
+
) -> tuple[Stream, dict[Stream, Stream]]:
|
14
16
|
"""
|
15
17
|
Rebuild the graph with the given mapping.
|
16
18
|
|
@@ -37,20 +39,28 @@ def remove_split(current_stream: Stream, mapping: dict[Stream, Stream] = None) -
|
|
37
39
|
if isinstance(current_stream.node, FilterNode):
|
38
40
|
# if the current node is a split node, we need to remove it
|
39
41
|
if current_stream.node.name in ("split", "asplit"):
|
40
|
-
new_stream, _mapping = remove_split(
|
42
|
+
new_stream, _mapping = remove_split(
|
43
|
+
current_stream=current_stream.node.inputs[0], mapping=mapping
|
44
|
+
)
|
41
45
|
mapping[current_stream] = mapping[current_stream.node.inputs[0]]
|
42
46
|
return mapping[current_stream.node.inputs[0]], mapping
|
43
47
|
|
44
48
|
inputs = {}
|
45
49
|
for idx, input_stream in sorted(
|
46
|
-
enumerate(current_stream.node.inputs),
|
50
|
+
enumerate(current_stream.node.inputs),
|
51
|
+
key=lambda idx_stream: -len(idx_stream[1].node.upstream_nodes),
|
47
52
|
):
|
48
|
-
new_stream, _mapping = remove_split(
|
53
|
+
new_stream, _mapping = remove_split(
|
54
|
+
current_stream=input_stream, mapping=mapping
|
55
|
+
)
|
49
56
|
inputs[idx] = new_stream
|
50
57
|
mapping |= _mapping
|
51
58
|
|
52
59
|
new_node = replace(
|
53
|
-
current_stream.node,
|
60
|
+
current_stream.node,
|
61
|
+
inputs=tuple(
|
62
|
+
stream for idx, stream in sorted(inputs.items(), key=lambda x: x[0])
|
63
|
+
),
|
54
64
|
)
|
55
65
|
new_stream = replace(current_stream, node=new_node)
|
56
66
|
|
@@ -91,16 +101,24 @@ def add_split(
|
|
91
101
|
inputs = {}
|
92
102
|
|
93
103
|
for idx, input_stream in sorted(
|
94
|
-
enumerate(current_stream.node.inputs),
|
104
|
+
enumerate(current_stream.node.inputs),
|
105
|
+
key=lambda idx_stream: -len(idx_stream[1].node.upstream_nodes),
|
95
106
|
):
|
96
107
|
new_stream, _mapping = add_split(
|
97
|
-
current_stream=input_stream,
|
108
|
+
current_stream=input_stream,
|
109
|
+
down_node=current_stream.node,
|
110
|
+
down_index=idx,
|
111
|
+
mapping=mapping,
|
112
|
+
context=context,
|
98
113
|
)
|
99
114
|
inputs[idx] = new_stream
|
100
115
|
mapping |= _mapping
|
101
116
|
|
102
117
|
new_node = replace(
|
103
|
-
current_stream.node,
|
118
|
+
current_stream.node,
|
119
|
+
inputs=tuple(
|
120
|
+
stream for idx, stream in sorted(inputs.items(), key=lambda x: x[0])
|
121
|
+
),
|
104
122
|
)
|
105
123
|
new_stream = replace(current_stream, node=new_node)
|
106
124
|
|
typed_ffmpeg/exceptions.py
CHANGED