Skip to content

Commit

Permalink
Fix #410 arg type options (#411)
Browse files Browse the repository at this point in the history
* fix template

* fix

* fix

* add extra_options

* add comment

* add missing snapshot

* update snapshot
  • Loading branch information
lucemia authored Jan 3, 2025
1 parent 20b04ae commit 0c4152a
Show file tree
Hide file tree
Showing 21 changed files with 2,177 additions and 416 deletions.
3 changes: 3 additions & 0 deletions src/ffmpeg/dag/global_runnable/global_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def global_args(
adrift_threshold: Func = None,
qphist: Func = None,
vsync: Func = None,
extra_options: dict[str, Any] = None,
**kwargs: Any,
) -> GlobalStream:
"""
Expand Down Expand Up @@ -114,6 +115,7 @@ def global_args(
adrift_threshold: deprecated, does nothing
qphist: deprecated, does nothing
vsync: set video sync method globally; deprecated, use -fps_mode
extra_options: Additional options
**kwargs: Additional options
Returns:
Expand Down Expand Up @@ -173,6 +175,7 @@ def global_args(
}.items()
if v is not None
}
| (extra_options or {})
| kwargs
),
).stream()
4 changes: 3 additions & 1 deletion src/ffmpeg/dag/io/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def input(
dcodec: String = None,
dn: Boolean = None,
top: Int = None,
extra_options: dict[str, Any] = None,
**kwargs: Any
) -> AVStream:
"""
Expand Down Expand Up @@ -123,6 +124,7 @@ def input(
dcodec: alias for -c:d (select encoder/decoder for data streams)
dn: disable data
top: deprecated, use the setfield video filter
extra_options: ffmpeg's input file options
**kwargs: ffmpeg's input file options
Returns:
Expand Down Expand Up @@ -194,4 +196,4 @@ def input(
if v is not None
}

return InputNode(filename=str(filename), kwargs=tuple((options | kwargs).items())).stream()
return InputNode(filename=str(filename), kwargs=tuple((options | (extra_options or {}) | kwargs).items())).stream()
6 changes: 5 additions & 1 deletion src/ffmpeg/dag/io/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def output(
dcodec: String = None,
dn: Boolean = None,
top: Int = None,
extra_options: dict[str, Any] = None,
**kwargs: Any
) -> OutputStream:
"""
Expand Down Expand Up @@ -208,6 +209,7 @@ def output(
dcodec: alias for -c:d (select encoder/decoder for data streams)
dn: disable data
top: deprecated, use the setfield video filter
extra_options: the arguments for the output
**kwargs: the arguments for the output
Returns:
Expand Down Expand Up @@ -315,4 +317,6 @@ def output(
if v is not None
}

return OutputNode(inputs=streams, filename=str(filename), kwargs=tuple((options | kwargs).items())).stream()
return OutputNode(
inputs=streams, filename=str(filename), kwargs=tuple((options | (extra_options or {}) | kwargs).items())
).stream()
4 changes: 3 additions & 1 deletion src/ffmpeg/dag/io/output_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def output(
dcodec: String = None,
dn: Boolean = None,
top: Int = None,
extra_options: dict[str, Any] = None,
**kwargs: Any,
) -> OutputStream:
"""
Expand Down Expand Up @@ -217,6 +218,7 @@ def output(
dcodec: alias for -c:d (select encoder/decoder for data streams)
dn: disable data
top: deprecated, use the setfield video filter
extra_options: the arguments for the output
**kwargs: the arguments for the output
Returns:
Expand Down Expand Up @@ -324,4 +326,4 @@ def output(
if v is not None
}

return self._output_node(*streams, filename=filename, **options, **kwargs).stream()
return self._output_node(*streams, filename=filename, **options, **(extra_options or {}), **kwargs).stream()
Loading

0 comments on commit 0c4152a

Please sign in to comment.