summaryrefslogtreecommitdiffstats
path: root/player/lua
Commit message (Collapse)AuthorAgeFilesLines
* stats.lua: add graphs for readahead time and total byte usagewm42019-09-191-6/+58
| | | | | | | | | | | | | The readahead time should be interesting for latency vs. underruns (which idiot protocols like HLS suffer from). The total byte usage is less interesting than I hoped; maybe the frequency at which it samples should be reduced. (Kind of dumb - you want high frequency for the readahead field, but much lower for byte usage.) Of course, the code was copy&pasted from the DS ratio/jitter stuff. Some of the choices may not make any sense for the new code.
* osc: add feature to bottombar to not cover the videowm42019-09-191-1/+47
| | | | | | | | | | | | | | | | | | | | | | Normally I use the OSC like this: not at all, but have a key binding that does "cycle osc" to show it. And in that case, I don't really want it to overlap the damn video. I could use the zoom/pan options to move the video out of the way, but this is also sort of annoying. Likewise, you could write a script or so which does this automatically if the OSC appears, but that's still annoying, and computing values for these options such that the video is moved correctly is tricky. So I added a bunch of options that set explicit video borders (previous commit), and a option for the OSC to use them (this commit). Disabled by default, since I'm afraid this is too awkward and unpolished, especially with OSC default settings. I'm also using "osc-visibility=always". Effectively, making the OSC appear will box the video, and making it disappear (by unloading osc.lua) will restore the video back to normal.
* stats.lua: add cache info pagewm42019-09-191-4/+69
| | | | Uses page 3, which was apparently reserved for filter info.
* demux_edl, cue, mkv: clean up timeline stuff slightlywm42019-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | | Remove the singly linked list hack, replace it with a slightly more proper data structure. This probably gets rid of a few minor bugs along the way, caused by the awkward nonsensical sharing/duplication of some fields. Another change (because I'm touching everything related to timeline anyway) is that I'm removing the special semantics for parts[num_parts]. This is now strictly out of bounds, and instead of using the start time of the next/beyond-last part, there is an end time field now. Unfortunately, this also requires touching the code for cue and mkv ordered chapters. From some superficial testing, they still seem to mostly work. One observable change is that the "no_chapters" header is per-stream now, which is arguably more correct, and getting the old behavior would require adding code to handle it as special-case, so just adjust ytdl_hook.lua to the new behavior.
* ytdl_hook: use no_clip for separate audio streamswm42019-09-191-1/+1
| | | | | | | | | | | | I noticed that some ytdl streams have a start time other than 0. There's currently no mechanism inside of the EDL stuff that determines this start time correctly, so it can happen that if the start time is high, demux_timeline.c tries to clip off the entire video and audio, resulting in failure of playback. As a counter measure, use the no_clip header, which entirely disables clipping against time ranges in demux_timeline.c. (It's basically a hack.)
* ytdl_hook: fix pseudo-DASH if no init fragment is presentwm42019-09-191-5/+11
| | | | | | | | | | | | | | Init fragments are not a necessity for DASH, but this code assumed so. Maybe the check was to prevent worse. But using normal EDL here leads to very shitty behavior where it tries to open hundreds or thousands of fragments, each with its own demuxer and HTTP connection. (This behavior is fine for normal uses of EDLs, but completely unacceptable when emulating fragmented streaming protocols. I'm not sure why the normal EDL code is needed here, but I think someone claimed some obscure sites just need it.) This happens in the same situation as the one described in the previous commit.
* ytdl_hook: audio can use fragmented DASH toowm42019-09-191-1/+1
| | | | | | | | | | | | | | Otherwise we'd just use the base URL as media URL, which would fail with a 404 error. Not sure if there's a deeper reason why the audio path was explicitly different from the video one. But this actually works now for a video that returned fragmented DASH audio with the default format selection. (This affects streams on that well known site of a big evil Silicon Valley company. Typically happens after live stream gets converted to a normal video, though after some time passes, this fragmented version is deleted, and replaced by a non-fragmented one. I've observed this several times and this seems to be the "normal" behavior.)
* ytdl_hook: disable EDL-generated useless chapters when merging streamswm42019-09-191-1/+2
| | | | (Yes, a bit odd how this header is needed only for the first stream.)
* ytdl_hook: merge separate audio tracks via EDLwm42019-09-191-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This merges separate audio and video tracks into one virtual stream, which helps the mpv caching layer. See previous EDL commit for details. It's apparently active for most of evil Silicon Valley giant's streaming videos. Initial tests seem to work fine, except it happens pretty often that playback goes into buffering immediately even when seeking within a cached range, because there is not enough forward cache data yet to fully restart playback. (Or something like this.) The audio stream title used to be derived from track.format_note; this commit stops doing so. It seemed pointless anyway. If really necessary, it could be restored by adding new EDL headers. Note that we explicitly don't do this with subtitle tracks. Subtitle tracks still have a chance with on-demand loading or loading in the background while video is already playing; merging them with EDL would prevent this. Currently, subtitles are still added in a "blocking" manner, but in theory this could be loosened. For example, the Lua API already provides a way to run processes asynchronously, which could be used to add subtitles during playback. EDL will probably be never flexible enough to provide this. Also, subtitles are downloaded at once, rather than streamed like audio and video. Still missing: disabling EDL's pointless chapter generation, and propagating download speed statistics through the EDL wrapper.
* loadfile, ytdl_hook: don't reject EDL-resolved URLs through playlistwm42019-09-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ytdl wrapper can resolve web links to playlists. This playlist is passed as big memory:// blob, and will contain further quite normal web links. When playback of one of these playlist entries starts, ytdl is called again and will resolve the web link to a media URL again. This didn't work if playlist entries resolved to EDL URLs. Playback was rejected with a "potentially unsafe URL from playlist" error. This was completely weird and unexpected: using the playlist entry directly on the command line worked fine, and there isn't a reason why it should be different for a playlist entry (both are resolved by the ytdl wrapper anyway). Also, if the only EDL URL was added via audio-add or sub-add, the URL was accessed successfully. The reason this happened is because the playlist entries were marked as STREAM_SAFE_ONLY, and edl:// is not marked as "safe". Playlist entries passed via command line directly are not marked, so resolving them to EDL worked. Fix this by making the ytdl hook set load-unsafe-playlists while the playlist is parsed. (After the playlist is parsed, and before the first playlist entry is played, file-local options are reset again.) Further, extend the load-unsafe-playlists option so that the playlist entries are not marked while the playlist is loaded. Since playlist entries are already verified, this should change nothing about the actual security situation. There are now 2 locations which check load_unsafe_playlists. The old one is a bit redundant now. In theory, the playlist loading code might not be the only code which sets these flags, so keeping the old code is somewhat justified (and in any case it doesn't hurt to keep it). In general, the security concept sucks (and always did). I can for example not answer the question whether you can "break" this mechanism with various combinations of archives, EDL files, playlists files, compromised sites, and so on. You probably can, and I'm fully aware that it's probably possible, so don't blame me.
* stats.lua: silence annoying fontconfig warningswm42019-09-191-2/+2
| | | | Apparently I don't have this font.
* osc: improve look of seekrangesJan Janssen2019-09-022-93/+261
|
* Merge branch 'master' into pr6360Jan Ekström2019-03-112-10/+7
|\ | | | | | | | | | | Manual changes done: * Merged the interface-changes under the already master'd changes. * Moved the hwdec-related option changes to video/decode/vd_lavc.c.
| * stats: merge multiple properties into one lineJulian2019-01-161-4/+4
| | | | | | | | | | | | | | Merge file-size/file-format and audio channel-count/format into one line respectively. This fixes stats overflowing the screen in larger than 19:6 aspect ratios. In this case a problem was reported for ~21:9 which should be common enough for us to "support" it.
| * lua: execute idle handlers after timers have been processedOlivier Perret2019-01-161-6/+3
| | | | | | | | | | | | | | Idle handlers used to not be executed when timers were active Now they are executed: * After all expired timers have been executed * After all events have been processed (same as when there are no timers)
* | stats: remove duplicate cache sizessfan52018-12-061-7/+4
| | | | | | | | The stream cache no longer exists, so there is no need to show the demuxer cache separately anymore.
* | Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into ↵Anton Kindestam2018-12-051-0/+62
|\ \ | |/ |/| | | | | | | wm4-commits--merge-edition This bumps libmpv version to 1.103
| * lua: expose mpv_abort_async_command()wm42018-05-241-3/+17
| | | | | | | | Also somewhat cleans up mp.command_native_async() error handling.
| * lua: reimplement mp.subprocess_detached() by invoking the "run" commandwm42018-05-241-0/+4
| | | | | | | | | | | | | | | | The "run" command is old. I'm not sure why the separate Lua implementation was added. But maybe it as because the "run" command used to be limited to a small number of arguments. This limit has been removed a while ago. In any case, the old implementation is not needed anymore.
| * lua: reimplement mp.subprocess() by invoking the new subprocess commandwm42018-05-241-0/+23
| | | | | | | | | | | | | | We keep mp.subprocess() with roughly the same semantics for compatibility with scripts (including the internal ytdl script). Seems to work with rhe ytdl wrapper. Not tested further.
| * lua: expose async commandswm42018-05-241-0/+21
| | | | | | | | Might be useful for some.
* | stats: show file formatwm42018-10-011-0/+2
| | | | | | | | Useful in particular with ytdl, where you never know what you get.
* | ytdl_hook: fix audio not being picked up for some sitesRicardo Constantino2018-09-261-2/+2
| |
* | ytdl_hook: always load ytdl:// links with ytdl_hook firstRicardo Constantino2018-08-171-7/+23
| | | | | | | | Suggested in IRC by sfan5.
* | stats: remove superfluous line breaksJulian2018-06-091-1/+1
| | | | | | | | | | Those accidentally slipped in with 9975835bdeec3f2b04b136ef40c70b02487bb0e6 due to bad copy & paste.
* | osc: fix accidentally skipping files when seeking with sliderfatalis2018-06-041-0/+2
|/ | | | | | | When seeking near the end of the file and the next file loads, seeking continues on the next file at the same position and then immediately the file after that. This patch stops slider seeking when a new file is loaded, which is the standard behavior of many other players.
* stats: show sample format of audio tracksfan52018-05-171-0/+1
|
* ytdl_hook: try to set video track first if availableRicardo Constantino2018-05-031-4/+4
| | | | | | | Fixes `--ytdl-format="dash-fastly_skyfire-video-363357330+dash-fastly_skyfire_sep-audio-363357330" https://vimeo.com/108650530` This happened because the video track also had audio available and after adding it expecting an audio-only track, there were no more tracks with video.
* ytdl_hook: don't log error when loading is abortedwm42018-04-151-2/+6
|
* config: replace config dir lua-settings/ with dir script-opts/Avi Halachmi (:avih)2018-04-071-1/+9
| | | | lua-settings/ is still supported, with deprecation warning.
* client API: add a first class hook API, and deprecate old APIwm42018-03-261-10/+7
| | | | | | | | | | | | | | | 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.
* stats: print section titles independentlyJulian2018-03-251-3/+6
| | | | | | | Previously, section titles (File/Video/Audio) were printed as suffix of a property that was assumed to always exist. However, with e.g. lavi-complex this is not the case, therfore, print them without being dependent on a property.
* stats: improve video/audio detectionJulian2018-03-251-30/+29
| | | | | | | | | Switch from audio|video to audio|video-out-params properties as per recommendation in #5670. These properties are tables and include information explicitly queried later, so switch to using these tables and reduce the amount of queried properties. Fixes #5670
* ytdl_hook: add ytdl:// prefix again for non-youtube playlistsRicardo Constantino2018-02-111-2/+6
| | | | | | | | Only youtube playlists return ID-only urls. Other extractors may return "<extractor>:<ID>" so those still need the ytdl:// prefix. Reproduced with http://www.cbc.ca/burdenoftruth/videos/trailers-promos/burden-of-truth-returns
* ytdl_hook: add script opt for using manifest URLsRicardo Constantino2018-02-111-2/+3
| | | | | | | | | | | Disable by default. This feature was added in 7eb342757, which allowed stream selection in runtime. Problem with this atm is that FFmpeg will try to demux every first packet of every track leading to noticeable delay opening the URL. This option can be changed to enabled by default or removed when HLS/DASH demuxers are improved upstream.
* ytdl_hook: parse youtube playlist urls to set start indexRicardo Constantino2018-02-111-5/+53
| | | | | | | | | | | | | | Still needs `--ytdl-raw-option=yes-playlist=` because this only works for youtube. This was requested in a few issues: https://github.com/mpv-player/mpv/issues/1400 https://github.com/mpv-player/mpv/issues/2592 https://github.com/mpv-player/mpv/issues/3024 For #1400 to be completely implemented would need ytdl_hook to re-request the same playlist with the last video's ID for the mix to continue indefinitely which would probably too hackish to work reliably.
* ytdl_hook: exit early, save an indentation levelRicardo Constantino2018-02-111-164/+165
|
* ytdl_hook: various nitRicardo Constantino2018-02-111-9/+5
| | | | | | | | Remove obsolete comment about FFmpeg ignoring non-http proxies which was repeated in ytdl_hook before the feature was added. Remove unnecessary conditions for not nil. Lua tables will always return nil for non-existent keys.
* ytdl_hook: whitelist subtitle URLs as wellRicardo Constantino2018-02-111-2/+4
| | | | | This was overlooked when doing the whitelisting for video and audio to fix #5456.
* ytdl_hook: use fallback if there's no demuxer-lavf-list propRicardo Constantino2018-02-111-3/+3
| | | | | | | This is important if backporting by grabbing the latest version of the script without backporting the commit that added the property: 828bd2963cd10a851e0a977809687aed4d377dc3
* ytdl_hook: pass http proxy to ffmpegRicardo Constantino2018-01-301-15/+27
| | | | | | | | | | | | | | FFmpeg only suppports http proxies and ignores it if the resulting url is https. Also, no SOCKS. Use it like `--ytdl-raw-options=proxy=[http://127.0.0.1:3128]` so it doesn't confuse mpv because of the colons. You need to pass it as an option because youtube-dl doesn't give us the proxy. Or just set `http_proxy` environment variable as recommended before. Added example using -append, which doesn't need escaping.
* ytdl_hook: pre-append id-only playlist items with shortened youtube URLRicardo Constantino2018-01-291-1/+1
|
* ytdl_hook: whitelist segmented DASH and HLS for the manifests codeRicardo Constantino2018-01-271-7/+9
| | | | Close #5453
* ytdl_hook: prefer hls/dash manifest if availableRicardo Constantino2018-01-261-6/+10
| | | | | | | This makes all the video/audio variants available for selection. Might break with non-hls/dash, or even with dash if FFmpeg wasn't compiled with the demuxer.
* ytdl_hook: fix safe url checking with EDL urlsRicardo Constantino2018-01-261-11/+11
|
* ytdl_hook: move url_is_safe earlier in codeRicardo Constantino2018-01-261-9/+9
| | | | lua isn't javascript.
* ytdl_hook: whitelist protocols from urls retrieved from youtube-dlRicardo Constantino2018-01-261-7/+47
| | | | | | Not very clean since there's a lot of potential unsafe urls that youtube-dl can give us, depending on whether it's a single url, split tracks, playlists, segmented dash, etc.
* ytdl_hook: support native dash demuxer, if presentRicardo Constantino2018-01-151-1/+44
| | | | | | Uses track tbr instead of track disposition id for dash selection Works just as expected because youtube-dl also takes tbr from the manifests.
* osc: leave only demuxer cache duration and limit its refresh rateRicardo Constantino2018-01-141-19/+16
| | | | Sorta requested in #5390
* ytdl_hook: look for the right ytdl binary according to systemRicardo Constantino2018-01-121-1/+2
| | | | | | | | package.config is available in 5.1, 5.2, 5.3 and luajit, so should be fine. The first character is the path separator, so it's '\' on windows and '/' on *nix. This should also prevent cases where users download the wrong binary.
* ytdl_hook: be more informative when youtube-dl failsRicardo Constantino2018-01-121-2/+8
|
* ytdl_hook: don't try to use webpage_url if non-existentRicardo Constantino2018-01-111-1/+1
|
* ytdl_hook: actually use the script option from 87d3af6Ricardo Constantino2018-01-071-1/+1
|
* ytdl_hook: add script option to revert to trying youtube-dl firstRicardo Constantino2018-01-071-2/+3
| | | | | Should only make a difference if most of the URLs you open need youtube-dl parsing.
* ytdl_hook: check for possible infinite loop in playlist generationRicardo Constantino2018-01-061-7/+8
|
* ytdl_hook: add additional check for comedycentral urlsRicardo Constantino2018-01-061-1/+2
| | | | | | | If this breaks another site again, remove this whole if and just leave them as separate playlist items. Close #5364
* ytdl_hook: update obsolete warning about retrying URL if failedRicardo Constantino2018-01-041-1/+1
|
* osc: add seekbarkeyframes as a user optiondudemanguy2018-01-031-2/+3
|
* player: add on_load_fail hookRicardo Constantino2018-01-021-1/+1
|
* osc: check if demuxer cache has not reached eofRicardo Constantino2018-01-021-3/+3
| | | | Avoids flickering stream cache status while filling the demuxer cache.
* ytdl_hook: fix single-entry playlistsRicardo Constantino2018-01-021-9/+8
| |