| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The property-to-option bridge (when properties change values normally
set by the command line parser) uses M_PROPERTY_GET_TYPE to get the
exact option type. In these cases, the entry in mp_properties[] is
unused, except for the name field and the property callback. Instead,
mp_property_generic_option() implements M_PROPERTY_GET_TYPE and returns
the m_option as defined in cfg-mplayer.h. However, if a property is
unavailable, mp_property_generic_option() is never actually called, and
M_PROPERTY_GET_TYPE will return the dummy option entry.
We could make sure that the dummy option entry equals the option entry
defined in cfg-mplayer.h. But this would duplicate all information.
Add a dummy option type m_option_type_dummy, which is used by entries
using the property-to-option bridge. Make M_PROPERTY_GET_TYPE fail if
this type is encountered.
This dummy should never be used, as it isn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, both the command parser and property expansion
(m_properties_expand_string) handled escapes with '\'. Move all escape
handling into the command parser, and remove it from the property code.
This removes the need to escape strings twice for commands that use
property expansion.
The command parser is practically rewritten: it uses m_option for the
actual parsing, and reduces hackish C-string handling.
|
|
|
|
|
|
|
|
|
| |
This is Better (tm).
The only actual change is that with M_PROPERTY_SET_STRING, the option
parser will use the property name, instead whatever was set in the
name field of the option returned by M_PROPERTY_GET_TYPE. In most cases,
these should be the same, though.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now it depends on the command whether a property wraps around, or stops
at min/max valid property value.
For practically all properties, it's quite unambiguous what the "switch"
command should have done, and there's technically no need to replace it
with these new commands. More over, most properties that cycle are
boolean anyway. But it seems more orthogonal to make the difference
explicit, rather than hardcoding it. Having different commands also
makes it more explicit to the user what these commands do, both just due
to the naming, and what wrapping policy is used. The code is simpler
too.
|
|
|
|
|
|
| |
Instead, communicate the new value range with M_PROPERTY_GET_TYPE. Add
M_PROPERTY_GET_WRAP to allow properties to enable cycling instead of
stopping at min/max.
|
|
|
|
|
| |
Change the type of the arg for this action from m_option** to m_option*.
This makes it easier to change some aspects of the option dynamically.
|
|
|
|
|
|
|
|
|
| |
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 should never be overridden by property implementations anyway,
because it would likely result in inconsistencies. The right way to do
this is adding a new m_option type.
Also some cosmetics.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make more properties use the property-to-option bridge to reduce code
size and to enforce consistency. Some options are renamed to the same
as the properties (the property names are better in all cases).
Do some other minor cleanups. One bigger issue was memory management of
strings: M_PROPERTY_TO_STRING assumed the strings were statically
allocated, and no dynamic allocations could be returned. Fix this in
case the need for such properties arises in the future. Get rid of
m_property_string_ro(), because it's not always clear that the "action"
parameter is M_PROPERTY_SET and the string argument will be used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of clamping property values to the valid range in each property
implementation, handle it in the property layer. The functionality to
handle clamping for each type is in m_option.c.
It's not really clear whether this is really needed. Normally, the raw
values for M_PROPERTY_SET come only from m_option_type.parse (setting
properties as string) or from m_option_parse.add (using the "switch"
input command). However, since this was already done before, and since
we _really_ want to be sure only to write valid values, add this code
anyway. The newly added warnings/error messages should never actually
be printed during normal operation and are for debugging (if they
happen, we definitely want to see them).
|
|
|
|
|
|
|
|
| |
The m_option_value union is supposed to contain a field for each
possible option type (as long as it actually stores data). This helps
avoiding silly temporary memory alocations. Using a pointer to an union
and to a field of the union interchangeably should be allowed by
standard C.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the m_option code by default to format property values, instead of
having separate code in m_property.
To facilitate that, add a pretty_print callback to option types. These
format values in a more human readable and user friendly way, as opposed
to the print callback, which produces parseable values.
This also changes the strings used with flags. Instead of "enabled" and
"disabled", flags are formatted as "yes" and "no". (We could use the
pretty_print callback to deal with this, but we don't for consistency.)
|
|
|
|
|
|
| |
Most property implementations checked whether the "arg" parameter was
NULL. This is entirely pointless, because NULL is actually never pased.
It was inconsistently done, too. Remove the checks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of forcing each property implementation implement its own logic
for M_PROPERTY_STEP_UP/M_PROPERTY_STEP_DOWN, handle it in the generic
property code.
Rename the M_PROPERTY_STEP_UP command to M_PROPERTY_SWITCH (the other
property command, M_PROPERTY_STEP_DOWN, isn't needed anymore: stepping
downwards is done by passing a negative argument). Always use double as
argument type; it makes the code easier, and covers all property types.
Move the code which does the actual type-specific value stepping to
m_option.c (the idea is that m_option handles types).
Some properties still have custom handlers implemented with
M_PROPERTY_SWITCH. They can't be mapped to the generic mechanism,
because their value range is dynamic or entirely unknown.
For some properties, the default step stride is changed to 1. This is no
issue, because the default bindings in input.conf all use an explicit
stride in the affected cases.
|
|
|
|
|
|
|
|
|
| |
Rename both the option and property to "osd-level", which fits a bit
better with the general naming scheme. Make it a choice instead of an
integer range. I failed to come up with good names for the various
levels, so leave them as-is.
Remove the useless property handler for the "loop" property too.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extend m_properties_expand_string() so that it can print properties as
unformatted string. Normally, properties will be pretty-printed
(intended for OSD and user interface purposes). Add the '=' modifier to
the format string syntax that disables pretty-printing and returns them
"raw".
For example, "${=switch_audio}" will print the track number, instead of
returning an OSD friendly string containing additional information like
track title and language.
|
|
|
|
|
| |
This was an on-going transition to make mplayer format all times in the
same format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Options parsing used to be ambiguous, as in the splitting into option
and values pairs was ambiguous. Example:
-option -something
It wasn't clear whether -option actually takes an argument or not. The
string "-something" could either be a separate option, or an argument
to "-option". The code had to call the option specific parser function
to resolve this.
This made everything complicated and didn't even have a real use. There
was only one case where this was actually used: string lists
(m_option_type_string_list) and options based on it. That is because
this option type actually turns a single option into a proxy for several
real arguments, e.g. "vf*" can handle "-vf-add" and "-vf-clr". Options
suffixed with "-clr" are the only options of this group which take no
arguments.
This is ambiguous only with the "old syntax" (as shown above). The "new"
option syntax always puts option name and value into same argument.
(E.g. "--option=--something" or "--option" "--something".)
Simplify the code by making it statically known whether an option takes
a parameter or not with the flag M_OPT_TYPE_OLD_SYNTAX_NO_PARAM. If it's
set, the option parser assumes the option takes no argument.
The only real ambiguity left, string list options that end on "-clr",
are special cased in the parser.
Remove some duplication of the logic in the command line parser by
moving all argument splitting logic into split_opt(). (It's arguable
whether that can be considered code duplication, but now the code is a
bit simpler anyway. This might be subjective.)
Remove the "ambiguous" parameter from all option parsing related code.
Make m_config unaware of the pre-parsing concept.
Make most CONF_NOCFG options also CONF_GLOBAL (except those explicitly
usable as per-file options.)
|
|
|
|
|
| |
Replace all uses of bstr() with bstr0().
Also remove the ridiculous C++ workaround.
|
|
|
|
|
|
|
| |
Time property values converted to strings via M_PROPERTY_PRINT resulted in
a string different to what the OSD displays (if the OSD level is >= 2).
Change it to match the OSD.
|
|
|
|
|
| |
When handling escapes of the form '\xNN', m_properties_expand_string()
incorrectly copied the last N to the output. Fix.
|
|
|
|
|
|
| |
Using bstr allows simpler parsing code, especially because it avoids
the need to modify or copy strings just to terminate extracted
substrings.
|
|
|
|
|
|
|
|
| |
Command line options like "-foo xyz" are ambiguous: "xyz" may be a
parameter to the option "foo" or an unrelated argument. Instead of
relying on the struct m_config mode field (commandline/file) pass
parameters to specify ambiguous mode explicitly. Meant for "--foo"
options which are never ambiguous on command line either.
|
| |
|
| |
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32751 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
| |
Remove the help/ subdirectory, configure code to create toplevel
help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
|
|\ |
|
| |
| |
| |
| | |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
|
| |
| |
| |
| | |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For some reason commit e306174952d42e1cd6cc5efc50ae6bb0410501bc, which
replaced translation macro names with the corresponding English
strings, also collapsed multiple consecutive space characters into
one. Change most of these back. In a couple of cases the amount of
whitespace is important for alignment, and for the rest it at least
keeps the strings closer to the existing translations.
|
| |
| |
| |
| |
| |
| | |
Add various fixes needed to actually produce translated OSD output.
About every OSD string that had a translation macro under the old
system should be translatable now.
|
| | |
|
| |
| |
| |
| |
| | |
Replace all MSGTR_ macros in the source by the corresponding English
string.
|
|/
|
|
|
| |
Replace mp_msg() calls which have a translated string as the format
argument with mp_tmsg and add _() around all other translated strings.
|
|
|
|
|
|
| |
read-only flag.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27679 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25744 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25529 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25488 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23434 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
| |
properties.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23413 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23412 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
| |
metadata/title, etc.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23411 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
|
|
| |
Move some global and static variables under a struct that can be given
as a parameter. Add a context argument to the property functions so that
they do not have to depend on global/static variables.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22298 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18259 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17928 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17915 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
Move the volume and mute command to the command to property
bridge.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17912 b3059339-0415-0410-9bf9-f77b7e298cf2
|