summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* osc: don't show error if windowcontrols=yesPhilip Langdale2019-12-021-1/+2
| | | | | | | | I always intended for this to be accepted and mean "right" but I made it show an error for any value that's not explicitly recognised (while considering all unrecognised values to mean "right"). So let's explicitly recognise "yes".
* osc: don't always set window control keybindingsDudemanguy2019-12-011-4/+6
| | | | | Only set the window control keybindings if the window control option is actually enabled. Fixes #7212.
* wayland: update Maximize and Minimize handling to use new optionsPhilip Langdale2019-12-011-4/+0
| | | | | | | | | | | I wanted to get this done quickly as I introduced the new VOCTRL behaviour for minimize and maximize and it was immediately made legacy, so best to purge it before anyone gets confused. I did not sort out fullscreen as that's more involved and not something I've educated myself about yet. But I did replace the VOCTRL_FULLSCREEN usage with the new option change mechanism as that seemed simple enough.
* osc: ensure the window-controls mouse area is initially zero sizedPhilip Langdale2019-11-301-0/+1
| | | | | | This is necessary to avoid breaking input behaviour in the 'idle' state when not playing a video. Otherwise, the mouse area starts off covering the whole window and blocks normal input.
* js: mp.add_key_binding: allow false-y name (match 311cc5b)Avi Halachmi (:avih)2019-11-301-1/+3
| | | | | This is in addition to the allowed omission of name and/or flags (as documented).
* lua: unbreak mp.add_key_binding(key, fn)Avi Halachmi (:avih)2019-11-301-1/+1
| | | | | | | Commit 311cc5b6 added the ability use flags while omitting name, but broke the case where both name and flags are omitted. Now omitting either name or flags or both works as documented.
* osc: fix typo wsc_geo -> wc_geoPhilip Langdale2019-11-301-1/+1
|
* osc: apply boxvideo margins to the window controlsPhilip Langdale2019-11-301-0/+3
| | | | | | It seems logical to account for the window controls if `boxvideo` is in use (which has the effect of reducing the size of the video so that the osc is not covering the video).
* command: remove property change notification from property dispatcherwm42019-11-301-3/+2
| | | | | | Properties should handle this themselves. This basically sent redundant notifications. I found only two places where the "proper" notification was missing.
* command: merge two functionswm42019-11-301-11/+3
| | | | Due to recent changes, it makes no sense anymore to keep them separate.
* command: remove another unneeded hackwm42019-11-301-12/+2
| | | | | | | | | | | Now that the option-to-property bridge is gone, this is not needed anymore. It always took the "silent" path. Also, at least as of before this commit, this didn't correctly print a warning when accessing a deprecated option as property. This was because m_config_get_co_raw() was used, which intentionally does not print any warnings, so switch to the non-raw one. (Affects only options that have .deprecation_message set.)
* osc: fix operation when window controls are disabledwm42019-11-291-2/+4
| | | | | It seems this area is simply not defined when window controls are disabled, so ipairs() will crash on it.
* osc: handle deadzone and barmargin for window controlsPhilip Langdale2019-11-291-6/+28
| | | | | | | | | | | | | | | | I missed these due to only testing with my personal osc config. The deadzone needs to be correctly handled for the window controls, or they will fail to appear when the mouse is close to or over them. In the process of doing that, I realised that the controls should respect the barmargin, if set. This is because the controls should remain aligned when layout=topbar and as the control bar is top aligned, it should be equally affected if the user needs to set the barmargin. I also fixed a mistake in trying to the use the mpv-osd-symbols font for the window controls.
* command: change window-minimized/window-maximized to optionswm42019-11-291-50/+4
| | | | | Unfortunately, this breaks window state reporting for all VOs which supported it. This can be fixed later (for x11 in the next commit).
* player: change m_config to use new option handling mechanismswm42019-11-295-19/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of making m_config a special-case, it more or less uses the underlying m_config_cache/m_config_shadow APIs properly. This makes the player core a (relatively) equivalent user of the core option API. In particular, this means that other threads can change core options with m_config_cache_write_opt() calls (before this commit, this merely led to diverging option values). An important change is that before this commit, mpctx->opts contained the "master copy" of all option data. Now it's just another copy of the option data, and the shadow copy is considered the master. This is why whenever mpctx->opts is written, the change needs to be copied to the master (thus why this commits add a bunch of m_config_notify... calls). If another thread (e.g. a VO) changes an option, async_change_cb is now invoked, which funnels the change notification through the player's layers. The new self_notification parameter on mp_option_change_callback is so that m_config_notify... doesn't trigger recursion, and it's used in cases where the change was already "processed". It's still needed to trigger libmpv property updates. (I considered using an extra m_config_cache for that, but it'd only cause problems with no advantages.) I think the recent changes actually forgot to send libmpv property updates in some cases. This should fix this anyway. In some cases, property updates are reworked, and the potential for bugs should be lower (probably). The primary point of this change is to allow external updates, for example by a VO writing the fullscreen option if the window state is changed by the window manager (rather than mpv changing it). This is not used yet, but the following commits will.
* options: get rid of GLOBAL_CONFIG hackwm42019-11-291-2/+1
| | | | | | | Just an implementation detail that can be cleaned up now. Internally, m_config maintains a tree of m_sub_options structs, except for the root it was not defined explicitly. GLOBAL_CONFIG was a hack to get access to it anyway. Define it explicitly instead.
* command: use m_option_equal()wm42019-11-291-16/+1
| | | | No more converting the option values to a string to compare it.
* osc: implement pseudo client side decorations via OSCPhilip Langdale2019-11-291-7/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Today, if window decorations are not present, either because they were disabled, or because the platform doesn't support them (eg: gnome-shell on wayland), there are no window controls, meaning it is not possible to minimize/maximize/close a window without knowing keyboard shortcuts. While you can imagine various ways of offering client side decorations, it is attractive to consider using OSC because that is functionality that we already have. The main work here is defining a separate input area from the main OSC box with its own buttons, etc. While we could probably handle auto-detection based on whether decorations are present or not, it's manually controlled for now. The window control logic is mostly disconnected from the OSC itself, except in the case of the `topbar` layout, where there has to be coordination so that the controls don't get drawn on top of each other. I had to do fine-positioning of the buttons based on the font on my system, so don't be surprised if it looks wrong elsewhere. You could also argue that window controls should be unscaled, even if the main OSC box is scaled, but I've not tried to do this.
* command: add `window-maximized` and make `window-minimized` settablePhilip Langdale2019-11-291-2/+38
| | | | | | | | | | | If we want to implement window pseudo-decorations via OSC, we need a way to tell the vo to minimize and maximize the window. Today, we have minimized as a read-only property, and no property for maximized. Let's made minimized settable and add a maximized property to go with it. In turn, that requires us to add VOCTRLs for minimizing or maximizing a window, and an additional WIN_STATE to indicate a maximized window.
* options: remove options-to-property bridgewm42019-11-254-53/+3
| | | | | | | | The previous bunch of commits made this unnecessary, so this should be a purely internal change with no user impact. This may or may not open the way to future improvements. Even if not, at least the property/option interaction should now be much less buggy.
* command: shuffle around even more crapwm42019-11-252-79/+23
| | | | | | | | | | | | | | | | | | Convert some remaining properties to work without the option-to-property bridge. Behavior shouldn't change (except for the corner case that it tries to reapply the new state when setting a property, while it used to ignore redundant sets). As it is the case with many of these changes, much of the code is not in its final proper state yet, but is rather a temporary workaround. For example, these "VO flag" properties should just be fully handled in the VO backend. (Currently, the config or VO layers don't provide enough mechanism yet as that all the backends like x11, win32, etc. could be changed yet, but that's another refactoring mess for another time.) Now nothing relies on this option-to-property bridge anymore, which opens the way to even more refactoring, which eventually may result in tiny improvements for the end user.
* command: change vid/aid/sid property behavior slightlywm42019-11-251-44/+26
| | | | | Again in line with the option-to-property bridge changes. As usual, this causes subtle behavior changes, which may affect some users.
* command: change af/vf property behavior wrt. filter creation failureswm42019-11-251-6/+7
| | | | | | The behavior is slightly different in a messy way. The change is in line with the option-to-property bridge removal mentioned some commits ago and thus is deemed necessary.
* command: remove redundant reinit_filters() call on filter change failurewm42019-11-251-1/+0
| | | | | | This attempted to restore the old filter chain if setting a new one at runtime failed. This is not needed anymore, because changing the filter chain is done in a "transactional" way now.
* command, options: deprecate old --display-fps behaviorwm42019-11-251-2/+20
| | | | | | | See changelog and manpage changes. (So much effort to fix an ancient dumb mistake for an option nobody should use anyway.)
* command: shuffle some crap aroundwm42019-11-253-166/+101
| | | | | | | | | | | | | | | | | | | | | | | | This is preparation to get rid of the option-to-property bridge (mp_on_set_option). This is a pretty insane thing that redirects accesses to options to properties. It was needed in the ever ongoing transition from something to... something else. A good example for the need of this bridge is applying profiles at runtime. This obviously goes through the config parser, but should also make all changes effective, for which traditionally the property layer is used. There isn't much left that needs this bridge. This commit changes a bunch of options (which also have a property implementation) to use option change notifications instead. Many of the properties are still left, but perform unrelated functions like OSD formatting. This should be mostly compatible. There may be some subtle behavior changes. For example, "hwdec" and "record-file" do not check for changes anymore before applying them, so writing the current value to them suddenly does something, while it was ignored before. DVB changes untested, but should work.
* lua: make add_key_binding() rotate optional arguments correctlywm42019-11-231-1/+5
| | | | | | | | add_key_binding() makes the name argument optional (in weird Lua fashion), which did not work if there were additional arguments. So there is no way to avoid specifying a name while passing a rp argument. Fix this, declare this way of skipping the argument as deprecated, and allow passing name=nil as the preferred way to skip the name argument.
* command, input: add input-bindings propertywm42019-11-231-1/+18
| | | | | | Read-only information about all bindings. Somewhat hoping someone can make a nice GUI-like overlay thing for it, which provides information about mapped keys.
* command: add command-list propertywm42019-11-231-0/+25
|
* input: change mp_cmd.original from bstr to cstrwm42019-11-231-2/+2
| | | | | | | | No reason to have this as bstr, just makes everything more complex. Also clear mp_cmd.sender when it's copied. Otherwise it would be a dangling pointer. Apparently it's never set to non-NULL in this situation, but this is cleaner anyway.
* input: add text produced by key to script key eventswm42019-11-222-6/+11
| | | | | | | Particularly for "any_unicode" mappings, so they don't have to special-case keys like '#' and ' ', which are normally mapped to symbolic names for input.conf reasons. (Though admittedly, this is a pretty minor thing, since API users could map these manually.)
* js: complex key binding: use key_name like the docs sayAvi Halachmi (:avih)2019-11-201-1/+1
|
* js: report key name for "complex" key bindings - match b08c8f50Avi Halachmi (:avih)2019-11-201-4/+5
|
* lua: complex key binding: use key_name like the docs sayAvi Halachmi (:avih)2019-11-201-1/+1
|
* player: Optionally validate st_mtime when restoring playback stateChris Down2019-11-201-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I often watch sporting events. On many occasions I get files with the same filename for each session. For example, for F1 I might have the following directory structure: F1/ FP1.mkv FP2.mkv FP3.mkv Qualification.mkv Race.mkv Since usually one simply watches one race after the other, I usually just rsync the new event's files over the old ones, so, for example, Race.mkv will be replaced from the file for the last event with the file from the new event. One problem with this is that I like to use --resume-playback for other kinds of media, so I have it on by default. That works great for, say, a movie, but doesn't work so well with this scheme, because you can trivially forget to pass --no-resume-playback on the command line and end up 2 hours in, watching spoilers as the race results scroll down the screen :-) This patch adds a new option, --resume-playback-check-mtime, which validates that the file's mtime hasn't changed since the watch_later configuration was saved. It does this by setting the watch_later configuration to have the same mtime as the file after it is saved. Switching back and forth between checking mtime and not checking mtime works fine, as we only choose whether to compare based on it, but we update the watch_later configuration mtime regardless of its value.
* lua: report key name for "complex" key bindingswm42019-11-191-4/+5
| | | | This might make certain use cases less of a mess.
* js: don't pre-filter log level argument in mp.enable_messages()Avi Halachmi (:avih)2019-11-191-2/+3
| | | | Match lua's 8e5642ff
* player: remove mechanisms for better logging with repl.luawm42019-11-183-7/+26
| | | | | | | | | | | | | | | | | | | | | | As preparation for making repl.lua part of the core (maybe), add some mechanisms which are supposed to improve its behavior. Add a silent mode. Calling mpv_request_log_messages() with the log level name prefixed with "silent:" will disable logging from the API user's perspective. But it will keep the log buffer, and record new messages, without returning them to the user. If logging is enabled again by requesting the same log level without "silent:" prefix, the buffered log messages are returned to the user at once. This is not documented, because it's far too messy and special as that I'd want anyone to rely on this behavior, but it will be perfectly fine for an internal script. Another thing is that we record early startup messages. The goal is to make the repl.lua script show option and config parsing file errors. This works only with the special "terminal-default" log level. In addition, reduce the "terminal-default" capacity to only 100 log messages. If this is going to be enabled by default, it shouldn't use too much resources.
* lua: don't pre-filter log level argument in mp.enable_messages()wm42019-11-181-2/+4
| | | | | | | | | | | | This will just make it not work if mpv_request_log_messages() gets extended to accept more names. Pass the argument without checking. To keep the behavior the same (for whatever reasons, probably not important), still raise an error if the libmpv API function returns an error that the argument was bad. (The check_loglevel() function is still used when the script _emits_ log messages, which is different, and for which there is no API anyway.)
* options: deprecate --video-sync=display-adropwm42019-11-172-0/+7
| | | | A stupid thing that will probably be in the way.
* player: remove some unnecessary coverart special caseswm42019-11-173-4/+2
| | | | | | | | These should not be needed, since video is in EOF mode in this case anyway. Not too sure about the video.c case to be honest, well, here goes nothing.
* video: make track switching work for external imageswm42019-11-171-7/+13
| | | | | | | | Until now, this didn't work, since the external image had pts 0; so enabling video at a later time did nothing, because the image was discarded. Since hrseek now ends on the last frame (instead of nothing), reusing the hrseek mechanism solves this, and we don't even need to treat the cursed coverart case separately.
* player: remove commented declarationwm42019-11-171-1/+0
| | | | It was commented almost 2 years ago in a "rewrite everything" commit.
* audio: log A/V initial sync statuswm42019-11-171-0/+3
|
* video: set EOF status as soon as possiblewm42019-11-171-1/+7
| | | | | | | | | | | | See what the added code comment says. Normally when this is needed, it's the cover art case. But this flag is not set when using an external image. This gives weird seek behavior, because the frame will be "normally" displayed for its determined duration, and during normal video playback, the video pts will be used - which is always 0 here. This should happen only if audio is active. Otherwise, we're more or less in image viewer mode, where the image should be displayed for a configured duration.
* video: if hr-seek goes past last frame, seek to last framewm42019-11-171-7/+6
| | | | | | | | | | | | This gives much better behavior in general, and is what we want if video somehow ends earlier than audio. A common special is using an audio file with an external image file. This commit makes things like switching aspect ratio work (provided the demuxer for the image behaves correctly, which currently isn't the case with demux_mf.c). Since the image file had timestamp 0, it was usually skipped by hr-seek, and changed properties weren't applied to it at the start of the filter chain.
* client API: remove sync. property notification code againwm42019-11-161-41/+14
| | | | | | | | | | | | It's too easy to introduce unintended circular lock dependencies. Just now we found that the (old) cocoa vo_gpu backend is also affected by this, because it waits on the Cocoa main thread, which in turn uses libmpv API for OSX... stuff. Also fix a missing initial property update after observe. This leaves me unhappy, because it just leads to a stupid thread ping pong. Will probably rewrite this later.
* video: take first frame into account in audio-sync modewm42019-11-161-3/+2
| | | | | | | | | | | | | | | It appears commit 4ad68d94523c3d101a broke handling the first video frame duration through roundabout ways (I think because the duration of the first frame was now available at all in the normal case). The first frame was cut short, which showed up especially with looping, or if the file had a low FPS. This questionable change seems to fix it without breaking any other known cases => push and call it a day. The display-sync mode did not have this problem. Fixes: #7150
* player: enable "pause caching" code for local playback toowm42019-11-141-2/+1
| | | | | | | | There isn't really a need to disable this for local playback. I think originally I did this because I was afraid the code could mess up or be annoying on local mode, but that's not really a good argument. I'd rather test this code in local mode too. In this case, it shouldn't really happen that it runs out of cache in the first place.
* options: remove M_SETOPT_RUNTIMEwm42019-11-104-17/+10
| | | | | | | Used to contain flags for "save" setting of options at runtime. Now there is nothing special needed anymore and it's 0. So drop it completely, and remove anything that distinguishes between runtime and initialization time.
* test: merge test_helpers.c and index.cwm42019-11-081-1/+1
| | | | | No need to keep them separate. Originally I thought index.c was only going to contain the list of tests, but that didn't happen.
* player: do not require dummy file arguments to use --unittestwm42019-11-081-5/+5
| | | | | Move the test execution above the point where it checks for an empty playlist and exits if that's the case.
* wscript: add --enable-ta-leak-report optionwm42019-11-081-1/+3
| | | | Kind of more convenient because I'm lazy.
* test: make tests part of the mpv binarywm42019-11-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, each .c file in test/ was built as separate, self-contained binary. Each binary could be run to execute the tests it contained. Change this and make them part of the normal mpv binary. Now the tests have to be invoked via the --unittest option. Do this for two reasons: - Tests now run within a "properly" initialized mpv instance, so all services are available. - Possibly simplifying the situation for future build systems. The first point is the main motivation. The mpv code is entangled with mp_log and the option system. It feels like a bad idea to duplicate some of the initialization of this just so you can call code using them. I'm also getting rid of cmocka. There wouldn't be any problem to keep it (it's a perfectly sane set of helpers), but NIH calls. I would have had to aggregate all tests into a CMUnitTest list, and I don't see how I'd get different types of entry points easily. Probably easily solvable, but since we made only pretty basic use of this library, NIH-ing this is actually easier (I needed a list of tests with custom metadata anyway, so all what was left was reimplement the assert_* helpers). Unit tests now don't output anything, and if they fail, they'll simply crash and leave a message that typically requires inspecting the test code to figure out what went wrong (and probably editing the test code to get more information). I even merged the various test functions into single ones. Sucks, but here you go. chmap_sel.c is merged into chmap.c, because I didn't see the