summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* command: fix condition for failure when parsing cycle-value paramswm42018-05-031-1/+1
| | | | | | Could make it behave differently (and leak memory) in certain cases. Basically, m_option_parse() randomly returns 0 or 1, but most time 1, with the difference due to legacy reasons that don't matter anymore.
* command: simplify option property initwm42018-05-031-22/+13
| | | | | | | The "if (prop.name)" check is redundant, because an assert above it implies that it never can be NULL. Deduplicate some code for initializing the "prop" variable.
* command: split big command handler switch into separate functionswm42018-05-031-775/+995
| | | | | | | | | | | | | | | | | | | This gets rid of run_command() and its big switch statement, which was an idiotically big function of almost 1000 lines. The switch is replaced with a callback per command, and each command is now implemented in its own function. Command IDs are not needed anymore, so the mp_command_type enum disappears. There should be no functional changes, but since this refactors 64 commands, regressions are possible. The handler() parameter is void*, because in theory the input code is supposed to be independent of the player core code. For example, you should be able to reuse the command parser code for some other part of mpv. In practice, the variable containing command list is defined in the player core anyway, so you could say this doesn't work. But I'm still trying to hold onto this idea, so I went with void*.
* input: remove some explicit uses of command IDswm42018-05-031-11/+17
| | | | | | | | | | The plan is to remove the command ID enum. This will happen by replacing the big switch statement in command.c with dispatching to per-command callbacks. As preparation, remove uses of the command IDs outside of the actual dispatching mechanism. Also remove some instances of checking cmd->def for NULL. We now require this always to be set.
* input: move command list to command.cwm42018-05-031-0/+216
| | | | Preparation for more changes.
* command: change cycle-value command behaviorwm42018-04-291-73/+88
| | | | | | | | | | | | | | | | | | | | Instead of using an internal counter to keep track of the value that was set last, attempt to find the current value of the property/option in the value list, and then set the next value in the list. There are some potential problems. If a property refuses to accept a specific value, the cycle-values command will fail, and start from the same position again. It can't know that it's supposed to skip the next value. The same can happen to properties which behave "strangely", such as the "aspect" property, which will return the current aspect if you write "-1" to it. As a consequence, cycle-values can appear to get "stuck". I still think the new behavior is what users expect more, and which is generally more useful. We won't restore the ability to get the old behavior, unless we decide to revert this commit entirely. Fixes #5772, and hopefully other complaints.
* command: make track properties cycle through no/auto if uninitializedwm42018-04-291-9/+18
| | | | | | | | | | | | | If playback has not been initialized yet (decoders not initialized etc.), or if in idle mode, let the track properties cycle through "no" and "auto". This should be slightly more helpful than making it simply exit. Depending on the stage of loading, more could be done. For example, if youtube-dl loads additional subtitle files, it can happen that these get added before the main file, and this could be cycled through to an extent. This is probably too clever, and also sort of dangerous (unintended interactions with messy in-loading state), so don't do it.
* command: fix coding stylewm42018-04-291-5/+6
| | | | Add {...}, change if(!a) to if(a) and swap its if/else body.
* video: remove internal stereo_out flagwm42018-04-291-3/+1
| | | | | | Also rename stereo3d to stereo_in. The only real change is that the vo_gpu OSD code now uses the actual stereo 3D mode, instead of the --video-steroe-mode value. (Why does this vo_gpu code even exist?)
* demux, player: mark dependent tracksAman Gupta2018-04-171-0/+1
| | | | | | | ffmpeg marks audio tracks which are not meant to be played standalone as DEPENDENT. these are typically used in DVB broadcasts for audio descriptions, and are meant to be mixed into the main audio track during playback.
* player: fix hook processing consistency and code duplication issueswm42018-03-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | There was a "generic" function to run a hook and to wait for its completion, yet there were two duplicated functions doing the same anyway. Replace them with a single function. They differed in how stop_play was handled, but it was broken anyway. stop_play is set when playback is stopped due to quitting or changing the playlist entry - but we still can't stop hook processing, because that would mean asynchronously doing something else while the user hook code is still busy and might still have the expectation that running the hook stops everything else. So not waiting until the hook ends properly is against the whole hook idea. That this was done inconsistently is even worse. (Though it could be argued that when quitting the player, everything should just be stopped violently. But I still think that's up to the hook handler.) process_hooks() does not return anything, since hook processing doesn't really have a result (it's all about blocking and letting some other code synchronously do something). Just let the caller check whether loading was aborted in the meantime. Also change the potentially misleading name of mp_hook_run().
* client API: add a first class hook API, and deprecate old APIwm42018-03-261-48/+91
| | | | | | | | | | | | | | | As it turns out, there are multiple libmpv users who saw a need to use the hook API. The API is kind of shitty and was never meant to be actually public (it was mostly a hack for the ytdl script). Introduce a proper API and deprecate the old one. The old one will probably continue to work for a few releases, but will be removed eventually. There are some slight changes to the old API, but if a user followed the manual properly, it won't break. Mostly untested. Appears to work with ytdl_hook.
* command: remove an old compatibility hackwm42018-03-261-48/+1
| | | | | Was removed 3 releases ago and was spamming warning messages that it'll be dropped, so it's fine to remove it now.
* command: remove duplication of property set error message handlingwm42018-03-261-59/+36
| | | | | | | | Move all of this stuff to a common function. This makes the error messages less specific, but I don't think anyone will miss it. The OSD flag handling is annoying, but it's nothing that should be changed with this commit.
* command: move property multiply code to m_property.cwm42018-03-261-26/+3
| | | | | | | I think this will help with reducing code duplication (see following commit). The error messages loses the multiplication factor, but the error message will be replaced by a generic one in the following commit anyway.
* command: use mpv_node helpers instead of duplicated codewm42018-03-261-26/+8
| | | | | | They didn't exist yet when this code was added. Completely untested.
* vo: pass through framedrop flag differentlywm42018-03-151-11/+0
| | | | | | | | There is some sort-of awkwardness here, because option access needs to happen in a synchronized manner, and the framedrop flag is not in the VO option struct. Remove the mp_read_option_raw() call and the awkward change notification via VO_EVENT_WIN_STATE from command.c, and pass it through as new vo_frame flag.
* vo: move display-fps internal option value to VO optswm42018-03-151-11/+4
| | | | | | Removes the awkward notification through VO_EVENT_WIN_STATE. Unfortunately, some awkwardness remains in mp_property_display_fps(), because the property has conflicting semantics with the option.
* command: fix whitespacewm42018-03-031-1/+1
|
* command: simplify mp_property_filter_metadatawm42018-02-161-19/+11
| | | | Also silence a dead code coverity error.
* input: add a keybinding to toggle hardware decodingwm42018-02-131-0/+1
| | | | | We sure as hell won't enable hardware decoding by default, but we can make it more accessible with a key binding.
* player: correctly set track information on adding external filesZehua Chen2018-02-101-18/+24
| | | | | | | | Before this commit, auto_loaded and lang were only set for the first track in auto-loaded external files. Likewise, for the title and lang arguments to the sub-add and audio-add commands. Fixes #5432
* video: fix passing down FPS to vf_vapoursynthwm42018-02-031-2/+2
| | | | | | | To make this less of a mess, remove one of the redundant container_fps fields. Part of #5470.
* codecs: remove unused family fieldwm42018-02-011-1/+0
| | | | | | | | | | MPlayer used this to distinguish multiple decoder wrappers (such as libavcodec vs. binary codec loader vs. builtin decoders). It lost meaning in mpv as non-libavcodec things were dropped. Now it doesn't serve any purpose anymore. Parsing was removed quite a while ago, and the recent filter change removed any use of the internal family field. Get rid of it.
* audio: move to decoder wrapperwm42018-01-301-4/+1
| | | | | | | | | | | | | | | | Use the decoder wrapper that was introduced for video. This removes all code duplication the old audio decoder wrapper had with the video code. (The audio wrapper was copy pasted from the video one over a decade ago, and has been kept in sync ever since by the power of copy&paste. Since the original copy&paste was possibly done by someone who did not answer to the LGPL relicensing, this should also remove all doubts about whether any of this code is left, since we now completely remove any code that could possibly have been based on it.) There is some complication with spdif handling, and a minor behavior change (it will restrict the list of codecs to spdif if spdif is to be used), but there should not be any difference in practice.
* video: make decoder wrapper a filterwm42018-01-301-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Move dec_video.c to filters/f_decoder_wrapper.c. It essentially becomes a source filter. vd.h mostly disappears, because mp_filter takes care of the dataflow, but its remains are in struct mp_decoder_fns. One goal is to simplify dataflow by letting the filter framework handle it (or more accurately, using its conventions). One result is that the decode calls disappear from video.c, because we simply connect the decoder wrapper and the filter chain with mp_pin_connect(). Another goal is to eventually remove the code duplication between the audio and video paths for this. This commit prepares for this by trying to make f_decoder_wrapper.c extensible, so it can be used for audio as well later. Decoder framedropping changes a bit. It doesn't seem to be worse than before, and it's an obscure feature, so I'm content with its new state. Some special code that was apparently meant to avoid dropping too many frames in a row is removed, though. I'm not sure how the source code tree should be organized. For one, video/decode/vd_lavc.c is the only file in its directory, which is a bit annoying.
* audio: rewrite filtering glue codewm42018-01-301-44/+31
| | | | Use the new filtering code for audio too.
* video: rewrite filtering glue codewm42018-01-301-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get rid of the old vf.c code. Replace it with a generic filtering framework, which can potentially handle more than just --vf. At least reimplementing --af with this code is planned. This changes some --vf semantics (including runtime behavior and the "vf" command). The most important ones are listed in interface-changes. vf_convert.c is renamed to f_swscale.c. It is now an internal filter that can not be inserted by the user manually. f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is conceptually easy, but a big mess due to the data flow changes). The existing filters are all changed heavily. The data flow of the new filter framework is different. Especially EOF handling changes - EOF is now a "frame" rather than a state, and must be passed through exactly once. Another major thing is that all filters must support dynamic format changes. The filter reconfig() function goes away. (This sounds complex, but since all filters need to handle EOF draining anyway, they can use the same code, and it removes the mess with reconfig() having to predict the output format, which completely breaks with libavfilter anyway.) In addition, there is no automatic format negotiation or conversion. libavfilter's primitive and insufficient API simply doesn't allow us to do this in a reasonable way. Instead, filters can use f_autoconvert as sub-filter, and tell it which formats they support. This filter will in turn add actual conversion filters, such as f_swscale, to perform necessary format changes. vf_vapoursynth.c uses the same basic principle of operation as before, but with worryingly different details in data flow. Still appears to work. The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are heavily changed. Fortunately, they all used refqueue.c, which is for sharing the data flow logic (especially for managing future/past surfaces and such). It turns out it can be used to factor out most of the data flow. Some of these filters accepted software input. Instead of having ad-hoc upload code in each filter, surface upload is now delegated to f_autoconvert, which can use f_hwupload to perform this. Exporting VO capabilities is still a big mess (mp_stream_info stuff). The D3D11 code drops the redundant image formats, and all code uses the hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a big mess for now. f_async_queue is unused.
* command: add --osd-on-seek option defaulting to barKevin Mitchell2018-01-261-6/+9
| | | | | | | | | | | | | Restores behaviour prior to aef2ed5dc13e37dec0670c451b4369b151d5c65f. That change was apparently unpopular. However, given the amount of complaining over how hard it is to change the defaults by rebinding every key, I think the extra option introduced by this commit is justified. Technically not all behaviour is restored, because now --no-osd-bar will not instead display the msg text on seek. I think that feature was a little weird and is now easy enough to remedy with the --osd-on-seek option.
* Revert "command: make pause display the same osd-msg-bar as seek"Kevin Mitchell2018-01-261-3/+1
| | | | | | | | | | | | | | This reverts commit 9812e276aa1bb0bddeb73677aa9e9f87e73cd930. This was apparently unpopular. I still think the pause OSD should be the same as seek even if it's not visible by default, but it seems that whether to display a given property change is currently conflated with what to display. The reverted behaviour can be restored by adding something like the following to input.conf: SPACE cycle pause; show_progress
* command: make change-list show changed option on OSDwm42018-01-251-0/+1
|
* command: add a change-list commandwm42018-01-251-0/+31
| | | | | | | | | | | | | Requested. See manpage additions. The main reason why this goes through the trouble to keep the action/operation parameter separate is so that we don't expose some option parser implementation details to the command (although that is a relatively weak reason), and also to make it more different from the "set" command, which can't support this type of option as it goes through the property layer. Fixes #5435.
* options: add an option type for byte sizeswm42018-01-251-18/+0
| | | | | | And use it for 2 demuxer options. It could be used for more options later. (Though the --cache options can not use this, because they use KB as base unit.)
* command: make sure to redraw on overlay commandswm42018-01-251-0/+1
| | | | | | | | | | When overlay-add etc. is run, make sure the playlop is rerun so that it considers actually redrawing the screen. (I considered making the OSD code generally wakeup the player, but that will probably lead to redundant wakeups, so I didn't bother.) Fixes #5431.
* input: make command argument list a dynamic arraywm42018-01-101-3/+8
| | | | | | | | Replace the static array with dynamic memory allocation. This also requires some code to honor mp_cmd.nargs more strictly. Generally allocates more stuff. Fixes #5375 (although we could also just raise the static limit).
* command: make pause display the same osd-msg-bar as seekKevin Mitchell2018-01-071-1/+3
| | | | | | Previously, toggling pause would generate no osd response, and changing that wasn't even configurable. This was surprising to users who generally expect to see *where* pause / unpause is taking place (#3028).
* command: default to osd-msg-bar for seeksKevin Mitchell2018-01-071-4/+3
| | | | | | | | The previous default was osd-bar (unless the user specified --no-osd-bar, in which case case it was osd-msg). Aside from requiring some twisted logic to implement, this surprised users since osd-msg3 wasn't displayed when seeking with the keyboard (#3028), so the time seeked to was never displayed.
* command: remove unnecessary whitespaceKevin Mitchell2018-01-071-67/+69
|
* demux: export some debugging fields about low level demuxer behaviorwm42018-01-051-0/+5
| | | | | | | | | | Export them as explicitly undocumented debugging fields for the "demuxer-cache-state" property. Should be somewhat helpful to debug "wtf is the demuxer" doing situations better, especially when seeking. It also becomes visible how long the demuxer is blocked on an "old" seek when you keep seeking while the first seek hasn't finished.
* player: remove internal `vo-resize` command againsfan52018-01-021-7/+0
| | | | Its only usecase was automated in the previous commit.
* vo_gpu/context_android: replace both options with android-surface-sizesfan52018-01-021-0/+5
| | | | This allows us to automatically trigger a VOCTRL_RESIZE (also contained).
* options: move most subtitle and OSD rendering options to sub structswm42018-01-021-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove them from the big MPOpts struct and move them to their sub structs. In the places where their fields are used, create a private copy of the structs, instead of accessing the semi-deprecated global option struct instance (mpv_global.opts) directly. This actually makes accessing these options finally thread-safe. They weren't even if they should have for years. (Including some potential for undefined behavior when e.g. the OSD font was changed at runtime.) This is mostly transparent. All options get moved around, but most users of the options just need to access a different struct (changing sd.opts to a different type changes a lot of uses, for example). One thing which has to be considered and could cause potential regressions is that the new option copies must be explicitly updated. sub_update_opts() takes care of this for example. Another thing is that writing to the option structs manually won't work, because the changes won't be propagated to other copies. Apparently the only affected case is the implementation of the sub-step command, which tries to change sub_delay. Handle this one explicitly (osd_changed() doesn't need to be called anymore, because changing the option triggers UPDATE_OSD, and updates the OSD as a consequence). The way the option value is propagated is rather hacky, but for now this will do.
* sub: move all subtitle timestamp messing code to a central placewm42018-01-021-6/+4
| | | | | | | | | | | | | | | | | It was split at least across osd.c and sd_ass.c/sd_lavc.c. sd_lavc.c actually ignored most of the more obscure subtitle timing things. There's no reason for this - just move it all to dec_sub.c (mostly from sd_ass.c, because it has some of the most complex stuff). Now timestamps are transformed as they enter or leave dec_sub.c. There appear to have been some subtle mismatches about how subtitle timestamps were transformed, e.g. sd_functions.accepts_packet didn't apply the subtitle speed to the timestamp. This patch should fix them, although it's not clear if they caused actual misbehavior. The semantics of SD_CTRL_SUB_STEP are slightly changed, which is the reason for the changes in command.c and sd_lavc.c.
* command: add demuxer-lavf-list propertyRicardo Constantino2018-01-021-0/+15
| | | | | | | | | Was only available with --demuxer-lavf-format=help and the demuxer needed to be used for it to actually print the list. This can be used in the future to check if 'dash' support was compiled with FFmpeg so ytdl_hook can use it instead. For now, dashdec is too rudimentary to be used right away.
* player: add internal `vo-resize` commandsfan52017-12-271-0/+7
| | | | Intended to be used with the properties from previous commit.
* options: drop some previously deprecated optionswm42017-12-251-44/+0
| | | | | | | | A release has been made, so drop options deprecated for that release. Also drop some options which have been deprecated a much longer time before. Also fix a typo in client-api-changes.rst.
* player: update duration based on highest timestamp demuxedwm42017-12-241-0/+1
| | | | | | | | This will help with things like livestreams. As a minor detail, subtitles are excluded, because they sometimes have "unused" events after video and audio ends. To avoid this annoying corner case, just ignore them.
* command: use IEC symbols for file size formattingMartin Herkt2017-12-241-4/+4
|
* options: deprecate --ff- options and propertieswm42017-12-211-0/+2
| | | | | | | | | | | Some old crap which nobody needs and which probably nobody uses. This relies on a GCC extension: using "## __VA_ARGS__" to remove the comma from the argument list if the va args are empty. It's supported by clang, and there's some chance newer standards will introduce a proper way to do this. (Even if it breaks somewhere, it will be a problem only for 1 release, since I want to drop the deprecated properties immediately.)
* command: make video-frame-info property observablewm42017-12-201-1/+1
| | | | Pointed out as missing by someone. Not terribly useful, but here we go.
* dvb: Fix long channel switching: next/prev channelrim2017-12-161-4/+4
|
* msg: reinterpret a bunch of message levelsNiklas Haas2017-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | I've decided that MP_TRACE means “noisy spam per frame”, whereas MP_DBG just means “more verbose debugging messages than MSGL_V”. Basically, MSGL_DBG shouldn't create spam per frame like it currently does, and MSGL_V should make sense to the end-user and provide mostly additional informational output. MP_DBG is basically wh