summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* input: fix mp_cmd memory leakwm42012-10-141-0/+3
| | | | | mp_input_feed_key() didn't free the command, if it was discarded due to the queue exceeding its maximum size.
* input: minor simplification to mp_input_get_cmd()wm42012-10-141-13/+8
|
* command: reduce some property boilerplatewm42012-10-143-46/+35
| | | | | | | | | | 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.
* input: add input test modewm42012-10-145-14/+90
| | | | | | | | | | | In input test mode, key bindings won't be executed, but are shown on the OSD. The OSD includes various information, such as the name of the key, the command itself, whether it's builtin, and the config file location it was defined. The input test mode can be enabled with "--input=test". No effort is spent trying to react to key bindings that normally exit the player; they are treated just like any other binding.
* input: track location info for input commandswm42012-10-143-24/+43
| | | | | | If parsing a command fails, its location is printed. The location is the path to the input.conf, and the line number of the key binding and the associated input command.
* osd_libass: fix \n escapeswm42012-10-141-8/+3
| | | | | | | | | Apparently libass can't be made to not interpret "\n" as escape. That means "\n" can't be printed literally. Use the same hack that was added to mplayer2 when that project merged osd_libass.c: add an invisible zero-width joiner character between "\" and "n". It seems U+FEFF is deprecated, because it has been redefined as BOM mark. Use U+2060, which seems to be the replacement.
* stream: remove NULL checks for open callswm42012-10-141-13/+3
| | | | | | | open_stream() and open_output_stream() checked for filename==NULL, and if true, printed an error message asking to report this as bug. Internal logic errors should just crash. Use assert() instead.
* core: show quvi page title in window title, clean up libquvi handlingwm42012-10-149-77/+115
| | | | | | | | | | | | | | | | | 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.
* input: don't warn on commands for disabled optional featureswm42012-10-141-6/+5
| | | | | | | | | Always recognize input commands for optional features (like TV commands etc.). If these features are disabled, the commands are parsed, but simply do nothing. This fixes annoying warnings on start with the default/builtin input.conf, if certain optional features are not compiled.
* vo_opengl: fix filter reinitializationwm42012-10-141-4/+4
| | | | | | | The second scaling filter (cscale) was never reset correctly due to a fatal oversight. In particular, this could lead to OpenGL errors, if the new filter needs a 2D texture, but the old texture was 1D (because init_scaler reuses the texture).
* ad_ffmpeg: add support for planar sample formatsStefano Pigozzi2012-10-141-7/+36
| | | | | | | | | | FFmpeg and Libav are starting to return a growing number of planar samples when decoding formats that save data like that. In this first implementation planar formats are immediately converted to packed formats. Fututre developments should move to use libavresample. Original work by Nicolas George on mplayer(1).
* fmt-conversion.h: fix pixfmt.h #include; fixes latest LibavUoti Urpala2012-10-141-2/+1
| | | | | | | | | | | | | | | | | | | Change fmt-conversion.h to include <libavutil/pixfmt.h> instead of <libavutil/avutil.h> which no longer indirectly includes the former. This fixes compilation with latest Libav. Also remove superfluous config.h #include. The pixfmt.h #include is needed for 'enum PixelFormat'. avutil.h already stopped including pixfmt.h more than a year ago, but that did not cause visible breakage at the time. AFAIK the C standard does not allow incomplete enum types, but it seems that GCC and other relevant compilers accept function declarations using not-yet-defined enum types without warnings. However, Libav now renamed 'enum PixelFormat' to 'enum AVPixelFormat', adding a '#define PixelFormat AVPixelFormat' for backwards compatibility. We need this compatibility define because we're still using the PixelFormat name, but it of course does not work if pixfmt.h is not included; thus the missing include now caused a compilation failure.
* Merge branch 'input_changes' into masterwm42012-10-1233-2405/+2196
|\ | | | | | | | | | | | | | | Conflicts: DOCS/man/en/vo.rst etc/input.conf input/input.c m_property.c
| * commands: use "up" and "down" as 2nd argument for cycle commandwm42012-10-123-5/+32
| | | | | | | | | | | | | | | | | | | | | | Allow the values "up" and "down" as step argument for the cycle input command. Previously, this argument was a float, which specified an arbitrary step value and direction (similar to the add command). Instead of "1" and "-1", "up" and "down" is to be used. Float values are still accepted. That capability might be removed in the future, as there's probably hardly any actual use for arbitrary step values.
| * commands: add print_text input command to print text on the terminalwm42012-10-124-0/+15
| | | | | | | | | | 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-129-14/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * sub: enable sub-pos with libasswm42012-10-122-1/+6
| | | | | | | | | | | | | | | | | | | | The --sub-pos option and sub-pos property control the vertical position of a subtitle. Also change how sub-pos is handled in the old subtitle renderer (used with -no-ass). The new behavior doesn't render subtitles out of the screen if the subtitle is located near the top screen border and has too many lines.
| * options: add --status-msgwm42012-10-124-22/+41
| | | | | | | | | | | | | | Replaces the status line with a custom string. This is probably useful for hacking old slave mode applications into working again. Even if not, this might be generally useful.
| * manpage: document input.conf related thingswm42012-10-124-17/+367
| | | | | | | | | | | | This directly corresponds to DOCS/OUTDATED-tech/slave.txt. Changes from the recent commits are included too.
| * commands: move legacy property wrapper to m_property.cwm42012-10-122-40/+48
| |
| * commands: sub_step takes only one argumentwm42012-10-121-1/+1
| |
| * TOOLS/mplayer2_identify.sh: program property is not readablewm42012-10-121-1/+0
| | | | | | | | | | | | And it never was. This property is write-only and exists only for setting the program. Making it readable is possible, but would require demuxer changes.
| * commands: disable deprecation warningswm42012-10-122-2/+2
| | | | | | | | | | | | | | 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: rename show_tracks/chapters_osd commandwm42012-10-121-2/+4
| |
| * 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-123-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: make exact seeking default bindings not use OSDwm42012-10-121-4/+5
| | | | | | | | | | | | | | The OSD bar is very annoying when seeking. Especially when the seeks are very small, the OSD doesn't show any interesting information. The exact seeking commands are a use case where the user definitely never wants to see a seek bar.
| * commands: more user-control whether a command shows OSD bars/messageswm42012-10-126-110/+176
| | | | | | | | | | | | | | | | | | | | 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: add choice type to input commandswm42012-10-123-59/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow using the choice type (as it used for command line) for arguments of input commands. Change the magic integer arguments of some commands (like seek) to use choices instead. The old numeric values are still allowed (but only those which made sense before, not arbitrary integers). In order to do this, remove the input.c specific types (like MP_CMD_ARG_INT) completely and specify commands using the m_option types. Also, add the special choice "-" to some arguments. It's supposed to signify the default value, so arguments can be easily skipped. Maybe the choice option should recognize this and not change the previous value, but we'll leave this for later. For now, leave compatibility integer values for all new choice arguments, e.g. "0" maps to 0. We could let the choice option type do this automatically, but we don't, because we want user input values and internal mplayer values decoupled in general. The compatibility options will be removed one day, too. Also, remove optional args for strings - would require either annoying additional code, or copying strings twice. It's not used, so remove it.
| * m_option.h: separate creating choices array into M_CHOICES macrowm42012-10-121-2/+3
| | | | | | | | Reduces code duplication, increases reusability.
| * talloc: fix strndup group of functionswm42012-10-121-2/+2
| | | | | | | | This bug has been fixed years ago in upstream talloc.
| * commands: change property expansion format stringwm42012-10-126-94/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Fix MP_TARRAY_GROW macrowm42012-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | This macro is supposed to make sure an array has enough memory allocated for a given number of elements. Unfortunately, a condition was inverted (I... what???). It only allocated if there was still enough memory left, or only one additional element had to be allocated. Since this macro was only used by MP_TARRAY_APPEND, this case was never actually triggered. It's still utter non-sense.
| * input: warn about non-existing commands, add explicit "ignore" commandwm42012-10-122-25/+27
| | | | | | | | | | | | | | | | | | | | | | If a command is not found, warn about it at loading time (just like other command parsing errors are printed at loading time). Add an explicit "ignore" command. input.conf instructs users to use this command to cancel out existing mapping. This clashed with the warning added in this commit. Make "ignore" a real command and remove the specialcasing for it from get_cmd_from_keys(). Now "ignore" is ignored because it's not handled in command.c.
| * input: handle escapes always in command parserwm42012-10-124-159/+163
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * commands: cosmetics: rename thingswm42012-10-123-13/+13
| | | | | | | | | | | | | | | | | | 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.
| * input: verify input.conf on loadingwm42012-10-123-9/+13
| | | | | | | | | | | | | | | | | | When input.conf is loaded, verify each command and print a warning if it's invalid or uses legacy commands. This is done for both the user's and the embedded config files. The diff is a bit noisy, because mp_input_parse_cmd() is changed to take a bstr as argument instead of a char*.
| * commands: replace "switch" with "add" and "cycle"wm42012-10-126-128/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-123-15/+19
| | | | | | | | | | | | | | | | 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-123-24/+32
| | | | | | | | | | | | 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-123-35/+35
| | | | | | | | | | 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-122-37/+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-125-136/+94
| | | | | | | | | | | | | | | | | | 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: remove fallback for M_PROPERTY_PARSE and M_PROPERTY_TO_STRINGwm42012-10-121-38/+26
| | | | | | | | | | | | | | | | 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.
| * commands: add more property-option bridge uses, rename some optionswm42012-10-128-364/+242
| | | | | | | | | | | | | | | | | |