[MPlayer-dev-eng] demux_mf: improve format string processing

Alexander Strasser eclipse7 at gmx.net
Tue Jun 1 23:26:29 EEST 2021


On 2021-04-28 08:47 +0200, Alexander Strasser wrote:
[...]
> ---8<---
>
>     mf://[<mf spec>]
>
> The *mf spec* is a specification from which the input paths should be
> deduced. It can be one of these:
>
>     <glob pattern>|<printf format>|<comma delimited paths>|@<list file>
>
> If the *mf spec* is left out, a shell globbing pattern of `*` is used.
>
> ## list file
>
> If the first character of after *mf spec* is `@`, the remaining
> characters will be used as a path to open as a file. If the file is
> readable, each line will be interpreted as one path for the multi
> file input.
>
> ## comma delimited paths
>
> If *mf spec* contains a `,` it is considered to be list of comma
> delimited paths, that will be used as input paths in that order.
>
> ## glob pattern
>
> If it **doesn't** contain a `%` it is assumed to be a glob pattern.
> The glob pattern will be evaluated and the resulting list of files
> if any, will be used as paths for the multi file input.
>
> If the glob pattern doesn't contain a `*`, it will be appended.
>
> ## printf format
>
> If *mf spec* **didn't** yet match any of the cases described above,
> it will be considered to be a printf format string. This string
> will be used to render an input path with a single int argument.
> This argument is a counter starting at zero, incrementing by one
> after each call.
>
> Should it happen that for, in sum, 5 of any of the rendered paths
> the file status (stat) couldn't be retrieved, the path sequence
> will be considered finished.
>
> --->8---
>
> WARNING: I reverse engineered the description from the source
> code, but didn't actually test if all my assertions are correct.

One correction I have noticed while working on the code lately.

Only one of the pattern types

* comma delimited paths
* glob pattern
* printf format

will be tried depending on the contents of <mf spec>.

If it contains a comma it will be: comma delimited paths
If it doesn't contain a comma and doesn't contain % it will be: glob pattern
Else it will be: printf format


  Alexander


More information about the MPlayer-dev-eng mailing list