Skip to content

validate

remove_split

remove_split(
    current_stream: Stream,
    mapping: dict[Stream, Stream] = None,
) -> tuple[Stream, dict[Stream, Stream]]

Rebuild the graph with the given mapping.

Parameters:

Name Type Description Default
current_stream Stream

The stream to rebuild the graph with.

required
mapping dict[Stream, Stream]

The mapping to rebuild the graph with.

None

Returns:

Type Description
tuple[Stream, dict[Stream, Stream]]

A tuple of the new node and the new mapping.

add_split

add_split(
    current_stream: Stream,
    down_node: Node = None,
    down_index: int = None,
    context: DAGContext = None,
    mapping: dict[
        tuple[Stream, Node | None, int | None], Stream
    ] = None,
) -> tuple[
    Stream,
    dict[tuple[Stream, Node | None, int | None], Stream],
]

Add split nodes to the graph.

Parameters:

Name Type Description Default
current_stream Stream

The stream to add split nodes to.

required
down_node Node

The node use current_stream as input.

None
down_index int

The index of the input stream in down_node.

None
context DAGContext

The DAG context.

None
mapping dict[tuple[Stream, Node | None, int | None], Stream]

The mapping to add split nodes to.

None

Returns:

Type Description
tuple[Stream, dict[tuple[Stream, Node | None, int | None], Stream]]

A tuple of the new node and the new mapping.

fix_graph

fix_graph(stream: Stream) -> Stream

Fix the graph by removing and adding split nodes.

Parameters:

Name Type Description Default
stream Stream

The stream to fix.

required

Returns:

Type Description
Stream

The fixed stream.

Note

Fix the graph by resetting split nodes. This function is for internal use only.

validate

validate(stream: Stream, auto_fix: bool = True) -> Stream

Validate the given DAG. If auto_fix is True, the graph will be automatically fixed to follow ffmpeg's rule.

Parameters:

Name Type Description Default
stream Stream

The DAG to validate.

required
auto_fix bool

Whether to automatically fix the graph.

True

Returns:

Type Description
Stream

The validated DAG context.