summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* Restore Libav supportwm42017-12-211-0/+2
| | | | | | | | | | | Libav has been broken due to the hwdec changes. This was always a temporary situation (depended on pending patches to be merged), although it took a bit longer. This also restores the travis config. One code change is needed in vd_lavc.c, because it checks the AV_PIX_FMT for videotoolbox (as opposed to the mpv format identifier), which is not available in Libav. Add an ifdef; the affected code is for a deprecated option anyway.
* hwdec: remove unused fieldswm42017-12-213-9/+0
| | | | | These were replaced by a different mechanism, but the old fields weren't removed.
* vo_mediacodec_embed: implement hwcontextAman Gupta2017-12-201-0/+30
| | | | Fixes vo_mediacodec_embed, which was broken in 80359c6615658f2784
* vo_gpu: win: remove exclusive-fullscreen detection hackJames Ross-Gowan2017-12-203-129/+0
| | | | | | | | | | | | | | | | | | | | | This hack was part of a solution to VSync judder in desktop OpenGL on Windows. Rather than using blocking-SwapBuffers(), mpv could use DwmFlush() to wait for the image to be presented by the compositor. Since this would only work while the compositor was running, and the compositor was silently disabled when OpenGL entered exclusive fullscreen mode, mpv needed a way to detect exclusive fullscreen mode. The code that is being removed could detect exclusive fullscreen mode by checking the state of an undocumented mutex using undocumented native API functions, but because of how fragile it was, it was always meant to be removed when a better solution for accurate VSync in OpenGL was found. Since then, mpv got the dxinterop backend, which uses desktop OpenGL but has accurate VSync. It also got a native Direct3D 11 backend, which is a viable alternative to OpenGL on Windows. For people who are still using desktop OpenGL with WGL, there shouldn't be much of a difference, since mpv can use other API functions to detect exclusive fullscreen.
* w32_common: refactor and improve window state handlingpavelxdd2017-12-191-131/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored and split the `reinit_window_state` code into four separate functions: - `update_window_style` used to update window styles without modifying the window rect. - `fit_window_on_screen` used to adjust the window size when it is larger than the screen size. Added a helper function `fit_rect` to fit one rect on another without using any data from w32 struct. - `update_fullscreen_state` used to calculate the new fullscreen state and adjust the window rect accordingly. - `update_window_state` used to display the window on screen with new size, position and ontop state. This commit fixes three issues: - fixed #4753 by skipping `fit_window_on_screen` for a maximized window, since maximized window should already fit on the screen. It should be noted that this bug was only reproducible with `--fit-border` option which is enabled by default. The cause of the bug is that after calling the `add_window_borders` for a maximized window, the rect in result is slightly larger than the screen rect, which is okay, `SetWindowPos` will interpret it as a maximized state later, so no auto-fitting to screen size is needed here. - fixed #5215 by skipping `fit_window_on_screen` when leaving fullscreen. On a multi-monitor system if the mpv window was stretched to cover multiple monitors, its size was reset after switching back from fullscreen to fit the size of the active monitor. Also, when changing `--ontop` and `--border` options, now only the `update_window_style` and `update_window_state` functions are used, so `fit_window_on_screen` is not used for them too. - fixed #2451 by moving the `ITaskbarList2_MarkFullscreenWindow` below the `SetWindowPos`. If the taskbar is notified about fullscreen state before the window is shown on screen, the taskbar button could be missing until Alt-TAB is pressed, usually it was reproducible on Windows 8. Other changes: - In `update_fullscreen_state` the `reset window bounds` debug message now reports client area size and position, instead of window area size and position. This is done for consistency with debug messages in handling fullscreen state above in this function, since they also print window bounds of the client area. - Refactored `gui_thread_reconfig`. Added a new window flag `fit_on_screen` to fit the window on screen even when leaving fullscreen. This is needed for the case when the new video opened while the window is still in the fullscreen state. - Moved parent and fullscreen state checks out from the WM_MOVING to `snap_to_screen_edges` function for consistency with other functions. There's no point in keeping these checks out of the function body.
* w32_common: use RECT for storing screen and window size & positionpavelxdd2017-12-191-100/+71
| | | | | | When window and screen size and position are stored in RECT, it's much easier to modify them using WinAPI functions. Added two macros to get width and height of the rect.
* vo_gpu: hwdec_drmprime_drm: don't crash for non-GL contextswm42017-12-171-0/+3
| | | | Using vulkan with --hwdec crashed because of this.
* msg: reinterpret a bunch of message levelsNiklas Haas2017-12-156-42/+25
| | | | | | | | | | | | | | | | | | | | | | I've decided that MP_TRACE means “noisy spam per frame”, whereas MP_DBG just means “more verbose debugging messages than MSGL_V”. Basically, MSGL_DBG shouldn't create spam per frame like it currently does, and MSGL_V should make sense to the end-user and provide mostly additional informational output. MP_DBG is basically what I want to make the new default for --log-file, so the cut-off point for MP_DBG is if we probably want to know if for debugging purposes but the user most likely doesn't care about on the terminal. Also, the debug callbacks for libass and ffmpeg got bumped in their verbosity levels slightly, because being external components they're a bit less relevant to mpv debugging, and a bit too over-eager in what they consider to be relevant information. I exclusively used the "try it on my machine and remove messages from MSGL_* until it does what I want it to" approach of refactoring, so YMMV.
* vd_lavc: rename --hwdec=rpi to --hwdec=mmalwm42017-12-151-4/+0
| | | | | | Annoying exception that makes no sense to keep. Normally, users or client applications will either use --hwdec=auto, or not set the option at all, which both leads to the expected result.
* vd_lavc: use libavcodec metadata for hardware decoder wrapperswm42017-12-151-25/+8
| | | | | This removes the need to keep an explicit list and to attempt to parse codec names. Needs latest FFmpeg git.
* csputils: Add support for Display P3 primariesVittorio Giovara2017-12-142-2/+5
|
* csputils: Fix DCI P3 primaries white pointVittorio Giovara2017-12-141-1/+2
|
* vf_buffer: remove this filterwm42017-12-122-87/+0
| | | | | It has been deprecated for a while and is 100% useless. It was forgotten in the recent filter purge. Get rid of it.
* w32_common: update outdated comment about wakeup eventspavelxdd2017-12-111-2/+1
| | | | | mpv doesn't use WM_USER for wakeup events since 91079c0 Updated the comment.
* vf_convert: default to limited range when converting RGB to YUVwm42017-12-111-0/+5
| | | | | | | | | | Full range YUV causes problems everywhere. For example it's usually the wrong choice when using encoding mode, and libswscale sometimes messes up when converting to full range too. (In this partricular case, we found that converting rgba->yuv420p16 full range actually seems to output limited range.) This actually restores a similar heueristic from the late vf_scale.c.
* vo_gpu: hwdec_drmprime_drm: silence error on failed autoprobingwm42017-12-111-1/+1
| | | | | | | | | | When autoprobing the hwdec interops (which now happens to all compiled interops if hardware decoding is used), failure to load an interop should not print an error in the normal case. So hide it. (We could make the log level conditional on whether autoprobing is used, but directly loading it without autoprobing is obscure, and most other interops don't do this either.)
* hwdec: document a forgotten parameterwm42017-12-111-0/+1
| | | | Add the "all" value to the --gpu-hwdec-interop help output.
* video: remove code duplication by calling a hwdec loader helperwm42017-12-111-2/+1
| | | | | Make gl_video_load_hwdecs() call gl_video_load_hwdecs_all() when all HW decoders should be loaded.
* video: properly initialize and set hwdec_interopwm42017-12-111-0/+2
| | | | Don't reset --gpu-hwdec-interop if vo_gpu uses dumb mode.
* vd_lavc: always load VO interops with non-copy hw decoderswm42017-12-111-0/+4
| | | | | | | | For METHOD_INTERNAL hwdecs (non-copy cases), make sure the VO interops are always loaded, because those decoders will output hardware pixel formats, which will need special support in vo_gpu. Otherwise, initialization will fail, complaining that it can't convert the output format to something the VO supports.
* vo: fix a compiler warning by properly printing a 64bit integerJan Ekström2017-12-111-1/+1
|
* vd_lavc: add rkmpp to the hwdec_wrappers array.LongChair2017-12-101-0/+1
| | | | Allows to get the hwdec picked up properly by mpv on rockchip devices
* vo_gpu: d3d11: check for timestamp query supportJames Ross-Gowan2017-12-091-0/+9
| | | | | | | | | | Apparently timestamp queries are optional for 10level9 devices. Check for support when creating the device rather than spamming error messages during rendering. CreateQuery can be used to check for support by passing NULL as the final parameter. See: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx#ID3D11Device_CreateQuery
* w32_common: improve the window message state machinepavelxdd2017-12-071-1/+13
| | | | | | | | * Distinguish between the window being moved or not. * Skip trying to snap if currently in full screen or an embedded window. * Exit snapped state if the size changed when the window was being moved.
* w32_common: skip window snapping if Windows handled itpavelxdd2017-12-071-2/+12
| | | | | | Check the expected width and height against up-to-date window placement. If they do not match, we will consider snapping to have happened on Windows' side.
* vo: add support for externally driven renderloop and make wayland use itRostislav Pehlivanov2017-12-054-4/+70
| | | | | | | | | | | Fixes display-sync (though if you change virtual desktops you'll need to seek to re-enable display-sync) partially under wayland. As an advantage, rendering is completely disabled if you change desktops or alt+tab so you lose no performance if you leave mpv running elsewhere as long as it isn't visible. This could also be ported to other VOs which supports it.
* vo_gpu: d3d11_helpers: use better formatting for PCI IDsJames Ross-Gowan2017-12-041-4/+6
| | | | | The old format was definitely misleading, since it used an 0x prefix and formatted the device IDs with %d.
* Fix various typos in log messagesNicolas F2017-12-032-2/+2
|
* video: probe format of primary plane in drm/egl contextAnton Kindestam2017-12-031-3/+59
| | | | | | | | | We need to support hardware/drivers which do not support ARGB8888 in their primary plane. We also use p->primary_plane_format when creating the gbm surface, to make sure it always matches (in actuality there should be little difference).
* hwdec: whitespace cleanup in hwdec_drmprime_drm.cAnton Kindestam2017-12-031-2/+2
|
* video: fix use of possibly-NULL pointer in drm_egl_initAnton Kindestam2017-12-031-1/+2
|
* video: fix double free in drm_atomic_create_contextAnton Kindestam2017-12-031-1/+2
| | | | | | | | | | | | Passing in an invalid DRM overlay id with the --drm-overlay option would cause drmplane to be freed twice: once in the for-loop and once at the error-handler label fail. Solve by setting drmpanel to NULL after freeing it. Also the 'return false' statement after the error handler label should probably be 'return NULL', given that the return type of drm_atomic_create_context returns a pointer.
* build: remove POSIX/sysv shared memory testwm42017-12-022-48/+17
| | | | | | vo_x11 and vo_xv need this. According to the Linux manpage, all involved functions are POSIX-2001 anyway. (I just assumed they were not, because they're mostly System V UNIX legacy garbage.)
* vd_lavc: don't request native pixfmt with -copy and METHOD_INTERNALwm42017-12-021-0/+1
| | | | | | | | | If the codec uses AV_CODEC_HW_CONFIG_METHOD_INTERNAL, and we're using the -copy method, then don't request the native pix_fmt. It might not have a AVFrame.hw_frames_ctx set, and we couldn't read back at all. On top of that, most of those decoders probably don't provide read-back when using such opaque formats anyway, while providing separate decoding modes to decode to RAM.
* video: remove some more hwdec legacy stuffwm42017-12-0210-93/+50
| | | | | | | | | Finally get rid of all the HWDEC_* things, and instead rely on the libavutil equivalents. vdpau still uses a shitty hack, but fuck the vdpau code. Remove all the now unneeded remains. The vdpau preemption thing was not unused anymore; if someone cares this could probably be restored.
* vd_lavc, vdpau, vaapi: restore emulated API avoidancewm42017-12-025-3/+48
| | | | | | This code is for trying to avoid using an emulation layer when using auto probing, so that we end up using the actual API the drivers provide. It was destroyed in the recent refactor.
* hwdec: don't require setting legacy hwdec fieldswm42017-12-027-30/+18
| | | | | | | | | | With the recent changes, mpv's internal mechanisms got synced to libavcodec's once more. Some things are still needed for filters (until the mechanism gets replaced), but there's no need to require other hwdec methods to use these fields. So remove them where they are unnecessary. Also fix some minor leaks in the dxva2 backends, and set the driver_name field in the Apple ones. Untested on Apple crap.
* vd_lavc: simpler way to check for opque hw framewm42017-12-021-3/+1
| | | | The ->fmt shit is something I'd like to phase out.
* vd_lavc: sort -copy hwdec modes to end of listwm42017-12-021-6/+12
| | | | | | | | | | | | | | | Otherwise, if e.g. "nvdec" didn't work, but "nvdec-copy" did, it would never try "vdpau", which is actually the next non-copy mode on the autprobe list. It's really expected that it selects "vdpau". Fix this by sorting the -copy modes to the end of the final hwdec list. But we still don't want preferred -copy modes like "nvdec-copy" to be sorted after fragile non-preferred modes like "cuda", and --hwdec=auto should prefer "nvdec-copy" over it, so make sure the copying mode does not get precedence over preferred vs. non-preferred mode. Also simplify the existing auto_pos sorting condition, and fix the fallback sort order (although that doesn't matter too much).
* vd_lavc: allow forcing single implementations with --hwdecwm42017-12-021-2/+3
|
* vd_lavc: slightly simplifywm42017-12-021-34/+28
| | | | | | Factor the somewhat-duplicated code into an append function. Also fix setting the copying flag in one of the cases. This also ensures some uniformity.
* vd_lavc: coding stylewm42017-12-021-1/+1
|
* hwdec: remove unused HWDEC_* constantswm42017-12-011-19/+1
| | | | Removing the rest requires replacing some other mechanisms, later.
* vd_lavc: fix dumb nonsensewm42017-12-011-1/+4
|
* vd_lavc, mp_image: remove weird mpv specific palette constantwm42017-12-013-9/+3
| | | | | Was for times when we were trying to be less dependent on libav* I guess.
* vd_lavc: merge redundant headerwm42017-12-012-94/+77
| | | | This is not needed anymore.
* vd_lavc: rewrite how --hwdec is handledwm42017-12-014-483/+354
| | | | | | | | | | | | | | | | Change it from explicit metadata about every hwaccel method to trying to get it from libavcodec. As shown by add_all_hwdec_methods(), this is a quite bumpy road, and a bit worse than expected. This will probably cause a bunch of regressions. In particular I didn't check all the strange decoder wrappers, which all cause some sort of special cases each. You're volunteering for beta testing by using this commit. One interesting thing is that we completely get rid of mp_hwdec_ctx in vd_lavc.c, and that HWDEC_* mostly goes away (some filters still use it, and the VO hwdec interops still have a lot of code to set it up, so it's not going away completely for now).
* vd_lavc: drop mediacodec direct rendering support temporarilywm42017-12-012-69/+8
| | | | | | | | | | | | The libavcodec mediacodec support does not conform to the new hwaccel APIs yet. It has been agreed uppon that this glue code can be deleted for now, and support for it will be restored at a later point. Readding would require that it supports the AVCodecContext.hw_device_ctx API. The hw_device_ctx would then contain the surface ID. vo_mediacodec_embed would actually perform the task of creating vo.hwdec_devs and adding a mp_hwdec_ctx, whose av_device_ref is a AVHWDeviceContext containing the android surface.
* video: move d3d.c out of decode sub directorywm42017-12-017-5/+5
| | | | | | It makes more sense to have it in the general video directory (along with vdpau.c and vaapi.c), since the decoder source files don't even access it anymore.
* vd_lavc: delete hw_d3d11va.c/hw_dxva2.c and merge leftoverswm42017-12-015-117/+39
| | | | | | Like with all hwaccels, there's little that is actually specific to decoding (which has been moved away anyway), and what is left are declarations (which will also go away soon).
* hw_dxva2: move dxva2 code to d3d.cwm42017-12-012-117/+126
| | | | This source file will disappear, so just collect the leftovers in d3d.c.
* video: refactor hw device creation for hwdec copy modeswm42017-12-0111-203/+207
| | | | | | | | | | Lots of shit code for nothing. We probably could just use libavutil's code for all of this. But for now go with this, since it tends to prevent stupid terminal messages during probing (libavutil has no mechanism to selectively suppress errors specifically during probing). Ignores the "emulated" API flag (for avoiding vaapi/vdpau wrappers), but it doesn't matter that much for -copy anyway.
* video: fix memory leaks with hwdec copy modeswm42017-12-011-2/+2
| | | | | | | This leaked 2 unreffed AVFrame structs (roughly 1KB) per decoded frame. Can I blame the FFmpeg API and the weird difference between freeing and unreffing an AVFrame?
* vd_lavc: move entrypoint for hwframes_refinewm42017-12-017-11/+9
| | | | | | | The idea is to get rid of vd_lavc_hwdec, so special functionality like this has to go somewhere else. At this point, hwframes_refine is only needed for d3d11, and it doesn't do much, so for now the new callback has no context. In can be made more fancy if really needed.
* vd_lavc: remove process_image callbackwm42017-12-012-9/+3
| | | | Now unused.
* d3d11: move code for d3d11eglrgb hackwm42017-12-012-10/+3
|
* vo_gpu: hwdec: remove redundant fieldswm42017-12-0113-18/+3
| | | | | | | | | | | | | The testing_only field is not referenced anymore with vaglx removed and the previous commit dropping all uses. The ra_hwdec_driver.api field became unused with the previous commit, but all hwdec interop drivers still initialized it. Since this touches highly OS-specific code, build regressions are possible (plus the previous commit might break hw decoding at runtime). At least hwdec_cuda.c still used the .api field, other than initializing it.
* vo_gpu: make it possible to load multiple hwdec interop driverswm42017-12-019-143/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the VO<->decoder interface capable of supporting multiple hwdec APIs at once. The main gain is that this simplifies autoprobing a lot. Before this change, it could happen that the VO loaded the "wrong" hwdec API, and the decoder was stuck with the choice (breaking hw decoding). With the change applied, the VO simply loads all available APIs, so autoprobing trickery is left entirely to the decoder. In the past, we were quite careful about not accidentally loading the wrong interop drivers. This was in part to make sure autoprobing works, but also because libva had this obnoxious bug of dumping garbage to stderr when using the API. libva was fixed, so this is not a problem anymore. The --opengl-hwdec-interop option is changed in various ways (again...), and renamed to --gpu-hwdec-interop. It does not have much use anymore, other than debugging. It's notable that the order in the hwdec interop array ra_hwdec_drivers[] still matters if multiple drivers support the same image formats, so the option can explicitly force one, if that should ever be necessary, or more likely, for debugging. One example are the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both support d3d11 input. vo_gpu now always loads the interop lazily by default, but when it does, it loads them all. vo_opengl_cb now always loads them when the GL context handle is initialized. I don't expect that this causes any problems. It's now possible to do things like changing between vdpau and nvdec decoding at runtime. This is also preparation for cleaning up vd_lavc.c hwdec autoprobing. It's another reason why hwdec_devices_request_all() does not take a hwdec type anymore.
* vo_opengl: hwdec_vaegl: Reenable vaExportSurfaceHandle()Mark Thompson2017-11-301-3/+3
| | | | It will be present from libva 2.1 (VAAPI 1.1.0 or higher)