summaryrefslogtreecommitdiffstats
path: root/command.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: untypedef af_instanceStefano Pigozzi2012-11-021-2/+2
|
* Merge branch 'osd_changes' into masterwm42012-11-011-1/+2
|\ | | | | | | | | Conflicts: DOCS/man/en/options.rst
| * Merge branch 'master' into osd_changeswm42012-10-161-1184/+584
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile command.c libvo/gl_common.c libvo/vo_corevideo.m libvo/vo_opengl.c libvo/vo_opengl_old.c libvo/vo_opengl_shaders.glsl sub/ass_mp.c sub/osd_libass.c sub/sd_ass.c
| * | sub, VO: remove vo_osd_resized() functionwm42012-10-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VOs which could render the OSD in window size (as opposed to video size, like vo_xv) and which could cache the OSD called this when the window size changed. This was needed, because VOs used another OSD function to check whether the OSD changed before passing the new window size to the OSD code. This was really just an artifact of OSD change detection, and now that the affected VOs use the new OSD rendering API, it's done automatically.
* | | commands: fix audio-delay propertywm42012-10-301-3/+5
| | | | | | | | | | | | | | | | | | | | | SET simply didn't set the variable correctly. Chain the property as generic option, so the property code will return the correct type for the property, as well as implement the GET part.
* | | commands: make media-title property return filename in default casewm42012-10-301-14/+15
| | | | | | | | | | | | Instead of the full path.
* | | command: make property "deinterlace" unavailable if deinterlacer absentwm42012-10-301-3/+5
| |/ |/| | | | | | | | | | | | | | | The "deinterlace" property was stuck at "no" if there wasn't actually any switchable deinterlacer (like yadif or vdpau) in the video chain. Also, take care of returning only 0/1 values. It appears yadif and vdpau return their current deinterlacer mode, which is not always the value 0 or 1.
* | command: reduce some property boilerplatewm42012-10-141-46/+10
| | | | | | | | | | | | | | | | | | | | Reduces code needed for implementing string and int64_t read-only properties. Originally, there actually was a m_property_string_ro(), but it was removed, as that would have implicitly strdup'ed the string. But the new name m_property_strdup_ro() should make it quite clear what is happening.
* | core: show quvi page title in window title, clean up libquvi handlingwm42012-10-141-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up handling of libquvi (which resolves URLs of streaming sites into URLs to the actual media playable by mpv). Move the code out of open.c to quvi.c, and invoke it explicitly from mplayer.c, instead of trying to resolve every filename passed to open_stream(). This allows easily passing metadata from the quvi context to the frontend. Expose QUVIPROP_PAGETITLE as "media-title" property, and use that instead of "filename" for the mplayer window title. (For YouTube, this is the video title.) It's cleaner too. Handle a potential reliability issue: check quvi_getprop return values. Since open.c contains barely anything but the open_stream() stub, move that to stream.c and delete open.c.
* | commands: add print_text input command to print text on the terminalwm42012-10-121-0/+9
| | | | | | | | | | In theory, this could take over the role of the get_property slave command, and is more general.
* | sub: add --ass-style-override option to disable style overrideswm42012-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a number of options which modify ASS subtitle rendering. Most of these do things that can interfere with the styling done by subtitle scripts, resulting in incorrect rendering. Add the --ass-style-override option to make it easy to disable all overrides. This helps trouble- shooting, and makes it more practical to use the override features. (You can simply toggle the ass-style-override property at runtime, should one of the style override options break subtitle rendering at a certain point.) This mainly affects whether most --ass-* options are applied, as well as --sub-pos. Some things, like explicit style overrides loaded with --ass-force-style, can't be changed at runtime using the ass-style-override property.
* | commands: move legacy property wrapper to m_property.cwm42012-10-121-39/+0
| |
* | commands: disable deprecation warningswm42012-10-121-1/+1
| | | | | | | | | | | | | | This disables warning messages when the legacy input command bridge is used. For now, user input.confs should just keep working as if nothing has changed. The deprecation warnings will be enabled again at a later point, and the legacy bridge will be eventually removed.
* | commands: attempt to fix "program" propertywm42012-10-121-2/+16
| | | | | | | | | | | | | | | | The user-visible track IDs are normalized and don't match with whatever the demuxer uses. Completely untested. It might actually work with both demux_lavf and demux_ts.
* | commands: don't use dummy option declaration for propertieswm42012-10-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | commands: more user-control whether a command shows OSD bars/messageswm42012-10-121-93/+124
| | | | | | | | | | | | | | | | | | | | The "no-osd" prefix was introduced earlier to disable OSD selectively based on the key binding. Extend this, and allow the user to force display of an OSD bar ("osd-bar"), OSD message ("osd-msg") or both ("osd-msg-bar"). This changes mainly how property setting functions behave. The default behavior is still the same.
* | commands: change property expansion format stringwm42012-10-121-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | commands: cosmetics: rename thingswm42012-10-121-2/+2
| | | | | | | | | | | | | | | | | | 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.
* | commands: replace "switch" with "add" and "cycle"wm42012-10-121-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | commands: make "aspect" property writeable, replaces "switch_ratio"wm42012-10-121-12/+15
| | | | | | | | | | | | | | | | Move the code for "switch_ratio" to the M_PROPERTY_SET case of the "aspect" property. The rules are exactly the same, e.g. setting a ratio smaller than 0.1 sets the pixel aspect ratio to 1:1. For now, we define that writing "0" sets the PAR to 1:1, and disallow -1 (possibly reserve it to reset to default aspect ratio).
* | commands: remove M_PROPERTY_SWITCH from edition propertywm42012-10-121-24/+27
| | | | | | | | | | | | 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.
* | commands: make M_PROPERTY_GET_TYPE return an option copywm42012-10-121-14/+14
| | | | | | | | | | 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.
* | commands: cosmetics: reindent colormatrix propertywm42012-10-121-26/+26
| |
* | commands: don't replicate mapping to option in levels_property_helperwm42012-10-121-31/+33
| | | | | | | | | | | | | | | | This should be done by mp_property_generic_option() only. Also reindent levels_property_helper() to make it a little bit more readable. Remove the m_option_get_ptr() function, which doesn't really make sense anymore.
* | commands: cosmetic changes mostly to m_property.hwm42012-10-121-9/+8
| | | | | | | | | | | | | | | | | | 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.
* | commands: add more property-option bridge uses, rename some optionswm42012-10-121-257/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | commands: minor improvement to error messagewm42012-10-121-8/+2
| | | | | | | | Also remove two slave mode messages.
* | commands: handle property clamping in m_optionwm42012-10-121-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | commands: generally handle property formatting with m_optionwm42012-10-121-9/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* | commands: remove pointless NULL checkswm42012-10-121-91/+2
| | | | | | | | | | | | 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.
* | commands: handle property stepping in a generic waywm42012-10-121-252/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | options: remove CONF_TYPE_POSITIONwm42012-10-121-12/+12
| | | | | | | | | | | | | | | | | | This was the option parser for the off_t C type. These days, off_t is always int64_t, so replace all its uses by int64_t and CONF_TYPE_INT64. Fix the --sstep option. It used CONF_TYPE_INT with an off_t variable, which will result in invalid memory accesses. Make it use type double instead, which seems to make more sense for this option.
* | commands: rename "osdlevel" option and property, make it a choicewm42012-10-121-17/+4
| | | | | | | | | | | | | | | | | | 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.
* | commands: replace --hardframedrop, change framedropping propertywm42012-10-121-18/+6
| | | | | | | | | | | | | | | | | | | | Replace --hardframedrop with --framedrop=hard. Rename the framedrop property from "framedropping" to "framedrop" for the sake of making command line options have the same name as their corresponding property. Change the property to accept choice values instead of numeric values. Remove unused/forgotten auto_quality variable.
* | commands: remove third parameter for "switch"wm42012-10-121-4/+1
| | | | | | | | | | This could change the direction (i.e. invoke STEP_PROPERTY_DOWN), but you can just pass a negative value as second argument instead.
* | commands: rename osd_show_[property_]text and osd_show_progressionwm42012-10-121-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | osd_show_[property_]text => show_text osd_show_progression => show_progress show_text, osd_show_property_text and osd_show_text both map to the code for the previous osd_show_property_text. The only special thing about osd_show_text is that you don't need to escape "$". Also, unfortunately osd_show_property_text requires escaping things twice, one time for the command parser, and the other time for the property formatting code, while osd_show_text needed only one level of escaping.
* | commands: remove speed_set/speed_incr commandswm42012-10-121-15/+2
| | | | | | | | Redundant with set/switch commands.
* | commands: rename properties, update input.confwm42012-10-121-51/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "-" instead of "_" in property names. The intent is that property names and options names should be the same (if they refer to the same thing), and options use "-" as word separator. Rename some other properties too, e.g. "switch_audio" -> "audio". Add a way to translate the old property names to the new ones, similar to the input command legacy bridge. Update input.conf. Use the new property names, and don't use legacy commands.
* | commands: change input commands to make OSD usage explicitwm42012-10-121-36/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most input commands had their own policy whether to display an OSD message for user feedback or not. Some commands had two variants, one that showed an OSD message and one that didn't (e.g. step_property_osd and step_property). Change it such that all commands show a message on the OSD. Add a "no-osd" modifier that disables OSD for that command. Rename the "step_property" and "step_property_osd" command to "switch", and rename "set_property" and "set_property_osd" to "set". Note that commands which haven't used OSD before still don't use OSD. That will possibly be fixed later. (E.g. "screenshot" could display an OSD message instead of just printing a message on the terminal.) The chapter and edition properties still pr