summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* player: fix outdated commentwm42020-07-091-3/+1
|
* player: warn if both proper and compat. config directories existwm42020-06-251-2/+11
| | | | | No idea why there's logic to add them all to the search path, so "both" are used. In any case, this isn't something anyone should use.
* player: make unpausing directly after seek work with --keep-open (again)wm42020-06-101-0/+3
| | | | | | | | | | | | Commit fcf0b80dc9dd3 fixed this the first time. Commit 85576f31a9cc2 "accidentally" removed this code again. The commit message justifying the removal is correct, except it doesn't take other side-effects of the state machine into account. I obviously didn't remember what exactly this was about. So add a comment explaining it this time. Just apply it again; the thing the latter commit fixed still works. Fixes: #7819
* build: fix another breakagewm42020-06-041-1/+1
| | | | | | | The build was still broken. Feel free to look for a better maintainer if you don't like it. Fixes: #7802 (maybe now?)
* build: change filenames of generated fileswm42020-06-043-8/+8
| | | | Force them into a more consistent naming schema.
* audio: redo internal AO APIwm42020-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This affects "pull" AOs only: ao_alsa, ao_pulse, ao_openal, ao_pcm, ao_lavc. There are changes to the other AOs too, but that's only about renaming ao_driver.resume to ao_driver.start. ao_openal is broken because I didn't manage to fix it, so it exits with an error message. If you want it, why don't _you_ put effort into it? I see no reason to waste my own precious lifetime over this (I realize the irony). ao_alsa loses the poll() mechanism, but it was mostly broken and didn't really do what it was supposed to. There doesn't seem to be anything in the ALSA API to watch the playback status without polling (unless you want to use raw UNIX signals). No idea if ao_pulse is correct, or whether it's subtly broken now. There is no documentation, so I can't tell what is correct, without reverse engineering the whole project. I recommend using ALSA. This was supposed to be just a simple fix, but somehow it expanded scope like a train wreck. Very high chance of regressions, but probably only for the AOs listed above. The rest you can figure out from reading the diff.
* lua: windows got what users cravewm42020-05-271-0/+3
| | | | | | It's got '\r's. Fixes: #7733
* player: add --term-title optionwm42020-05-252-0/+17
| | | | | | | | | | | | | | This simply printf()s a concatenation of the provided string and the relevant escape sequences. No idea what exactly defines this escape sequence (is it just a xterm thing that is now supported relatively widely?), and this simply uses information provided on the linked github issue. Not much of an advantage over --term-status-msg, though at least this can have a lower update frequency. Also I may consider setting a default value, and then it shouldn't conflict with the status message. Fixes: #1725
* player: remove some display-adrop leftoverswm42020-05-233-13/+0
| | | | | Forgotten in one of the previous commits. Also undeprecates display-adrop since it's out of sight now.
* command: fix dump-cache parameter parsingwm42020-05-231-2/+4
| | | | | | Commit 9d32d62b615 broke this when it changed OPT_TIME. I simply forgot to adjust the command definition. The effect was that "no" was not accepted as value.
* audio: redo video-sync=display-adropwm42020-05-232-35/+8
| | | | | | | | | | | | | | | | | This mode drops or repeats audio data to adapt to video speed, instead of resampling it or such. It was added to deal with SPDIF. The implementation was part of fill_audio_out_buffers() - the entire function is something whose complexity exploded in my face, and which I want to clean up, and this is hopefully a first step. Put it in a filter, and mess with the shitty glue code. It's all sort of roundabout and illogical, but that can be rectified later. The important part is that it works much like the resample or scaletempo filters. For PCM audio, this does not work on samples anymore. This makes it much worse. But for PCM you can use saner mechanisms that sound better. Also, something about PTS tracking is wrong. But not wasting more time on this.
* options: add option to control display-sync factorwm42020-05-231-3/+4
| | | | | | | | Can be useful to force it to adapt to extreme speed changes, while a higher limit would just use a fraction closer to the original video speed. Probably useful for testing only.
* command: save state on stop when user requested save-position-on-quitMikhail Rudenko2020-05-201-0/+7
| | | | | | | | Execution of "stop" command in the case when idle mode was not enabled resulted in player termination scenario not honoring user setting "save-position-on-quit" from config file. This patch addresses the issue by checking for "save-position-on-quit" in cmd_stop and saving state when idle mode is not enabled.
* video: clean up some imgfmt related stuffwm42020-05-181-2/+0
| | | | | | | | | | | | | | | | Remove the vaguely defined plane_bits and component_bits fields from struct mp_imgfmt_desc. Add weird replacements for existing uses. Remove the bytes[] field, replace uses with bpp[]. Fix some potential alignment issues in existing code. As a compromise, split mp_image_pixel_ptr() into 2 functions, because I think it's a bad idea to implicitly round, but for some callers being slightly less strict is convenient. This shouldn't really change anything. In fact, it's a 100% useless change. I'm just cleaning up what I started almost 8 years ago (see commit 00653a3eb052). With this I've decided to keep mp_imgfmt_desc, just removing the weird parts, and keeping the saner parts.
* stats: UP/DOWN scrolling on page 2 (frame stats)Julian2020-05-171-2/+24
| | | | | | Code contributed by @avih with only minor modifications to comments by me. Fixes #7727.
* osc: fix hovering timestamp sticking around when moving mouse awaywm42020-05-161-3/+11
| | | | | | | | | | | | | | The OSC calls this "tooltip" (and although a general mechanism, there's only one instance using it). One particular problem was that with the default OSC layout, moving the mouse down and out of the window, the tooltip stuck around, because the returned mouse position was the last pixel row in the window, which still overlaps with the seek bar. Instead of introducing mouse_in_window, you could check last_mouse_X for nil, but I think this is clearer. This returns (-1, -1) to the caller if the mouse is outside. Kind of random, but works.
* scripting: make socket FD number for subprocesses dynamicwm42020-05-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Before this, we pretty much guaranteed that --mpv-ipc-fd=3 would be passed. The FD was hardcoded, so scripts started by this mechanism didn't need to actually parse the argument. Change this to using a mostly random FD number instead. I decided to do this because posix_spawnp() and the current replacement cannot "guarantee" a FD layout. posix_spawn_file_actions_adddup2() just runs dup2() calls, so it may be hard to set FD 3/4 if they are already used by something else. For example imagine trying to map: {.fd = 3, .src_fd = 4}, {.fd = 4, .src_fd = 3}, Then it'd do dup2(4, 3), dup2(3, 4) (reminder: dup2(src, dst)), and the end result is that FD 4 really maps to the original FD 4. While this was not a problem in the present code, it's too messy that I don't want to pretend it can always done this way without an unholy mess. So my assumption is that FDs 0-2 can be freely assigned because they're never closed (probably...), while for all other FDs only pass-through is reasonable.
* scripting: correct passing FDswm42020-05-151-1/+1
| | | | | For external scripts/processes which use IPC. The mistake didn't really matter.
* command: add input-key-list propertywm42020-05-141-0/+15
| | | | Fixes: #7698
* command: add property to return text subtitles in ASSwm42020-05-142-8/+23
| | | | | | | | | See manpage additions. This was requested, sort of. Although what has been requested might be something completely different. So this is speculative. This also changes sub_get_text() to return an allocated copy, because the buffer shit was too damn messy.
* js: mp.set_osd_ass: ignore identical inputs (match ccbb8b1c)Avi Halachmi (:avih)2020-05-101-0/+5
|
* lua: do not use Lua filesystem functions for loading scriptswm42020-05-101-3/+6
| | | | | | | | | | | Bill Gates did not only create COVID, he's also responsible for the world's worst OS, where you have to literally jump through hoops of fire to open files with Unicode file names. Lua did not care to implement any jumping, so it's our turn to jump. Untested (on win32). Fixes: #7701
* player: make external subtitle auto-loading stricterwm42020-05-091-24/+39
| | | | | | | | | | | | | | | | | | | | | | | | | By default --sub-auto uses "exact". This was far from an "exact" match, because it added anything that started with the video filename (without extension), and seemed to end in something that looked like a language code. Make this stricter. "exact" still tolerate a language code, but the video's filename must come before it without any unknown extra characters. This may not load subtitles in some situations where it previously did, and where the user might think that the naming convention is such that it should be considered an exact match. The subtitle priority sorting seems a bit worthless. I suppose it may have some value in higher "fuzz" modes (like --sub-auto=fuzzy). Also remove the mysterious "prio += prio;" line. I probably shouldn't have checked, but it goes back to commit f16fa9d31 (2003), where someone wanted to "refine" the priority without changing the rest of the code or something. Mostly untested, so have fun. Fixes: #7702
* player: round position percentage to the nearest integerRicardo Garcia2020-05-011-1/+1
| | | | | | This brings the displayed percentage closer to the exact number and allows mpv to more frequently display 100% when it finishes playing a typical video or audio file.
* lua: restore change detection with legacy OSD functionwm42020-05-011-4/+9
| | | | | | | | | | mp.set_osd_ass() (which was undocumented, or in other words, was not supposed to be used by external scripts) used to do change detection in the mpv C code. If the resolution or payload did not change, it was not re-rendered on the lower levels. Apparently this made some people sad, so fix it. (But only after I told them to fuck off.) (Well I didn't put it this way, but still.)
* video: make OSD/subtitle bitmaps refcounted (sort of)wm42020-04-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making OSD/subtitle bitmaps refcounted was planend a longer time ago, e.g. the sub_bitmaps.packed field (which refcounts the subtitle bitmap data) was added in 2016. But nothing benefited much from it, because struct sub_bitmaps was usually stack allocated, and there was this weird callback stuff through osd_draw(). Make it possible to get actually refcounted subtitle bitmaps on the OSD API level. For this, we just copy all subtitle data other than the bitmaps with sub_bitmaps_copy(). At first, I had planned some fancy refcount shit, but when that was a big mess and hard to debug and just boiled to emulating malloc(), I made it a full allocation+copy. This affects mostly the parts array. With crazy ASS subtitles, this parts array can get pretty big (thousands of elements or more), in which case the extra alloc/copy could become performance relevant. But then again this is just pure bullshit, and I see no need to care. In practice, this extra work most likely gets drowned out by libass murdering a single core (while mpv is waiting for it) anyway. So fuck it. I just wanted this so draw_bmp.c requires only a single call to render everything. VOs also can benefit from this, because the weird callback shit isn't necessary anymore (simpler code), but I haven't done anything about it yet. In general I'd hope this will work towards simplifying the OSD layer, which is prerequisite for making actual further improvements. I haven't tested some cases such as the "overlay-add" command. Maybe it crashes now? Who knows, who cares. In addition, it might be worthwhile to reduce the code duplication between all the things that output subtitle bitmaps (with repacking, image allocation, etc.), but that's orthogonal.
* stats.lua: don't disable terminal escape sequences on windowsAvi Halachmi (:avih)2020-04-231-22/+4
| | | | | | | | | | | | | | | | | | | | | When stats.lua is used without a video window then it uses the terminal. On Windows, however, so far it disabled ansi escape sequences and used plaintext unless ANSICON env is set. It's unclear why it's disabled on windows, because at the time it was added it only used bold by default and mpv ansi emulation on windows already supported bold at that time. We can guess that it was disabled because if the same config is used on both linux and Windows, and it had complex escape sequences for stats.lue, then it would be emulated incorrectly on Windows. This shouldn't be an issue anymore, as the last two commits both enhance the emulation to be quite complete (and graceful where it's not), and also enable the much-more complete native VT terminal when possible (Windows 10). Just remove this windows exception at stats.lua.
* stats: move chapter/edition info below titleLaserEyess2020-04-161-3/+3
| | | | | | | | It is more consistent for editions/chapters to go below either the title or filename. They are all descriptive strings about the media itself and not file metadata like filesize. Suggested by Argon-
* stats: add edition information to page 1LaserEyess2020-04-161-1/+13
| | | | | | Edition information is conditional based on there being more than one edition present. It is printed on the same line as Chapters to save vertical space.
* player: remove duplicated track option setter codewm42020-04-153-17/+11
| | | | Well whatever.
* player: slightly improve use of secondary track selection limitswm42020-04-155-20/+27
| | | | | | Apparently, this was a bit of a mess, which caused the bug fixed by commit ec7f2388af2df. Try to improve this, and only use track selection entries that exist.
* player: remove mysterious declarationwm42020-04-151-2/+0
| | | | ??????????
* player: don't segfault when unloading tracksNiklas Haas2020-04-151-0/+2
| | | | | | | | | e1e714ccc introduced a regression here when unloading a track (e.g. on VO/AO initilization error), due to no corresponding option existing for video/audio tracks with orders above 0, but the loop in `mp_deselect_track` being hard-coded to clear tracks up to NUM_PTRACKS. Introduce the simplest possible hackaround.
* player: do not fall back to a default track with explicit selectionswm42020-04-131-0/+2
| | | | | | | | | | | | | | | | | | Consider e.g. --aid=2 with a file that has only 1 track. Then it would fall back to selecting track 1. Stop doing this. If no matching track is found, this will not select any track now. Note that the fingerprint stuff (track_layout_hash in the source) prevents softens the impact of this change. Without the fingerprint, playing a dual-audio file with the second track selected, and then a single-audio file, would play the second file without audio. But the fingerprint resets it due to differences in the track list. Try to exhaustively document this and tricky interactions between the other features. What a damn mess, I think it's simply cursed. Of course it's still my fault. See: #7608
* player: mess with track selection details againwm42020-04-131-12/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some time ago, properties and options were mostly unified. However, the track selection properties/options semantics are incompatible to this change. I'm still trying to handle the fallout. There are two things that are in the way: 1. Track properties somehow return the runtime selection, not the option value (all while properties are supposed to be aliases to options with the same name). 2. The user's track options are not supposed to be changed without interaction. If a track is auto-selected, the property should return its ID, but the option value should remain at "auto". Only if the user actually writes to the property the option should change. E.g. playing e.g. an audio-only file and then a normal video file not play the video file with --vid=no just because the audio file had no video track. In addition to each of them being in conflict with the property/option unification, attempt to fix one of them breaks the other one. Today, we're trying to fix parts of this and avoiding an unfortunate case where you can get a conflicting option/property value, and where trying to select a track does nothing if the track to select has the same ID as the option value. This breaks 2. from above in certain situations. See manpage additions. See: #7608
* player, ta: remove use of an old macrowm42020-04-131-1/+1
| | | | | I thought that would make a nice idiom, but it ended up being useless or clunky.
* command: print edition title to OSD when cyclingLaserEyess2020-04-131-5/+26
| | | | | | Edition title is already exposed in demux_edition, it was just never added to the display. If no edition title exists it will fall back to the edition number.
* stats: support UP/DOWN to scroll at page 4 (perf)Avi Halachmi (:avih)2020-04-111-12/+68
| | | | | | | | | | | | | | Keys and lines-to-scroll are configurabe, and the scroll keys are only bound on pages which support scrolling (currently only page 4) - also during oneshot (like the page-switching keys). Scroll offset is reset for all pages on any key - except scroll keys, so that entering or switching to a page resets the scroll, as well as when "re-entering" the same page or "re-activating" the stats oneshot view. TODO: print_page(..) is highly associated with extending the oneshot timer if required. The timer handling can probably move into print_page and removed from all the places which boilerplate its management.
* console: reduce memory usage in default modewm42020-04-101-73/+82
| | | | | | | | | | | | | | | This used 1 MB due to building the complete command and property list when starting the script. These are needed only for auto-completion, so build them only on demand. Since building them is fast enough, rebuild them every time. The key bindings table is not that much, but saves some KBs. Oddly, the code to build it uses less memory than the table at runtime (???), so build it at runtime as well. Add 2 tactic collectgarbage() calls as well. This frees unused heap when it is known that the script is going to be completely inactive until re-enabled by the user.
* video: remove another redundant wakeupwm42020-04-101-1/+3
| | | | | | | | | | | | | | | The wakeup at the end of VO frame rendering seems redundant, because after rendering almost no state changes. The player core can queue a new frame once frame rendering begins, and there's a separate wakeup for this. The only thing that actually changes is in->rendering. The only thing that seems to depend on it and can trigger a wakeup is the vo_still_displaying() function. Change it so that it needs an explicit call to a new API function, so we can avoid wakeups in the common case. The vo_still_displaying() code is mostly just moved around due to locking and for avoiding forward declarations. Also a somewhat risky change (tasty new bugs).
* video: avoid redundant self-wakeup on each queued framewm42020-04-101-1/+2
| | | | | | | | | This should be unnecessary, since the VO itself performs wakeups once a new frame can be queued. The only situation I can think of where this might be required are EOF situations (which are always strange). If I'm wrong, there'll be fun new bugs, probably causing frame drops or temporary stalls.
* player, stats: more silly debug stuffwm42020-04-104-2/+7
| | | | | In addition to stats.c being gross, I don't think master branch code should be littered with debug code. But it's a helpful abomination.
* stats: fix crash if both plot_vsync_* options are disabledwm42020-04-091-3/+6
| | | | | | | | | | | In this case, init_buffers() was not called, and the unrelated cache sample buffers were not initialized. It appears they are indeed completely unrelated, so move their initialization away. Not sure what exactly the purpose of calling init_buffers() is, maybe clearing old data when displaying stats again. The new place for initializing the cache sample buffers should achieve the same anyway. Fixes: #7597
* player: do not deinitialize AO on track switchingwm42020-04-091-1/+2
| | | | | | | | This should make it behave roughly like when switching from a file to the next (clearing audio buffers, keeping AO, but closing AO if the audio format seems to have changed and gapless mode is "weak"). Not necessarily useful, but harmless and may help with #7579 (untested).
* lua: wrap existing allocator instead of reimplementing itNiklas Haas2020-04-091-16/+12
| | | | | | | | This is the proper fix for 1e7802. Turns out the solution is dead simple: we can still set the allocator with lua_getallocf / lua_setalloc. This commit makes memory accounting work on luajit as well.
* lua: disable memory accounting for luajitNiklas Haas2020-04-091-0/+7
| | | | | | | | This is a stopgap measure. In theory we could maybe poll the memory usage on luajit, but for now, simply reverting this part of fd3caa26 makes Lua work again. (And we can still collect cpu usage metrics) Proper solution pending (tm)
* ipc: add --input-ipc-client optionwm42020-04-091-1/+1
| | | | | | | | | While --input-file was removed for justified reasons, wanting to pass down socket FDs this way is legitimate, useful, and easy to implement. One odd thing is that Fixes: #7592
* stats: some more performance graphswm42020-04-095-7/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an infrastructure for collecting performance-related data, use it in some places. Add rendering of them to stats.lua. There were two main goals: minimal impact on the normal code and normal playback. So all these stats_* function calls either happen only during initialization, or return immediately if no stats collection is going on. That's why it does this lazily adding of stats entries etc. (a first iteration made each stats entry an API thing, instead of just a single stats_ctx, but I thought that was getting too intrusive in the "normal" code, even if everything gets worse inside of stats.c). You could get most of this information from various profilers (including the extremely primitive --dump-stats thing in mpv), but this makes it easier to see the most important information at once (at least in theory), partially because we know best about the context of various things. Not very happy with this. It's all pretty primitive and dumb. At this point I just wanted to get over with it, without necessarily having to revisit it later, but with having my stupid statistics. Somehow the code feels terrible. There are a lot of meh decisions in there that could be better or worse (but mostly could be better), and it just sucks but it's also trivial and uninteresting and does the job. I guess I hate programming. It's so tedious and the result is always shit. Anyway, enjoy.
* stats: fix previous commitwm42020-04-031-2/+2
| | | | | The previous commit included a rendering error of the "Speed:" line, caused by incorrect copy&paste.
* stats: move input speed to cache page, make it a graphwm42020-04-031-13/+12
| | | | | | | I think that makes more sense. And also remove the graph from the t