summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* client API: deprecate opengl-cb API and introduce a replacement APIwm42018-02-286-35/+155
| | | | | | | | | | | | | | | | | | | | | | | | | The purpose of the new API is to make it useable with other APIs than OpenGL, especially D3D11 and vulkan. In theory it's now possible to support other vo_gpu backends, as well as backends that don't use the vo_gpu code at all. This also aims to get rid of the dumb mpv_get_sub_api() function. The life cycle of the new mpv_render_context is a bit different from mpv_opengl_cb_context, and you explicitly create/destroy the new context, instead of calling init/uninit on an object returned by mpv_get_sub_api(). In other to make the render API generic, it's annoyingly EGL style, and requires you to pass in API-specific objects to generic functions. This is to avoid explicit objects like the internal ra API has, because that sounds more complicated and annoying for an API that's supposed to never change. The opengl_cb API will continue to exist for a bit longer, but internally there are already a few tradeoffs, like reduced thread-safety. Mostly untested. Seems to work fine with mpc-qt.
* audio: improve behavior if filters output nothing during probingwm42018-02-211-0/+5
| | | | | | | | | | Just bail out immediately (and disable audio) if format probing has no result, instead of doing nothing and then apparently freezing. This can happen with bogus filters, cases where the first audio frame is essentially dropped by filters (can happen with large resampling factors), and if the audio track contains no packets at all, or all packets fail to decode.
* video: do not buffer extra frames with VO_CAP_NORETAIN outputsAman Gupta2018-02-171-0/+3
| | | | | | | | | | | | | | This fixes playback stalls on some mediacodec hardware decoders, which expect that frame buffers will be rendered and returned back to the decoder as soon as possible. Specifically, the issue was observed on an NVidia SHIELD Android TV, only when playing an H264 sample which switched between interlaced and non-interlaced frames. On an interlacing change, the decoder expects all outstanding frames would be returned to it before it would emit any new frames. Since a single extra frame always remained buffered by mpv, playback would stall. After this commit, no extra frames are buffered by mpv when using vo_mediacodec_embed.
* command: simplify mp_property_filter_metadatawm42018-02-161-19/+11
| | | | Also silence a dead code coverity error.
* lua+js: Implement utils.getpid()sfan52018-02-132-0/+16
| | | | | | | Usable for uniquely identifying mpv instances from subprocesses, controlling mpv with AppleScript, ... Adds a new mp_getpid() wrapper for cross-platform reasons.
* input: add a keybinding to toggle hardware decodingwm42018-02-131-0/+1
| | | | | We sure as hell won't enable hardware decoding by default, but we can make it more accessible with a key binding.
* audio: move back PTS jump detection to before filter chainwm42018-02-132-20/+4
| | | | | | | | | | | The recent changes to player/audio.c moved PTS jump detection to after audio filtering. This was mostly done for convenience, because dataflow between decoder and filters was made "automatic", and jump detection would have to be done as filter. Now move it back to after decoders, again out of convenience. The future direction is to make the dataflow between filters and AO automatic, so this is a bit in the way. Another reason is that speed changes tend to cause jumps - these are legitimate, but get annoying quickly.
* cocoa-cb: initial implementation via opengl-cb APIAkemi2018-02-122-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is meant to replace the old and not properly working vo_gpu/opengl cocoa backend in the future. the problems are various shortcomings of Apple's opengl implementation and buggy behaviour in certain circumstances that couldn't be properly worked around. there are also certain regressions on newer macOS versions from 10.11 onwards. - awful opengl performance with a none layer backed context - huge amount of dropped frames with an early context flush - flickering of system elements like the dock or volume indicator - double buffering not properly working with a none layer backed context - bad performance in fullscreen because of system optimisations all the problems were caused by using a normal opengl context, that seems somewhat abandoned by apple, and are fixed by using a layer backed opengl context instead. problems that couldn't be fixed could be properly worked around. this has all features our old backend has sans the wid embedding, the possibility to disable the automatic GPU switching and taking screenshots of the window content. the first was deemed unnecessary by me for now, since i just use the libmpv API that others can use anyway. second is technically not possible atm because we have to pre-allocate our opengl context at a time the config isn't read yet, so we can't get the needed property. third one is a bit tricky because of deadlocking and it needed to be in sync, hopefully i can work around that in the future. this also has at least one additional feature or eye-candy. a properly working fullscreen animation with the native fs. also since this is a direct port of the old backend of the parts that could be used, though with adaptions and improvements, this looks a lot cleaner and easier to understand. some credit goes to @pigoz for the initial swift build support which i could improve upon. Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739, #2392, #2217
* 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
* vo_gpu: make screenshots use the GL rendererwm42018-02-111-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | Using the GL renderer for color conversion will make sure screenshots will use the same conversion as normal video rendering. It can do this for all types of screenshots. The logic when to write 16 bit PNGs changes. To approximate the old behavior, we decide by looking whether the source video format has more than 8 bits per component. We apply this logic even for window screenshots. Also, 16 bit PNGs now always include an unused alpha channel. The reason is that FFmpeg has RGB48 and RGBA64 formats, but no RGB064. RGB48 is 3 bytes and usually not supported by GPUs for rendering, so we have to use RGBA64, which forces an alpha channel. Will break for users who use --target-trc and similar options. I considered creating a new gl_video context, but it could double GPU memory use, so I didn't. This uses FBOs instead of glGetTexImage(), because that increases the chance it could work on GLES (e.g. ANGLE). Untested. No support for the Vulkan and D3D11 backends yet. Fixes #5498. Also fixes #5240, because the code for reading back is not used with the new code path.
* player: correctly set track information on adding external filesZehua Chen2018-02-103-34/+44
| | | | | | | | Before this commit, auto_loaded and lang were only set for the first track in auto-loaded external files. Likewise, for the title and lang arguments to the sub-add and audio-add commands. Fixes #5432
* loadfile: make --lavfi-complex runtime changes more flexiblewm42018-02-031-18/+27
| | | | | | | | | Setting lavfi-complex at runtime will now forcefully reselect the tracks as needed, even if it was a "proper" track selection via --aid or --vid. Before this commit, it just failed and complained that the VO/AO was already "used". Requested.
* loadfile: initialize decoders after outputs for --lavfi-complexwm42018-02-031-37/+31
| | | | | | | This makes it actually somewhat simpler, and doesn't have any disadvantages. It should also make some new features easier. Mostly just moves code around.
* loadfile: fix crash in some cases of setting --lavfi-complex at runtimewm42018-02-031-1/+1
| | | | | | | | | The somewhat confusing thing is that many filters (including track->dec) have a public struct, but to free them, you need to free the mp_filter pointer itself (track->dec->f). The assignment wrote to a dangling pointer, instead of removing the dangling pointer. (Other than that, this idiom is actually nice.)
* loadfile: remove minor unneeded things from --lavfi-complex setupwm42018-02-031-3/+1
|
* video: fix passing down FPS to vf_vapoursynthwm42018-02-033-11/+11
| | | | | | | To make this less of a mess, remove one of the redundant container_fps fields. Part of #5470.
* codecs: remove unused family fieldwm42018-02-011-1/+0
| | | | | | | | | | MPlayer used this to distinguish multiple decoder wrappers (such as libavcodec vs. binary codec loader vs. builtin decoders). It lost meaning in mpv as non-libavcodec things were dropped. Now it doesn't serve any purpose anymore. Parsing was removed quite a while ago, and the recent filter change removed any use of the internal family field. Get rid of it.
* 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.
* audio: move to decoder wrapperwm42018-01-307-230/+75
| | | | | | | | | | | | | | | | Use the decoder wrapper that was introduced for video. This removes all code duplication the old audio decoder wrapper had with the video code. (The audio wrapper was copy pasted from the video one over a decade ago, and has been kept in sync ever since by the power of copy&paste. Since the original copy&paste was possibly done by someone who did not answer to the LGPL relicensing, this should also remove all doubts about whether any of this code is left, since we now completely remove any code that could possibly have been based on it.) There is some complication with spdif handling, and a minor behavior change (it will restrict the list of codecs to spdif if spdif is to be used), but there should not be any difference in practice.
* video: make decoder wrapper a filterwm42018-01-3010-257/+102
| | | | | | | | | | | | | | | | | | | | | | | | | Move dec_video.c to filters/f_decoder_wrapper.c. It essentially becomes a source filter. vd.h mostly disappears, because mp_filter takes care of the dataflow, but its remains are in struct mp_decoder_fns. One goal is to simplify dataflow by letting the filter framework handle it (or more accurately, using its conventions). One result is that the decode calls disappear from video.c, because we simply connect the decoder wrapper and the filter chain with mp_pin_connect(). Another goal is to eventually remove the code duplication between the audio and video paths for this. This commit prepares for this by trying to make f_decoder_wrapper.c extensible, so it can be used for audio as well later. Decoder framedropping changes a bit. It doesn't seem to be worse than before, and it's an obscure feature, so I'm content with its new state. Some special code that was apparently meant to avoid dropping too many frames in a row is removed, though. I'm not sure how the source code tree should be organized. For one, video/decode/vd_lavc.c is the only file in its directory, which is a bit annoying.
* player: replace old lavfi wrapper with new filter codewm42018-01-307-908/+103
| | | | | lavfi.c is not necessary anymore, because f_lavfi.c (which was actually converted from it) can be used now.
* audio: rewrite filtering glue codewm42018-01-303-416/+199
| | | | Use the new filtering code for audio too.
* video: rewrite filtering glue codewm42018-01-306-239/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get rid of the old vf.c code. Replace it with a generic filtering framework, which can potentially handle more than just --vf. At least reimplementing --af with this code is planned. This changes some --vf semantics (including runtime behavior and the "vf" command). The most important ones are listed in interface-changes. vf_convert.c is renamed to f_swscale.c. It is now an internal filter that can not be inserted by the user manually. f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is conceptually easy, but a big mess due to the data flow changes). The existing filters are all changed heavily. The data flow of the new filter framework is different. Especially EOF handling changes - EOF is now a "frame" rather than a state, and must be passed through exactly once. Another major thing is that all filters must support dynamic format changes. The filter reconfig() function goes away. (This sounds complex, but since all filters need to handle EOF draining anyway, they can use the same code, and it removes the mess with reconfig() having to predict the output format, which completely breaks with libavfilter anyway.) In addition, there is no automatic format negotiation or conversion. libavfilter's primitive and insufficient API simply doesn't allow us to do this in a reasonable way. Instead, filters can use f_autoconvert as sub-filter, and tell it which formats they support. This filter will in turn add actual conversion filters, such as f_swscale, to perform necessary format changes. vf_vapoursynth.c uses the same basic principle of operation as before, but with worryingly different details in data flow. Still appears to work. The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are heavily changed. Fortunately, they all used refqueue.c, which is for sharing the data flow logic (especially for managing future/past surfaces and such). It turns out it can be used to factor out most of the data flow. Some of these filters accepted software input. Instead of having ad-hoc upload code in each filter, surface upload is now delegated to f_autoconvert, which can use f_hwupload to perform this. Exporting VO capabilities is still a big mess (mp_stream_info stuff). The D3D11 code drops the redundant image formats, and all code uses the hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a big mess for now. f_async_queue is unused.
* 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
* command: add --osd-on-seek option defaulting to barKevin Mitchell2018-01-261-6/+9
| | | | | | | | | | | | | Restores behaviour prior to aef2ed5dc13e37dec0670c451b4369b151d5c65f. That change was apparently unpopular. However, given the amount of complaining over how hard it is to change the defaults by rebinding every key, I think the extra option introduced by this commit is justified. Technically not all behaviour is restored, because now --no-osd-bar will not instead display the msg text on seek. I think that feature was a little weird and is now easy enough to remedy with the --osd-on-seek option.
* Revert "command: make pause display the same osd-msg-bar as seek"Kevin Mitchell2018-01-261-3/+1
| | | | | | | | | | | | | | This reverts commit 9812e276aa1bb0bddeb73677aa9e9f87e73cd930. This was apparently unpopular. I still think the pause OSD should be the same as seek even if it's not visible by default, but it seems that whether to display a given property change is currently conflated with what to display. The reverted behaviour can be restored by adding something like the following to input.conf: SPACE cycle pause; show_progress
* 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.
* command: make change-list show changed option on OSDwm42018-01-251-0/+1
|
* command: add a change-list commandwm42018-01-251-0/+31
| | | | | | | | | | | | | Requested. See manpage additions. The main reason why this goes through the trouble to keep the action/operation parameter separate is so that we don't expose some option parser implementation details to the command (although that is a relatively weak reason), and also to make it more different from the "set" command, which can't support this type of option as it goes through the property layer. Fixes #5435.
* options: add an option type for byte sizeswm42018-01-251-18/+0
| | | | | | And use it for 2 demuxer options. It could be used for more options later. (Though the --cache options can not use this, because they use KB as base unit.)
* command: make sure to redraw on overlay commandswm42018-01-251-0/+1
| | | | | | | | | | When overlay-add etc. is run, make sure the playlop is rerun so that it considers actually redrawing the screen. (I considered making the OSD code generally wakeup the player, but that will probably lead to redundant wakeups, so I didn't bother.) Fixes #5431.
* 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.
* player: redo hack for video keyframe seeks with external audiowm42018-01-184-31/+49
| | | | | | | | | | | | | | | | | | | | | | | | If you play a video with an external audio track, and do backwards keyframe seeks, then audio can be missing. This is because a backwards seek can end up way before the seek target (this is just how this seek mode works). The audio file will be seeked at the correct seek target (since audio usually has a much higher seek granularity), which results in silence being played until the video reaches the originally intended seek target. There was a hack in audio.c to deal with this. Replace it with a different hack. The new hack probably works about as well as the old hack, except it doesn't add weird crap to the audio resync path (which is some of the worst code here, so this is some nice preparation for rewriting it). As a more practical advantage, it doesn't discard the audio demuxer packet cache. The old code did, which probably ruined seeking in youtube DASH streams. A non-hacky solution would be handling external files in the demuxer layer. Then chaining the seeks would be pretty easy. But we're pretty far from that, because it would either require intrusive changes to the demuxer layer, or wouldn't be flexible enough to load/unload external files at runtime. Maybe later.
* 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
* osd: treat user provided term-status-msg the same as the defaultKevin Mitchell2018-01-141-20/+24
| | | | | | | | | | | This is achieved by adding the new function get_term_status_msg that returns the status message specified by the user, or the mpv default. Previously, term_osd_print_status_lazy would exit early as soon as a user status message had been set, which potentially skipped adding the term_osd_bar if the user also requested that. fixes #3280
* osd: reference local pointer to mpctx->optsKevin Mitchell2018-01-131-2/+2
| | | | For brevity, since it's already there. Result should be identical.
* af_lavrresample: deprecate this filterwm42018-01-131-3/+7
| | | | | | The future direction might be not having such a user-visible filter at all, similar to how vf_scale went away (or actually, redirects to libavfilter's vf_scale).
* player: silence config file loading message on resumingwm42018-01-131-6/+7
| | | | | | This is just an implementation detail; seems to be ugly to log it by default. Other cases of the try_load_config() function should be logged, though.
* 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
|
* input: make command argument list a dynamic arraywm42018-01-101-3/+8
| | | | | | | | Replace the static array with dynamic memory allocation. This also requires some code to honor mp_cmd.nargs more strictly. Generally allocates more stuff. Fixes #5375 (although we could also just raise the static limit).
* ytdl_hook: don't try to use webpage_url if non-existentRicardo Constantino2018-01-111-1/