summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* osc: fix rare stack overflow when changing visibility modeAvi Halachmi (:avih)2017-09-231-1/+6
| | | | | | | | | | | | | Under some conditions, hide_osc() was calling render(), which then called hide_osc() again, and so forth, until the stack overflows. Tracking the exact conditions where this happens (and then managing them to prevent it) is an excercise in futility. Remove the osc directly - instead of going through the entire rendering procedure just to end up rendering nothing. Fixes #4900 .
* js: fix broken mp.set_property_number, mp.set_property_nativeAvi Halachmi (:avih)2017-09-231-2/+2
| | | | | | Also implicitly fixes memory leak when mp.set_property_native was used, because the cleanup did not expect more allocations from the accidental use of mpv_get_property.
* vo_opengl: refactor into vo_gpuNiklas Haas2017-09-211-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done in several steps: 1. refactor MPGLContext -> struct ra_ctx 2. move GL-specific stuff in vo_opengl into opengl/context.c 3. generalize context creation to support other APIs, and add --gpu-api 4. rename all of the --opengl- options that are no longer opengl-specific 5. move all of the stuff from opengl/* that isn't GL-specific into gpu/ (note: opengl/gl_utils.h became opengl/utils.h) 6. rename vo_opengl to vo_gpu 7. to handle window screenshots, the short-term approach was to just add it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to ra itself (and vo_gpu altered to compensate), but this was a stop-gap measure to prevent this commit from getting too big 8. move ra->fns->flush to ra_gl_ctx instead 9. some other minor changes that I've probably already forgotten Note: This is one half of a major refactor, the other half of which is provided by rossy's following commit. This commit enables support for all linux platforms, while his version enables support for all non-linux platforms. Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the --opengl- options like --opengl-early-flush, --opengl-finish etc. Should be a strict superset of the old functionality. Disclaimer: Since I have no way of compiling mpv on all platforms, some of these ports were done blindly. Specifically, the blind ports included context_mali_fbdev.c and context_rpi.c. Since they're both based on egl_helpers, the port should have gone smoothly without any major changes required. But if somebody complains about a compile error on those platforms (assuming anybody actually uses them), you know where to complain.
* build: add preliminary LGPL modewm42017-09-212-4/+0
| | | | | | | See "Copyright" file for caveats. This changes the remaining "almost LGPL" files to LGPL, because we think that the conditions the author set for these was finally fulfilled.
* audio: make libaf derived code optionalwm42017-09-215-91/+241
| | | | | | | | | | | | | | | This code could not be relicensed. The intention was to write new filter code (which could handle both audio and video), but that's a bit of work. Write some code that can do audio conversion (resampling, downmixing, etc.) without the old audio filter chain code in order to speed up the LGPL relicensing. If you build with --disable-libaf, nothing in audio/filter/* is compiled in. It breaks a few features, such as --volume, --af, pitch correction on speed changes, replaygain. Most likely this adds some bugs, even if --disable-libaf is not used. (How the fuck does EOF notification work again anyway?)
* audio_buffer: remove dependency on mp_audiowm42017-09-211-22/+29
| | | | | | | | | Just reimplement it in some way, as mp_audio is GPL-only. Actually I wanted to get rid of audio_buffer.c completely (and instead have a list of mp_aframes), but to do so would require rewriting some more player core audio code. So to get this LGPL relicensing over quickly, just do some extra work.
* options: remove --heartbeat-cmd and --heartbeat--intervalwm42017-09-182-17/+0
| | | | | | | | | This mechanism uses system() and shouldn't even exist. x11_common.c has its own solution for the original problem (disabling Linux DE screensavers without MPlayer/mpv having to link a dbus lib). If that is not sufficient, you can create a simple Lua script. Incidentally fixes #4888.
* vo: avoid putting large voctrl_performance_data on stackNiklas Haas2017-09-111-10/+17
| | | | | | This is around 512 kB, which is just way too much. Heap-allocate it instead. Also cut down the max pass count to 64, since 128 was unrealistically high even for vo_opengl.
* vo_opengl: refactor/fix mp_pass_perf codeNiklas Haas2017-09-111-6/+2
| | | | | | | | | | | | | This was needlessly complicated and prone to breakage, because even the references to the ring buffer could end up getting invalidated and containing garbage data on e.g. shader cache flush. For much the same reason why we can't keep around the *timer_pool, we're also forced to hard-copy the entire sample buffer per pass per frame. Not a huge deal, though. This is, what, a few kB per frame? We have more pressing CPU performance concerns anyway. Also simplified/fixed some other code.
* ytdl_hook: resolve relative paths when joining segment urlsRicardo Constantino2017-09-031-1/+21
| | | | | FFmpeg/mpv don't do it automatically. See #4827
* audio: fix format change regressionwm42017-09-031-3/+3
| | | | | | | | Ever since the mp_aframe change, audio mid-stream format changes crash. I have no idea why the recent mp_aframe change triggers this. Didn't look too deeply into it either. It appears to work now, though. Fixes #4828.
* input: merge mouse wheel and axis keycodesJames Ross-Gowan2017-09-032-4/+2
| | | | | | | | | | | | | | | | | | | | | | Mouse wheel bindings have always been a cause of user confusion. Previously, on Wayland and macOS, precise touchpads would generate AXIS keycodes and notched mouse wheels would generate mouse button keycodes. On Windows, both types of device would generate AXIS keycodes and on X11, both types of device would generate mouse button keycodes. This made it pretty difficult for users to modify their mouse-wheel bindings, since it differed between platforms and in some cases, between devices. To make it more confusing, the keycodes used on Windows were changed in 18a45a42d524 without a deprecation period or adequate communication to users. This change aims to make mouse wheel binds less confusing. Both the mouse button and AXIS keycodes are now deprecated aliases of the new WHEEL keycodes. This will technically break input configs on Wayland and macOS that assign different commands to precise and non-precise scroll events, but this is probably uncommon (if anyone does it at all) and I think it's a fair tradeoff for finally fixing mouse wheel-related confusion on other platforms.
* input: use mnemonic names for mouse buttonsJames Ross-Gowan2017-09-032-49/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv's mouse button numbering is based on X11 button numbering, which allows for an arbitrary number of buttons and includes mouse wheel input as buttons 3-6. This button numbering was used throughout the codebase and exposed in input.conf, and it was difficult to remember which physical button each number actually referred to and which referred to the scroll wheel. In practice, PC mice only have between two and five buttons and one or two scroll wheel axes, which are more or less in the same location and have more or less the same function. This allows us to use names to refer to the buttons instead of numbers, which makes input.conf syntax a lot easier to remember. It also makes the syntax robust to changes in mpv's underlying numbering. The old MOUSE_BTNx names are still understood as deprecated aliases of the named buttons. This changes both the input.conf syntax and the MP_MOUSE_BTNx symbols in the codebase, since I think both would benefit from using names over numbers, especially since some platforms don't use X11 button numbering and handle different mouse buttons in different windowing system events. This also makes the names shorter, since otherwise they would be pretty long, and it removes the high-numbered MOUSE_BTNx_DBL names, since they weren't used. Names are the same as used in Qt: https://doc.qt.io/qt-5/qt.html#MouseButton-enum
* command: restore OSD marker for video equalizer propertieswm42017-08-231-7/+8
| | | | | | | Commit 03cf150ff3516 accidentally dropped these. Readd them in a simpler way (so only a property_osd_display[] entry is enough). This commit doesn't actually touch the video equalizer properties, because the default value of 0 for the marker is what they require anyway.
* video: change --deinterlace behaviorwm42017-08-223-89/+9
| | | | | | | | | | | | This removes all GPL only code from it, and that's the whole purpose. Also happens to be much simpler. The "deinterlace" option still sort of exists, but only as runtime changeable option. The main change in behavior is that the property will not report back the actual deint state. Or in other words, if inserting or initializing the filter fails, the deinterlace property will still return "yes". This is in line with most recent behavior changes to properties and options.
* video: redo video equalizer option handlingwm42017-08-222-112/+1
| | | | | | | | | | | | | | | | | | | | | | | I really wouldn't care much about this, but some parts of the core code are under HAVE_GPL, so there's some need to get rid of it. Simply turn the video equalizer from its current fine-grained handling with vf/vo fallbacks into global options. This makes updating them much simpler. This removes any possibility of applying video equalizers in filters, which affects vf_scale, and the previously removed vf_eq. Not a big loss, since the preferred VOs have this builtin. Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and vo_xv. I'm not going to waste my time on these legacy VOs. vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which exists _only_ to trigger a redraw. This seems silly, but for now I feel like this is less of a pain. The rest of the equalizer using code is self-updating. See commit 96b906a51d5 for how some video equalizer code was GPL only. Some command line option names and ranges can probably be traced back to a GPL only committer, but we don't consider these copyrightable.
* options: add a thread-safe way to notify option updateswm42017-08-221-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, we had a thread-safe way to read options, but no option update notification mechanism. Everything was funneled though the main thread's central mp_option_change_callback() function. For example, if the panscan options were changed, the function called vo_control() with VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This worked, but's pretty inconvenient. Most of these problems come from the fact that MPlayer was written as a single-threaded program. This commit works towards a more flexible mechanism. It adds an update callback to m_config_cache (the thing that is already used for thread-safe access of global options). This alone would still be rather inconvenient, at least in context of VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and takes care of some annoying synchronization issues. We extend mp_dispatch_queue itself to make this easier and slightly more efficient. As a first application, use this to reimplement certain VO scaling and renderer options. The update_opts() function translates these to the "old" VOCTRLs, though. An annoyingly subtle issue is that m_config_cache's destructor now releases pending notifications, and must be released before the associated dispatch queue. Otherwise, it could happen that option updates during e.g. VO destruction queue or run stale entries, which is not expected. Rather untested. The singly-linked list code in dispatch.c is probably buggy, and I bet some aspects about synchronization are not entirely sane.
* audio: introduce a new type to hold audio frameswm42017-08-168-73/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is pretty pointless, but I believe it allows us to claim that the new code is not affected by the copyright of the old code. This is needed, because the original mp_audio struct was written by someone who has disagreed with LGPL relicensing (it was called af_data at the time, and was defined in af.h). The "GPL'ed" struct contents that surive are pretty trivial: just the data pointer, and some metadata like the format, samplerate, etc. - but at least in this case, any new code would be extremely similar anyway, and I'm not really sure whether it's OK to claim different copyright. So what we do is we just use AVFrame (which of course is LGPL with 100% certainty), and add some accessors around it to adapt it to mpv conventions. Also, this gets rid of some annoying conventions of mp_audio, like the struct fields that require using an accessor to write to them anyway. For the most part, this change is only dumb replacements of mp_audio related functions and fields. One minor actual change is that you can't allocate the new type on the stack anymore. Some code still uses mp_audio. All audio filter code will be deleted, so it makes no sense to convert this code. (Audio filters which are LGPL and which we keep will have to be ported to a new filter infrastructure anyway.) player/audio.c uses it because it interacts with the old filter code. push.c has some complex use of mp_audio and mp_audio_buffer, but this and pull.c will most likely be rewritten to do something else.
* player: make refresh seeks slightly more robustwm42017-08-146-33/+40
| | | | | | | | | | | | | | | | | | | | | | Refresh seeks are automatically issued when changing filters, which improves user experience if these filters change buffering or such. The refresh seek could actually overwrite a previously ongoing seek: set pause yes set time-pos 10 set vf "" Here, the video code issued a refresh seek to the previous video position, which could be different from the previously triggered (and still ongoing) seek, this overwriting the seek. Factor all refresh seek handling into a new function, and make it handle ongoing seeks correctly. Remove the weird new canonical_pts field, which actually had no use. Fixes #4757.
* player: do not destroy VO immediately if there is no video trackwm42017-08-141-1/+0
| | | | | | | | | | | Commit f1d161d55f45 accidentally added the handle_force_window() call if no track is selected. This was OK, but breaks something like "mpv *", where some files are not playable (like subtitle files) - the unplayable files would remove and recreate the VO window, which is annoying. Just drop the call again.
* player: add --track-auto-selection optionwm42017-08-121-2/+2
| | | | I imagine this is useful. Or maybe it isn't.
* player: fix another audio resync issuewm42017-08-121-1/+1
| | | | | | | | | | | This oddly triggers bogus EOF when switching filter graphs between two audio files (in this case, "[vid1]f[vo];[aid2]f[ao]"->"[aid1]f[ao]", with aid2 being an external audio source). This commit also fixes desync when seeking with an external file connected via --lavfi-complex. (Yes, the audio resync code is cursed.)
* player: make --lavfi-complex changeable at runtimewm42017-08-128-97/+182
| | | | | | | | Tends to be somewhat glitchy if subtitles are enabled, and you enable and disable tracks. On error, this will disable --lavfi-complex, which will result in whatever behavior.
* player: fix --lavfi-complex freezewm42017-08-113-5/+8
| | | | | | | | | | | | | | | | | | | Commit 0e0b87b6f3297 fixed that dropped packets did not trigger further work correctly. But it also made trivial --lavfi-complex freeze. The reason is that the meaning if DATA_AGAIN was overloaded: the decoders meant that they should be called again, while lavfi.c meant that other outputs needed to be checked again. Rename the latter meaning to DATA_STARVE, which means that the current input will deliver no more data, until "other" work has been done (like reading other outputs, or feeding input). The decoders never return DATA_STARVE, because they don't get input from the player core (instead, they get it from the demuxer directly, which is why they still can return DATA_WAIT). Also document the DATA_* semantics in the enum. Fixes #4746.
* player: fix confusion in audio resync codewm42017-08-081-2/+6
| | | | | | | | | | Just the audio resync code in its normal state: buggy. This time, AD_NO_PROGRESS was handled about the same as AD_WAIT. But it means the decoder didn't output data, even though input is still readily available. This happened in particular when the timeline code was used (potentially skipping many packets), and thus should fix #4688.
* player: fix --end with large valueswm42017-08-081-2/+5
| | | | | | Causea a simple integer overflow. Fixes #4650.
* player: readd smi subtitle extensionwm42017-08-081-1/+1
| | | | | | | Fixes #4626. Previously removed because the original smi entry was added by someone who did not agree to LGPL relicensing. I'm not sure if the original change was copyrightable, but this commit for sure does not fall under that author's copyright.
* ytdl_hook: support fragments with relative pathsRicardo Constantino2017-08-061-5/+16
| | | | | | | Unbreaks segmented DASH with the change in https://github.com/rg3/youtube-dl/commit/1141e9104 which made each segment URL only use relative path from fragment_base_url with a different key.
* options: --priority can be LGPLwm42017-08-031-1/+1
| | | | | | | Original author has agreed now. Also fix the notice in dec_video.c - all GPL-only code is gone (unrelated to --priority/its author).
* vo_opengl: add direct rendering supportwm42017-07-241-0/+1
| | | | | | | | | | | | | | | | | | | | Can be enabled via --vd-lavc-dr=yes. See manpage additions for what it does. This reminds of the MPlayer -dr flag, but the implementation is completely different. It's the same basic concept: letting the decoder render into a GPU buffer to avoid a copy. Unlike MPlayer, this doesn't try to go through filters (libavfilter doesn't support this anyway). Unless a filter can work in-place, DR will be silently disabled. MPlayer had very complex semantics about buffer types and management (which apparently nobody ever understood) and weird restrictions that mostly limited it to mpeg2 style codecs. The mpv code does not do any of this, and just lets the decoder allocate an arbitrary number of untyped images. (No MPlayer code was used.) Parts of the code based on work by atomnuker (starting point for the generic code) and haasn (some GL definitions, some basic PBO code, and correct fencing).
* input: drop deprecated "osd" commandwm42017-07-211-22/+0
| | | | | Complicated situation due to changes by GPL-only author, but also unnecessary due to newer mechanisms.
* ytdl_hook: add a header to support geo-bypassJagannathan Tiruvallur Eachambadi2017-07-161-1/+1
| | | | | | youtube-dl supports bypassing some geographic restrictions by setting X-Forwarded-For header when used with geo-bypass and geo-bypass-country.
* player: change default section when loading encoding-profiles.confwm42017-07-121-3/+3
| | | | | | | It used to use the "encoding" section. Change this to the default section to remove another small special case. encoding-profiles.conf didn't use this by default anyway. The previous revert could mitigate potential impacts of this a little.
* Revert "player: always load encoding-profiles.conf"wm42017-07-121-3/+3
| | | | | | | | | | This reverts commit 0dcb51c7fa2c676ec30f2bac216f904dfc4ffa6f. I randomly decided that this was better. It can be re-applied once it actually becomes necessary in some way. Note that this worked fine. My main gripe with this is that it can spam the log file with encoding stuff even if playback mode is used.
* ytdl_hook: actually load the script-optsRicardo Constantino2017-07-111-5/+7
| | | | | Also, comma-separated list doesn't actually work, even quote-surrounded. Switch to using | instead.
* ytdl_hook: add option to exclude URLs from being parsedRicardo Constantino2017-07-111-4/+30
| | | | | | | | | This is more of a niche usecase than --ytdl-format and --ytdl-raw-options, so a simple script option should be enough. Either create lua-settings/ytdl_hook.conf with 'exclude=example.com,sub.example.com' option or "--script-opts=ytdl_hook-exclude=example.com,sub.example.com"
* ytdl_hook: add times for ytdl and hook running on debug-levelRicardo Constantino2017-07-111-0/+3
| | | | Not really important, but still interesting to know.
* js: utils.getenv(): fix crash on undefined varAvi Halachmi (:avih)2017-07-061-1/+6
|
* command: add missing change notification for playlist-shufflewm42017-07-041-0/+1
| | | | Fixes #4573.
* ytdl_hook: add pre-parsed chapters, if availableRicardo Constantino2017-07-021-3/+13
| | | | Available since 2017.05.07 but only on certain extractors.
* options: change everything againwm42017-07-021-1/+48
| | | | Fucking bullshit.
* m_option: remove redundant indirectionswm42017-07-021-1/+1
| | | | | | Remove the various redundant m_config_set_option* calls, rename the remaining one to m_config_set_option_cli(), and merge the m_config_parse_option() function.
* vo_opengl: refactor vo performance subsystemNiklas Haas2017-07-011-14/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces `vo-performance` by `vo-passes`, bringing with it a number of changes and improvements: 1. mpv users can now introspect the vo_opengl passes, which is something that has been requested multiple times. 2. performance data is now measured per-pass, which helps both development and debugging. 3. since adding more passes is cheap, we can now report information for more passes (e.g. the blit pass, and the osd pass). Note: we also switch to nanosecond scale, to be able to measure these passes better. 4. `--user-shaders` authors can now describe their own passes, helping users both identify which user shaders are active at any given time as well as helping shader authors identify performance issues. 5. the timing data per pass is now exported as a full list of samples, so projects like Argon-/mpv-stats can immediately read out all of the samples and render a graph without having to manually poll this option constantly. Due to gl_timer's design being complicated (directly reading performance data would block, so we delay the actual read-back until the next _start command), it's vital not to conflate different passes that might be doing different things from one frame to another. To accomplish this, the actual timers are stored as part of the gl_shader_cache's sc_entry, which makes them unique for that exact shader. Starting and stopping the time measurement is easy to unify with the gl_sc architecture, because the existing API already relies on a "generate, render, reset" flow, so we can just put timer_start and timer_stop in sc_generate and sc_reset, respectively. The ugliest thing about this code is that due to the need to keep pass information relatively stable in between frames, we need to distinguish between "new" and "redrawn" frames, which bloats the code somewhat and also feels hacky and vo_opengl-specific. (But then again, this entire thing is vo_opengl-specific)
* scripting: add wrapper to load scripts with user pathsRicardo Constantino2017-06-303-6/+12
| | | | | Fixes regression since b2f756c80e, which broke load-script command when used with user paths (ex: ~~/script.lua)
* client API: change mpv_create() behavior, run init always on mpv threadwm42017-06-301-16/+24
| | | | | | This takes car eof unsubtle bugs if something at init does not work (specifically if mp_new_client() returns NULL). It also removes the need for that PMP MF hack.
* Universal Windows Plaform (UWP) supportPedro Pombeiro2017-06-291-0/+2
| | | | | | | | libmpv only. Some things are still missing. Heavily reworked. Signed-off-by: wm4 <wm4@nowhere>
* build: change how some OS specific source files are selectedwm42017-06-291-1/+1
| | | | | | | | | | | | | | | | | | In a bunch of cases, we emulate highly platform specific APIs on a higher level