mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-19 19:42:24 +02:00
screenshot: change %w format to be more like %t
Instead of containing a format string within %w{...}, simply allow %w to specify one item of a time format string. This is simpler, more like other format specifiers (%t), and probably easier to use too.
This commit is contained in:
parent
884c179177
commit
9aa206a90e
@ -1880,27 +1880,26 @@
|
||||
numbers would be more intuitive, but are not easily implementable
|
||||
because container formats usually use time stamps for identifying
|
||||
frames.)
|
||||
``%w{X}``
|
||||
Specify the current playback time using the format string ``X``. The
|
||||
nested time format string is contained within ``{`` and ``}``.
|
||||
``%p`` is like ``%w{%H:%M:%S}``, and ``%P`` is like ``%w{%H:%M:%S.%T}``.
|
||||
``%wX``
|
||||
Specify the current playback time using the format string ``X``.
|
||||
``%p`` is like ``%wH:%wM:%wS``, and ``%P`` is like ``%wH:%wM:%wS.%wT``.
|
||||
|
||||
Valid format specifiers:
|
||||
``%H``
|
||||
``%wH``
|
||||
hour (padded with 0 to two digits)
|
||||
``%h``
|
||||
``%wh``
|
||||
hour (not padded)
|
||||
``%M``
|
||||
``%wM``
|
||||
minutes (00-59)
|
||||
``%m``
|
||||
total minutes (includes hours, unlike ``%M``)
|
||||
``%S``
|
||||
``%wm``
|
||||
total minutes (includes hours, unlike ``%wM``)
|
||||
``%wS``
|
||||
seconds (00-59)
|
||||
``%s``
|
||||
``%ws``
|
||||
total seconds (includes hours and minutes)
|
||||
``%f``
|
||||
like ``%s``, but as float
|
||||
``%T``
|
||||
``%wf``
|
||||
like ``%ws``, but as float
|
||||
``%wT``
|
||||
milliseconds (000-999)
|
||||
|
||||
``%tX``
|
||||
|
@ -187,20 +187,16 @@ static char *create_fname(struct MPContext *mpctx, char *template,
|
||||
break;
|
||||
}
|
||||
case 'w': {
|
||||
if (template[0] != '{')
|
||||
char tfmt = *template;
|
||||
if (!tfmt)
|
||||
goto error_exit;
|
||||
template++;
|
||||
char *end = strchr(template, '}');
|
||||
if (!end)
|
||||
goto error_exit;
|
||||
char *fmt = talloc_strndup(res, template, end - template);
|
||||
char *s = mp_format_time_fmt(fmt, get_current_time(mpctx));
|
||||
char fmtstr[] = {'%', tfmt, '\0'};
|
||||
char *s = mp_format_time_fmt(fmtstr, get_current_time(mpctx));
|
||||
if (!s)
|
||||
goto error_exit;
|
||||
append_filename(&res, s);
|
||||
talloc_free(s);
|
||||
talloc_free(fmt);
|
||||
template = end + 1;
|
||||
break;
|
||||
}
|
||||
case 't': {
|
||||
|
Loading…
Reference in New Issue
Block a user