gen
¶
Code generation utilities for typed-ffmpeg.
Functions:
| Name | Description |
|---|---|
default_typings |
Get the default typing of the filter option. |
default_value |
Get the default value of the filter option. |
filter_option_typing |
Get the typing of the filter option. |
filter_option_typings |
Get the typing of the filter options. |
input_typings |
Get the input typings of the filter. |
normalize_help_text |
Normalize help text by replacing newlines and extra spaces. |
option_name_safe |
Convert option name to safe name. |
option_typing |
Get the typing of the option. |
output_typings |
Get the output typings of the filter. |
render |
Render the filter and option documents. |
stream_name_safe |
Convert stream name to safe name. |
default_typings
¶
default_typings(
option: FFMpegFilterOption, f: FFMpegFilter
) -> str
Get the default typing of the filter option.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
FFMpegFilterOption
|
The filter option |
required |
f
|
FFMpegFilter
|
The filter |
required |
Returns:
| Type | Description |
|---|---|
str
|
The default typing of the filter option |
default_value
¶
default_value(
option: FFMpegFilterOption, f: FFMpegFilter
) -> str
Get the default value of the filter option.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
FFMpegFilterOption
|
The filter option |
required |
f
|
FFMpegFilter
|
The filter |
required |
Returns:
| Type | Description |
|---|---|
str
|
The default value of the filter option |
filter_option_typing
¶
filter_option_typing(option: FFMpegFilterOption) -> str
Get the typing of the filter option.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
FFMpegFilterOption
|
The filter option |
required |
Returns:
| Type | Description |
|---|---|
str
|
The typing of the filter option |
filter_option_typings
¶
filter_option_typings(ffmpeg_filter: FFMpegFilter) -> str
Get the typing of the filter options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ffmpeg_filter
|
FFMpegFilter
|
The filter |
required |
Returns:
| Type | Description |
|---|---|
str
|
The typing of the filter options |
input_typings
¶
input_typings(ffmpeg_filter: FFMpegFilter) -> str
Get the input typings of the filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ffmpeg_filter
|
FFMpegFilter
|
The filter |
required |
Returns:
| Type | Description |
|---|---|
str
|
The input typings of the filter |
normalize_help_text
¶
normalize_help_text(text: str) -> str
Normalize help text by replacing newlines and extra spaces.
This function handles cases where FFmpeg help text contains line breaks, such as: 'text ("option1", "option2"\n "continuation text")' The pattern specifically targets the C-style string continuation where a backslash-newline-whitespace-quote sequence should be replaced with a single space to join the strings properly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The help text to normalize |
required |
Returns:
| Type | Description |
|---|---|
str
|
The normalized help text with all content on a single line |
option_name_safe
¶
option_name_safe(string: str) -> str
Convert option name to safe name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
The option name |
required |
Returns:
| Type | Description |
|---|---|
str
|
The option name safe |
option_typing
¶
option_typing(option: FFMpegOption) -> str
Get the typing of the option.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
FFMpegOption
|
The option |
required |
Returns:
| Type | Description |
|---|---|
str
|
The typing of the option |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the option type is unknown. |
output_typings
¶
output_typings(ffmpeg_filter: FFMpegFilter) -> str
Get the output typings of the filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ffmpeg_filter
|
FFMpegFilter
|
The filter |
required |
Returns:
| Type | Description |
|---|---|
str
|
The output typings of the filter |
render
¶
render(*, outpath: Path, **kwargs: Any) -> list[Path]
Render the filter and option documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outpath
|
Path
|
The output path |
required |
**kwargs
|
Any
|
Additional keyword arguments to pass to the template |
{}
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
The rendered files |
stream_name_safe
¶
stream_name_safe(string: str) -> str
Convert stream name to safe name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
The stream name |
required |
Returns:
| Type | Description |
|---|---|
str
|
The stream name safe |