summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* osc: display Santa hat for idle logo in DecemberTheAMM2019-12-231-18/+43
| | | | | | | | | | During the 12th month (checked during script initialization), draw a Santa hat on top of the idle message's logo. Slightly refactors and optimizes the drawing process as well: reorder original logo layers and remove redundant holes in them, use a shared line prefix to clear the style and set start position. Signed-off-by: wm4 <wm4@nowhere>
* client API: deprecate tick eventwm42019-12-221-0/+2
| | | | | This is conceptually outdated and should not exist. This affects Lua scripting and JSON IPC too.
* js: read_options: on_update: don't re-read the config fileAvi Halachmi (:avih)2019-12-221-3/+3
| | | | | | | | | | | | | Now that 00af718a made the lua read_options behavior much more similar to the js behavior, the main difference was that lua does not re-read the config file at on_update (but it does re-apply its stored content) while js did re-read it. Now the js on_update also does not re-read the config file and instead applies its stored original content. This is slightly hacky by adding an undocumented optional 4th argument to read_options which allows overriding the config file content.
* console: reduce border sizewm42019-12-221-1/+1
| | | | | This looks better if the ASS canvas size is used to scale according to HiDPI factor (instead of font size).
* osc: use video margins only if OSC is visiblewm42019-12-221-6/+5
| | | | | Looks awkward otherwise. This means that even if boxvideo is enabled, nothing gets "boxed" if the OSC is set to auto-hide.
* osc: cleanup boxvideo margin handlingwm42019-12-221-20/+23
| | | | | | | | | | Make sure it gets properly reinitialized when needed. This is especially useful now that the OSC reacts to runtime option changes, which can change the layout too. This may call set_property_number() on the margin properties more often now, but since redundant option changes are ignored now, this shouldn't have any too bad effects.
* osc: full reinit on runtime option changeswm42019-12-221-3/+2
| | | | | | | | | Fuck it, just let's just reinit everything. On a side note, the changelist parameter provided by read_options() (here "list") is now unused. But it's not hard to provide and might be useful for other stuff. So don't remove it from the generic read_options() code.
* lua: change runtime option change behaviorwm42019-12-221-24/+27
| | | | | | | | | | | | As described in the manpage changes. This makes more sense than the previous approach, where options could "unexpectedly" stick. Although this is still a somewhat arbitrary policy (ask many people and you'd get a number of different expectations on what should happen), I think that it reflects what mpv's builtin stuff does. All the copying is annoying, but let's just hope nobody is stupid enough to change these properties per video frame or something equally ridiculous.
* command: fix confusing displayed aspect-ratioAbdullah Alansari2019-12-221-0/+33
| | | | | For example, when a user switches the aspect-ratio display `16:9` instead of `1.778` and `Original` instead of `-1.000`.
* js: read_options: support on_update (match 478a321d)Avi Halachmi (:avih)2019-12-211-2/+16
| | | | | | | | | | | | | This is a bit different than the lua code: on script-opts change it simply re-applies the conf-file and script-opts to the options object, and if this results in any changed value at options then on_update is called with the changelist as argument. This allows a value to revert back to the conf-file value if the matching script-opts key had a different value and then got deleted. It also guarantees to call back whenever the options object is modified, which the lua code doesn't do (e.g. if the caller changed a value and the observer changed it back - it won't detect a change).
* osc: cosmetics: remove some excessive whitespacewm42019-12-201-7/+0
|
* osc: react to script-opts runtime changeswm42019-12-201-1/+8
| | | | | | | | | | With special attention to changing osc-visibility. Untested, although osc-visibility works (it's pretty much equivalent to the key binding, so there is not much interesting going on). Somewhat inspired by code posted by github user CogentRedTester. Fixes: #4513
* lua: add a helper for runtime script option changeswm42019-12-201-15/+62
| | | | | A script can use this to easily get runtime updates. (Even if script-opts is sort of clunky.)
* osc: rearrange hidetimeout/visibiltiy handlingwm42019-12-201-19/+19
| | | | | | | | | | The way how this modifies and backups/restores user option values is a bit of a problem for runtime option changing. Clean this up a little. Now cycling the visibility updates the user option value, but always to "valid" values (unlike hidetimeout used to be used). If the user option value is changed externally (enabled by a later commit), it'll be cleanly overwritten.
* osc: move windowcontrols option code to the right placewm42019-12-201-15/+14
| | | | | | There doesn't seem to be a reason why it was where it was. It should be in validate_user_opts(), which will be important for runtime changing too.
* console: use hidpi scale reportingwm42019-12-201-2/+7
| | | | | | | | I decided to factor this into the user's scale option (instead of somehow using it as default if the user has not specified it), because it makes the option handling simpler, and won't break things like per-screen DPI if the user only wants to scale the console font by a factor.
* command: add property returning hidpi scalewm42019-12-201-0/+12
|
* stream, demux: redo origin policy thingwm42019-12-202-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv has a very weak and very annoying policy that determines whether a playlist should be used or not. For example, if you play a remote playlist, you usually don't want it to be able to read local filesystem entries. (Although for a media player the impact is small I guess.) It's weak and annoying as in that it does not prevent certain cases which could be interpreted as bad in some cases, such as allowing playlists on the local filesystem to reference remote URLs. It probably barely makes sense, but we just want to exclude some other "definitely not a good idea" things, all while playlists generally just work, so whatever. The policy is: - from the command line anything is played - local playlists can reference anything except "unsafe" streams ("unsafe" means special stream inputs like libavfilter graphs) - remote playlists can reference only remote URLs - things like "memory://" and archives are "transparent" to this This commit does... something. It replaces the weird stream flags with a slightly clearer "origin" value, which is now consequently passed down and used everywhere. It fixes some deviations from the described policy. I wanted to force archives to reference only content within them, but this would probably have been more complicated (or required different abstractions), and I'm too lazy to figure it out, so archives are now "transparent" (playlists within archives behave the same outside). There may be a lot of bugs in this. This is unfortunately a very noisy commit because: - every stream open call now needs to pass the origin - so does every demuxer open call (=> params param. gets mandatory) - most stream were changed to provide the "origin" value - the origin value needed to be passed along in a lot of places - I was too lazy to split the commit Fixes: #7274
* osc: fix a commentwm42019-12-201-1/+1
|
* osc: fade out if paused and mouse position is outside of OSCwm42019-12-191-5/+18
| | | | | This broke with the recent changes since tick() is not called regularly anymore in paused mode. Add an explicit timer for this.
* osc: fix crash when toggling visibilitywm42019-12-191-1/+0
| | | | | The previous osc.lua related commit removed this function, and trying to call it crashed the OSC. Just remove the call.
* js: support shared script properties (match 7e4819e7)Avi Halachmi (:avih)2019-12-191-0/+22
|
* js: require: allow custom module search paths via mp.module_pathsAvi Halachmi (:avih)2019-12-191-4/+10
|
* osc: don't run update_margins() every framewm42019-12-191-2/+4
| | | | | This is something recent that also caused per frame log spam, because it tried to update the margins every frame.
* command: reduce OSC/stats log spamwm42019-12-191-8/+11
| | | | | | | | | | | | | | | | | | For some inexplicable reason, the OSC runs the expand-text command a _lot_. This command is logged at the log file default log level, so the log file can quickly fill up with these messages. It directly violates the mpv logging policy: per-frame (or similarly common) log messages should not be enabled by default for the log file. stats.lua uses the show-text command for some reason (instead of creating its own OSD layer). Explicitly reduce the log level for expand-text and some other commands. Also reduce the log level for commands triggered by mouse movement. The previous commit also contributed some to reduce log spam. Fixes: #4771
* osc: use property notifications and a timer instead of "tick" eventswm42019-12-191-60/+47
| | | | | | | | | | | | | | | | | | | | | | | Traditionally, the OSC used mpv's "tick" event, which was approximately sent once per video frame. It didn't try to track any other state, and just updated everything. This is sort of a problem in many corner cases and non-corner cases. For example, it would eat CPU in the paused state (probably to some degree also the mpv core's fault), or would waste power or even throw errors ("event queue overflows") on high FPS video. Change this to not using the tick event. Instead, react to a number of property change events. Rate-limit actual redrawing with a timer; the next update cannot happen sooner than the hardcoded 30ms OSC frame duration. This has also the effect that multiple successive updates are (mostly) coalesced. This means the OSC won't eat your CPU when the player is fucking paused. (It'll still update if e.g. the cache is growing, though.) There is some potential for bugs whenever it uses properties that are not explicitly observed. (In theory we could easily change this to a reactive concept to avoid such things, but whatever.)
* client API: rewrite property observation (again)wm42019-12-193-137/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I intend to rewrite this code approximately every 2 months. Last time, I did this in commit d66eb93e5d4 (and 065c307e8e7 and b2006eeb74f). It was intended to remove the roundabout synchronous thread "ping pong" when observing properties. At first, the original async. code was replaced with some nice mostly synchronous code. But then an async. code path had to be added for vo_libmpv, and finally the sync. code was dropped because it broke in other obscure cases (like the Objective-C Cocoa backend). Try again. This time, update properties entirely on the main thread. Updates get batched out on every playloop iteration. (At first I wanted it to make it every time the player goes to sleep, but that might starve API clients if the playloop get saturated.) One nice thing is that clients only get woken up once all changed events have been sent, which might reduce overhead. While this sounds simple, it's not. The main problem is that reading properties must not block the client API, i.e. no client API locks can be held while reading the property. Maybe eventually we can avoid this requirement, but currently it's just a fact. This means we have to iterate over all clients and then over all properties (of each client), all while releasing all locks when updating a property. Solve this by rechecking on each iteration whether the list changed, and if so, aborting the iteration and redo it "next time". High risk change, expect bugs such as crashes and missing property updates.
* console: adjust position to OSCwm42019-12-181-1/+17
| | | | See previous commit.
* osc: make margins availablewm42019-12-181-1/+23
| | | | | | | | | This is for console.lua (see next commit). The idea is that console.lua can adjust its offset to the bottom of the window by the height of the OSC. If the OSC is not set to permanently visible, export no margins, because it would look weird to move the console depending on the mouse movement.
* command, lua: add a way to share data between scriptswm42019-12-182-0/+55
| | | | | | | | | Very primitive and dumb, but fulfils its purpose for the next commits. I chose this specific implementation because it has the lowest footprint in command.c, without resorting to crazy hacks such as sending messages between scripts (which would be hard to coordinate especially on startup).
* command: make change-list work with pure properties toowm42019-12-181-5/+14
| | | | Until now, it only worked on options. Useful for the next commit.
* command, vo: remove old option change notification mechanismswm42019-12-172-24/+2
| | | | | | | These all have been replaced recently. There was a leftover in window.swift. It couldn't have done anything useful in the current state of the code, so drop these lines.
* client API: remove some dead codewm42019-12-171-6/+0
| | | | | This was for the "suspend" API, which has been removed (turned into stubs) a long time ago.
* command: slightly simplify input-ipc-server change detection/initwm42019-12-171-17/+6
| | | | | | | The generic change detection now handles this just as well. The way how this function is manually called at init is slightly gross. Make that part slightly more explicit to hopefully avoid confusion.
* command: change "window-scale" property behaviorwm42019-12-162-21/+16
| | | | | | | | | This is similar to the "edition" change. I considered making this go through deprecation, but didn't have a good idea how to do that. Maybe it's fine, because this is pretty obscure. But it might break some API users/scripts (it certainly broke stats.lua), and all I have to say is sorry for that.
* command: remove unnecessary mute property implementationwm42019-12-161-15/+0
| | | | | This only added the CONSTRICTED_TYPE thing, but it works correctly without.
* command: change "edition" property behaviorwm42019-12-161-10/+19
| | | | | | | | | See manpage/changelog changes. The purpose of this change is to removes another case of inconsistent property behavior. At first I wanted to make this go through deprecation before making a technically incompatible change, but then I considered this feature too obscure as that anyone would care.
* player: avoid underrun wakeup loopwm42019-12-162-1/+9
| | | | | | | | | | | | | | | | | | The VO underrun detection (just a weak heuristic) added in commit f26dfb flagged the underrun state every time it was checked, and since the check happened in every playloop iteration, this caused the playloop to wake up itself on every iteration. It burned an entire core while in this state. Fix this by flagging this condition only once (as it should be), and requiring that a frame is displayed to trigger it again. This makes it work similar as the audio underrun check. The bug report referenced below says --demuxer-thread=no avoided this. This is because the demuxer layer doesn't do proper underrun reporting if the reader thread is disabled. Fixes: #7259
* player: fix an outdated commentwm42019-12-141-2/+1
| | | | | The client API doesn't use input_ctx anymore, and the "wakeup" flag is gone (if it even existed at all).
* player: move point at which queued seeks are appliedwm42019-12-141-2/+3
| | | | | | | | | | | Do it after decoding etc., but before waiting for input. This seems to make more sense, because whether a queued seek can be applied depends on the playback state. So it sounds like a good idea to apply the seek first thing, but it's a bad idea to go to sleep if there's still a queued seek pending (that couldn't be processed earlier). Also add an empty line before mp_wait_events(); it doesn't really have to do with the filter bullshit.
* player: make repeated hr-seeks past EOF trigger EOF as expectedwm42019-12-142-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you have a normal file with audio and video, and keep "spamming" forward hr-seeks, the player just kept showing the last video frame instead of exiting or playing the next file. This started happening since commit 6bcda94cb. Although not a bug per se, it was odd, and very user-noticable. The main problem was that the pending seek command was processed before the EOF was "noticed". Processing the command reset everything, so the player did not terminate playback, but repeated the seek. This commit restores the old behavior. For one, it makes video return the correct status (video.c). The parameter is a bit ugly, but better than duplicating the logic or having another MPContext field. (As a minor detail, setting r=VD_EOF makes sure have_new_frame() returns true, rather than going through another iteration or whatever the hell will happen instead, which would clobber logical_eof.) Another thing is making the seek logic actually wait until the seek outcome has been determined if audio is also active. Audio needs to wait for video in order to get the video seek target position. (Which in turn is because hr-seek still "snaps" to video frames. You can't seek in between two frames, so audio can't just use the seek target, but always has to wait on the timestamp of the video frame. This has other disadvantages and is a misdesign, but not something I'll fix today.) In theory, this might make hr-seeks less responsive, because it needs to fully decode/filter the audio too, but in practice most time is spent on video, which had to be fully decoded before this change. (In general, hr-seek could probably just show a random frame when a queued hr-seek overrides the current hr-seek, which would probably lead to a better user experience, but that's out of scope.) Fixes: #7206
* player: cosmetically restructure a small functionwm42019-12-141-7/+11
| | | | | No actual functional changes. Just preparation for the next commit, to reduce its diff.
* player: add comment to clarify FFmpeg ABI handlingwm42019-12-131-0/+3
| | | | Don't patch it out.
* osc: set the wrap style for the title shown with window controlsPhilip Langdale2019-12-121-1/+1
| | | | | | I missed adding this when defining the style used for the video title in the window control bar. The default behaviour is to wrap, but we want to cut the title off when we run out of space.
* osc: use custom symbols for window controlsPhilip Langdale2019-12-111-10/+26
| | | | | | | | | | | | | | | | | | | | | | | | I was recently informed that unicode has official symbols for window controls, and I put together a change to use them, which worked, as long as a suitable font was installed. However, it's not that hard to get a normal system that lacks an appropriate font, and libass wants to print warnings if the symbols aren't in the default font, which will almost always be true. So, I gave up and added the symbols to the custom osd font that we already have. This ensures they are always available, and that they are aligned consistently on all platforms. I took the symbols from the `symbola` font, as this has a suitable licence and the symbols look nice enough. Symbola Licence: Fonts are free for any use; they may be opened, edited, modified, regenerated, packaged and redistributed. Finally, as we now have access to an un-maximize symbol, I added logic to use it when the window is maximized.
* osc: explicitly re-init the osc on a change in border visibilityPhilip Langdale2019-12-091-0/+1
| | | | | | | | | | | | | | I had previously wondered whether to do this, but in my testing with x11 and wayland, the osc was being re-inited on a border toggle already so I didn't add it. However, on win32, things are different and there is no re-init when toggling borders. I belive this is because the active window size doesn't change in anyway, while on x11/wayland, toggling the border actually changes the window size - and that trigger a re-init. So, let's just be explicit and request a re-init when the border is toggled.
* console.lua: add this scriptJames Ross-Gowan2019-12-083-0/+705
| | | | | | | | | | | | | | | | | | | | | Merged from mpv-repl git repo commit 5ea2bf64f9c239f0326b02. Some changes were made on top of it: - Tabs were converted to 4 spaces indentation (plus some manual indentation fixes in some places). - All user-visible mentions of "repl" were renamed to "console". - The README was converted to a manpage (with heavy changes, some additions taken from stats.rst; rossy converted the key bindings table to RST). - The method to change the default key binding was changed. - Change minor detail about "font" default value setting (not a functional change). - Integrate into the player as builtin script, including an option to prevent loading it. Above changes and commit message done by wm4. Signed-off-by: wm4 <wm4@nowhere>
* lua: make later key bindings always have higher prioritywm42019-12-071-2/+13
| | | | | | | | | | | | | | | | | | | Later calls to mp.add_key_binding() should take priority over previous calls with the same key. Until now, the order was random (due to using table pairs() iteration order). Do this by simply sorting by a counter that is never reset. Since input.c also gives later bindings priority, this works out. Calling mp.remove_key_binding() on a newer binding makes an older still existing binding with the same key active again. New bindings override older ones, but do not overwrite them. I think these are good semantics for most use cases. (Note that the Lua code cannot determine whether two bindings use the same key. Keys are strings, and two different strings could refer to the same key. The code does not have access to input.c's key name normalization, so it cannot compare them.)
* command: fix unintended reset of filterswm42019-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | Since the recent option changes (probably b16cea750f527), using the "vf" or "af" commands to change the filter chain did not write the option value correctly. This led to the option value being reset the next time an option changed. This happened because the new option value was not copied to the m_config_cache's internal storage. So on the next option update, it looked like the option value changed, because the user-side value was different from the internal value. It was copied back, which meant the original option value was reinstated, and the previous "vf"/"af" command was undone. Fix this by using the correct way to store the option value. This also takes care of property change notification (because the function is specifically separate from m_config_cache_write_opt() to do that), so remove the old call. Fixes: #7220
* player: loadfile overrides previous stop commandwm42019-12-061-1/+1
| | | | |