mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-05-24 16:01:26 +08:00
Merge remote-tracking branch 'origin/master' into feature/17
Conflicts: ffmpeg/_run.py ffmpeg/nodes.py
This commit is contained in:
commit
677967b4c2
@ -16,7 +16,8 @@ def input(filename, **kwargs):
|
||||
kwargs['filename'] = filename
|
||||
fmt = kwargs.pop('f', None)
|
||||
if fmt:
|
||||
assert 'format' not in kwargs, "Can't specify both `format` and `f` kwargs"
|
||||
if 'format' in kwargs:
|
||||
raise ValueError("Can't specify both `format` and `f` kwargs")
|
||||
kwargs['format'] = fmt
|
||||
return InputNode(input.__name__, **kwargs)
|
||||
|
||||
@ -46,7 +47,8 @@ def output(parent_node, filename, **kwargs):
|
||||
kwargs['filename'] = filename
|
||||
fmt = kwargs.pop('f', None)
|
||||
if fmt:
|
||||
assert 'format' not in kwargs, "Can't specify both `format` and `f` kwargs"
|
||||
if 'format' in kwargs:
|
||||
raise ValueError("Can't specify both `format` and `f` kwargs")
|
||||
kwargs['format'] = fmt
|
||||
return OutputNode([parent_node], output.__name__, **kwargs)
|
||||
|
||||
|
@ -48,7 +48,7 @@ def _get_input_args(input_node):
|
||||
args += _convert_kwargs_to_cmd_line_args(kwargs)
|
||||
args += ['-i', filename]
|
||||
else:
|
||||
assert False, 'Unsupported input node: {}'.format(input_node)
|
||||
raise ValueError('Unsupported input node: {}'.format(input_node))
|
||||
return args
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ def _get_global_args(node):
|
||||
if node.name == overwrite_output.__name__:
|
||||
return ['-y']
|
||||
else:
|
||||
assert False, 'Unsupported global node: {}'.format(node)
|
||||
raise ValueError('Unsupported global node: {}'.format(node))
|
||||
|
||||
|
||||
def _get_output_args(node, stream_name_map):
|
||||
@ -87,7 +87,7 @@ def _get_output_args(node, stream_name_map):
|
||||
args += _convert_kwargs_to_cmd_line_args(kwargs)
|
||||
args += [filename]
|
||||
else:
|
||||
assert False, 'Unsupported output node: {}'.format(node)
|
||||
raise ValueError('Unsupported output node: {}'.format(node))
|
||||
return args
|
||||
|
||||
|
||||
|
@ -162,7 +162,8 @@ def topo_sort(start_nodes):
|
||||
sorted_nodes = []
|
||||
child_map = {}
|
||||
def visit(node, child):
|
||||
assert node not in marked_nodes, 'Graph is not a DAG'
|
||||
if node in marked_nodes:
|
||||
raise RuntimeError('Graph is not a DAG')
|
||||
if child is not None:
|
||||
if node not in child_map:
|
||||
child_map[node] = []
|
||||
|
@ -44,7 +44,8 @@ class OutputNode(Node):
|
||||
|
||||
class GlobalNode(Node):
|
||||
def __init__(self, parent, name, *args, **kwargs):
|
||||
assert isinstance(parent, OutputNode), 'Global nodes can only be attached after output nodes'
|
||||
if not isinstance(parent, OutputNode):
|
||||
raise RuntimeError('Global nodes can only be attached after output nodes')
|
||||
super(GlobalNode, self).__init__([parent], name, *args, **kwargs)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user