This affects property format strings like they are used in the
"show_text" input command, for --playing-msg, and other places.
To quote the documentation comment on m_properties_expand_string():
${NAME} is expanded to the value of property NAME.
If NAME starts with '=', use the raw value of the property.
${NAME:STR} expands to the property, or STR if the property is not
available.
${?NAME:STR} expands to STR if the property is available.
${!NAME:STR} expands to STR if the property is not available.
STR is recursively expanded using the same rules.
"$$" can be used to escape "$", and "$}" to escape "}".
"$>" disables parsing of "$" for the rest of the string.
Most importantly, "?(property:str)" becomes "${?property:str}".
Make the simple fallback case easier, e.g. "${property:fallback}"
instead of "${property}?(!property:fallback)".
Add the ability to escape the format meta characters. "$" is used for
escaping, because escaping with "\" is taken by the commands parser in
the layer below. "$>" can be used to disable interpretation of format
strings (of course escapes by the commands parser can't be canceled).
By default, properties which are unavailable or don't exist are turned
into a string signaling the status (e.g. "(unavailable)"), instead of
an empty string. If an empty string is desired, this has to be done
explicitly: "${property:}" (the fallback part is an empty string). Raw
properties still return an empty string on error.
m_properties_expand_string() now returns a talloc'ed pointer, instead of
a malloc'ed one.
The Doxygen-style documentation comments were nothing but bloat.
Also move mp_property_do() and mp_property_print() to command.h, where
they should belong, and fix their argument types. m_property.c/h is
supposed to be generic, while command.h provides declarations specific
to the mplayer core.
These have been replaced by properties. Also remove some other slave-
mode specific get commands that can be replaced by property uses.
The get_metadata() function didn't actually contain anything useful,
and just replicated code from other parts of mplayer.
In order to stay binary compatible with libavcodec, applications should
not dependent on sizeof(AVFrame). This means allocating AVFrame on the
stack is not allowed, and the function avcodec_alloc_frame() must be
used to allocate an AVFrame instead.
Partially based on a patch by uau.
Windows uses a legacy codepage for char* / runtime functions accepting
char *. Using UTF-8 as the codepage with setlocale() is explicitly
forbidden.
Work this around by overriding the MSVCRT functions with wrapper
macros, that assume UTF-8 and use "proper" API calls like _wopen etc.
to deal with unicode filenames. All code that uses standard functions
that take or return filenames must now include osdep/io.h. stat()
can't be overridden, because MinGW-w64 itself defines "stat" as a
macro. Change code to use use mp_stat() instead.
This is not perfectly clean, but still somewhat sane, and much better
than littering the rest of the mplayer code with MinGW specific hacks.
It's also a bit fragile, but that's actually little different from the
previous situation. Also, MinGW is unlikely to ever include a nice way
of dealing with this.
This is a minor simplification. The original intend was to only open a
file if opening the image encoder went well, but this obscure special
case is not worth bothering the image writer functions with more error
handling.
This adds the --screenshot-template option, which specifies a template
for the filename used for a screenshot. The '%' character is parsed as
format specifier. These format specifiers insert metadata into the
filename. For example, '%f' is replaced with the filename of the
currently played file.
The following format specifiers are available:
%n Insert sequence number (padded with 4 zeros), e.g. "0002".
%0Nn Like %n, but pad to N zeros (N = 0 to 9).
%n behaves like %04n.
%#n Like %n, but reset the sequence counter on every screenshot.
(Useful if other parts in the template make the resulting
filename already mostly unique.)
%#0Nn Use %0Nn and %#n at the same time.
%f Insert filename of the currently played video.
%F Like %f, but with stripped file extension ("." and rest).
%p Insert current playback time, in HH:MM:SS format.
%P Like %p, but adds milliseconds: HH:MM:SS.mmmm
%tX Insert the current local date/time, using the date format X.
X is a single letter and is passed to strftime() as "%X".
E.g. "%td" inserts the number of the current day.
%{prop} Insert the value of the slave property 'prop'.
E.g. %{filename} is the same as %f. If the property doesn't
exist or is not available, nothing is inserted, unless a
fallback is specified as in %{prop:fallback text}.
%% Insert the character '%'.
The strings inserted by format specifiers will be checked for
characters not allowed in filenames (including '/' and '\'), and
replaced with the placeholder '_'. (This doesn't happen for text that
was passed with the --screenshot-template option, and allows specifying
a screenshot target directory by prefixing the template with a relative
or absolute path.)
If the screenshot_force video filter is inserted, taking screenshots will
always use the video filter, and skip the VO specific screenshot code.
This can be useful if the VO code causes problems, or if it's intended to
take screenshots from a specific location in the filter chain.
The 'screenshot' filter is intended as fallback, it's not used if possible.
Libavcodec started checking that avctx->pix_fmt is set when opening
an encoder. The existing code (originally from vf_screenshot.c) only
set it afterwards, which now made screenshots fail. Fix the code to
set parameters before calling avcodec_open2().
Also fix some minor things, which seems to make it work for other
encoders. This could be used to add more libavcodec based image
writers. Fix memory leak (missing av_free(avctx)).
Change various code to use the latest Libav API. The libavcodec
error_recognition setting has been removed and replaced with different
semantics. I removed the "--lavdopts=er=<value>" option accordingly,
as I don't think it's widely enough used to be worth attempting to
emulate the old option semantics using the new API. A new option with
the new semantics can be added later if needed.
Libav dropped APIs that were necessary with all Libav versions
until quite recently (like setting avctx->age), and it would thus not
be possible to keep compatibility with previous Libav versions without
adding workarounds. The new APIs also had some bugs/limitations in the
recent Libav release 0.8, and it would not work fully (at least some
avcodec options would not be set correctly). Because of those issues,
this commit makes no attempt to maintain compatibility with anything
but the latest Libav git head. Hopefully the required fixes and
improvements will be included in a following Libav point release.
The default compression setting is 7, which is hopefully a good balance
between speed of compression, and resulting file sizes. The maximum png
compression will be very slow even on fast computers. On the other hand,
the lowest compression setting produces files of several MB size with
normal video resolutions, which should be avoided as well.
The screenshot image file type can now be selected with the
--screenshot-filetype option. The --screenshot-jpeg-quality option
controls the compression setting of the written JPEG image file.
Adding these flags improves the quality of the YUV->RGB conversion when
screenshots are taken. It trades precision for performance.
This doesn't affect any other swscale uses, such as vf_scale or vo_x11.
Based on a patch by cantabile. Fixes#140.
The screenshot command normally converts the currently displayed video
frame to an image. Add support for an alternative screenshot mode
that is supposed to capture the real window contents. Such a
screenshot contains a possibly scaled version of the frame, the OSD,
and subtitles.
Add a default key binding Alt+s for taking screenshots in this mode.
This needs special VO support, and might not work with all VOs (this
commit does not yet contain an implementation for any VO, only the
infrastructure).
Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot
directly from the VO. If VO support is available, screenshots will be
taken instantly (no more 1 or 2 frames delay). Taking screenshots when
hardware decoding is in use will also work (vdpau). Additionally, the
screenshots will now use the same colorspace as the video display.
Change the central MPContext to be allocated with talloc so that it
can be used as a talloc parent context.
This commit does not yet implement the functionality for any VO (added
in subsequent commits).
The old screenshot video filter is not needed anymore if VO support is
present, and in that case will not be used even if it is present in
the filter chain. If VO support is not available then the filter is
used like before. Note that the filter still has some of the old
problems, such as delaying the screenshot by at least 1 frame.