summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vaapi: fix typowm42017-01-121-1/+1
|
* mp_image_pool: fix build on Libavwm42017-01-121-0/+1
| | | | | Mismatches between header file symbol visibility in FFmpeg and Libav. Again.
* vo_opengl: hwdec_vaegl: add experimental P010 supportwm42017-01-121-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | This does not work, because Mesa has no support for the proposed DRM_FORMAT_R16 and DRM_FORMAT_GR16 formats. It's also untested of course. As long as video/decode/vaapi.c doesn't hand down P010 surfaces, this is fine anyway. This can be tested by removing the code that disables P010 output: diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c --- a/video/decode/vaapi.c +++ b/video/decode/vaapi.c @@ -55,13 +55,6 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h) assert(!ctx->avctx->hw_frames_ctx); - // If we use direct rendering, disallow 10 bit - it's probably not - // implemented yet, and our downstream components can't deal with it. - if (!p->own_ctx && required_sw_format != AV_PIX_FMT_NV12) { - MP_WARN(ctx, "10 bit surfaces are currently supported.\n"); - return -1; - } -
* vaapi: explicitly reject 10 bit surfaces outside of copy modewm42017-01-121-0/+7
| | | | | | | | Rendering support in Mesa probably doesn't exist yet. In theory it might be possible to use VPP to convert the surfaces to 8 bit (like we do it with dxva2/d3d11va as ANGLE doesn't support rendering 10 bit surface either), but that too would require explicit mechanisms. This can't be implemented either until I have a GPU with actual support.
* vaapi: handle image copying for vaapi-copy in common codewm42017-01-123-13/+16
| | | | | | | | | | | | | | Other hwdecs will also be able to use this (as soon as they are switched to use AVHWFramesContext). As an additional feature, failing to copy back the frame counts as hardware decoding failure and can trigger fallback. This can be done easily now, because it needs no way to communicate this from the hwaccel glue code to the common code. The old code is still required for the old decode API, until we either drop or rewrite it. vo_vaapi.c's OSD code (fuck...) also uses these surface functions to a higher degree.
* cuda: use libavutil functions for copying hw surfaces to memorywm42017-01-121-67/+0
| | | | | | | | mp_image_hw_download() is a libavutil wrapper added in the previous commit. We drop our own code completely, as everything is provided by libavutil and our helper wrapper. This breaks the screenshot code, so that has to be adjusted as well.
* vaapi: use libavutil functions for copying hw surfaces to memorywm42017-01-123-22/+66
| | | | | | | | | Makes va_surface_download() call mp_image_hw_download() for libavutil-allocated surfaces, which in turn calls av_hwframe_transfer_data(). mp_image_hw_download() is actually not specific to vaapi, and can be used for any hw surface allocated by libavutil.
* vd_lavc, mp_image: remove code duplication for AVFrame<->mp_imagewm42017-01-122-27/+19
| | | | | | | | | Mostly affects conversion of the colorimetric parameters. Not changing AV_FRAME_DATA_MASTERING_DISPLAY_METADATA handling - that's too messy, as decoders typically output it for keyframes only, and would require weird caching that can't even be done on the level of the frame rewrapping functions.
* vaapi: properly set hw_subfmt field with new decode APIwm42017-01-123-7/+12
| | | | | | | | This fixes direct rendering with hwdec_vaegl.c. The code duplication between update_image_params() and mp_image_copy_fields_from_av_frame() is quite annoying, bit will have to be resolved in another commit.
* vaapi: set our own context in AVHWFramesContext not AVHWDeviceContextwm42017-01-122-7/+7
| | | | | | AVHWDeviceContext.user_opaque is reserved to libavutil under certain circumstances, while AVHWFramesContext.user_opaque is truly free for use by us. It's slightly simpler too.
* vaapi: turn all mpv users into a living experimentwm42017-01-111-2/+2
| | | | | | | | | | | Dummy out the locking around all libva calls, which in theory shouldn't be needed anyway. Two years ago, these were added to prevent crashes with vaapi decoding and direct rendering (vo_opengl/vo_vaapi) active. It's not clear whether these are really needed - theory strongly points towards no. Some developers familiar with vaapi expressed similar thoughts. But past experience says differently. So let's try without the locking for a while and see what happens.
* vaapi: add missing config.h includewm42017-01-111-0/+2
| | | | | | | | | A recent commit added code that checks some HAVE_ symbols in this file. No config.h include was added, so they could be unavailable and break compilation (in practice, just --hwdec=vaapi-copy would break). Not sure how I missed this, maybe waf defined these symbols on the compiler command line for some reason.
* vaapi: support new libavcodec vaapi APIwm42017-01-113-1/+243
| | | | | | | | | | | | | | | | | The old API is deprecated, and libavcodec prints a warning at runtime. The new API is a bit nicer and does many things for you, such as managing the underlying hwaccel decoder. libavutil also provides code for managing surfaces (we use their surface pool). The new code does not contain any code from the original MPlayer VAAPI patch (that was used as base for some of the vaapi code in mpv). Thus the new code is LGPL. The new API actually does not add any visible symbols, so the only way to detect it is a version check. Of course, the versions overlap between FFmpeg and Libav, which requires additional care. The new API did not get merged into FFmpeg yet, so there's no check for FFmpeg.
* vaapi: add hacks to support vaapi surfaces created by libavutilwm42017-01-111-20/+45
| | | | | | | | | | | We usually attach some significant metadata and context to "our" surfaces. Surfaces created by libavutil (such as we plan to do it when using the new vaapi decode API in the following commit) don't have this context, so e.g. copy decoding mode won't work. Add tons of hacks to make this somehow work. Eventually we will use libavutil's mechanisms and drop the hacks.
* vaapi: move standalone display creation code to common codewm42017-01-113-136/+129
| | | | Preparation for the following commits.
* vaapi: rename vaapi.c to vaapi_old.cwm42017-01-111-0/+0
| | | | | vaapi.c will be reintroduced with the new code using the new libavcodec vaapi API.
* video: share hwdec extra surface count between backendswm42017-01-113-2/+9
| | | | It's a quite important and fragile magic number.
* cocoa: don't change Space on quit in fullscreenAkemi2017-01-111-6/+10
| | | | | | | circumvent undefined behavior when quitting in fullscreen. Fixes #3957
* cocoa: rate limit video outputAkemi2017-01-111-14/+51
| | | | | | | | | | | | the display refresh rate can't be estimated correctly in some cases and just increases till it turns off display-resample. cases are off-screen rendering (different space), mpv being completely hidden behind another window or the mission control view. this utilise the unused displaylink callback to limit the refresh rate to the actual display refresh rate.
* cocoa: add border cyclingAkemi2017-01-113-0/+45
| | | | Fixes #2430
* cocoa: fix handling of geometry optionAkemi2017-01-111-7/+27
| | | | | | | | | | | | | | This flips the y-coordinate to be consistent with other platforms and the manual. furthermore it fixes an unwanted behaviour of the cocoa convertRectFromBacking method, where the x- and y-coordinate was divided by the same factor as the width and height instead of placing the new scaled rectangle at the same relative position as the original unscaled rectangle, by manually calculating the new position. Fixes #3867
* vd_lavc: inline a functionwm42017-01-111-45/+37
| | | | | There's only 1 caller now, so having it as separate function doesn't make too much sense, and makes the code less readable, if anything.
* video: make decoder EOF reporting explicitwm42017-01-113-51/+38
| | | | | | | | | | | | | | | This is simpler and more robust, especially for the hwdec fallback case. The most annoying issue is that C doesn't support multiple return values (or sum types), so the decode call gets all awkward. The hwdec fallback case does not need to try to produce some output after the fallback anymore. Instead, it can use the normal "replay" code path. We invert the "eof" bool that vd_lavc.c used internally. The receive_frame decoder API returns the inverse of EOF, because returning "true" from the decode function if EOF was reached feels awkward.
* vd_lavc: fix some leaks and a discarded frame on hwdec fallbackwm42017-01-111-1/+6
| | | | Wasn't a problem in most normal scenarios.
* vd_lavc: move end-of-probing code out of user notification if conditionwm42017-01-111-1/+3
| | | | | | Usually they happen at the same time, but conflating them is still a bit unclean and could possibly cause problems in the future. It's also really unnecessary.
* vd_lavc: return proper error codes from get_buffer2 callbackwm42017-01-111-2/+2
| | | | -1 is essentially random and usually the same as AVERROR(EPERM).
* vd_lavc: complicated improved fallback behavior for --hwdec=cudawm42017-01-102-16/+65
| | | | | | | | | | | | | The ffmpeg cuda wrappers need more than 1 packet for determining whether hw decoding will work. So do something complicated and keep up to 32 packets when trying to do hw decoding, and replay the packets on the software decoder if it doesn't work. This code was written in a delirious state, testing for regressions and determining whether this is worth the trouble will follow later. All mpv git users are alpha testers as of this moment. Fixes #3914.
* video: restructure decode loopwm42017-01-104-95/+138
| | | | Basically change everything. Why does the code get larger? No idea.
* player: change aspects of cover art handlingwm42017-01-102-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | Cover art handling is a disgusting hack that causes a mess in all components. And this will stay this way. This is the Xth time I've changed cover art handling, and that will probably also continue. But change the code such that cover art is injected into the demux packet stream, instead of having an explicit special case it in the decoder glue code. (This is somewhat more similar to the cover art hack in libavformat.) To avoid that the over art picture is decoded again on each seek, we need some additional "caching" in player/video.c. Decoding it after each seek would work as well, but since cover art pictures can be pretty huge, it's probably ok to invest some lines of code into caching it. One weird thing is that the cover art packet will remain queued after seeks, but that is probably not an issue. In exchange, we can drop the dec_video.c code, which is pretty convenient for one of the following commits. This code duplicates a bunch of lower-level decode calls and does icky messing with this weird state stuff, so I'm glad it goes away.
* vo_drm: remove 2 redundant include statementswm42017-01-091-2/+0
| | | | They're already pulled in by drm_common.h.
* drm: include <poll.h> instead of <sys/poll.h>wm42017-01-093-3/+3
| | | | | | | I'm not sure what systems have <sys/poll.h> (maybe there are historical reasons why some would), but POSIX defines <poll.h>. Although this code is full of highly OS specific calls (like ioctl()), there's no reason not to use the more standard include path.
* vo_opengl: replace 2 memsetswm42017-01-081-2/+2
| | | | Cosmetic change.
* vaapi: set libva message callbackswm42017-01-081-0/+61
| | | | | | | | | | | This is available since the first commit after libva 0.39.4. Since the version wasn't bumped since, we just check some random other symbol that was added since (I'd rather not add a configure check). The libva message callback repeats the endlessly repeated API mistakes of libraries using global message callback handlers. But it's the only way to shut up libva's dumb messages to stderr, so add something complicated and dumb to workaround libva's stupidity.
* vaapi: rearrange va_initialize() internals and fix double-free on errorwm42017-01-081-17/+13
| | | | | | | | Just some minor refactoring within va_initialize() as preparation for the next commit. Also, do not call vaTerminate(display) on failures. All callers already do this, so this would have led to a double-free.
* context_wayland: do not call vo_wayland_request_frame() upon bufferswapRostislav Pehlivanov2017-01-071-3/+0
| | | | | | | | vo_wayland_wait_events() is going to return when its time to swap the buffers anyway, calling request_frame() before makes no sense. Fixes the constant high CPU usage by the compositor when mpv is paused and the window is in view.
* win32: fix for wm_syscommandpavelxdd2017-01-051-1/+1
| | | | | | | | According to MSDN, in WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are used internally by the system. To obtain the correct result when testing the value of wParam, an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator.
* af_lavfi, vf_lavfi: work around recent libavfilter EOF bugwm42017-01-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Looks quite like a bug. If you have a filter chain with only the dynaudnorm filter, and send call av_buffersrc_add_frame(s, NULL), then subsequent av_buffersink_get_frame() calls will return EAGAIN instead of EOF. This was apparently caused by a recent change in FFmpeg. Some other circumstances (which I didn't fully analyze and which is due to the playloop's absurd temporary-EOF behavior on seeks) then led the decoder loop to send data again, but since libavfilter was stuck in the EOF state now, it could never recover. It kept sending new input (due to missing output), until the demuxer refused to return more audio packets. Each time a filter error was printed. Fortunately, it's pretty easy to workaround. We just mark the p->eof flag as we send an EOF frame to libavfilter. The p->eof flag is used only to recover from temporary EOF: it resets the filter if new data is available again. We don't care much about av_buffersink_get_frame() returning a broken EAGAIN state in this situation and essentially ignore it, meaning if we get EAGAIN after sending EOF, we assume effectively that EOF was fully reached.
* vo_opengl: egl: handle potential eglChooseConfig failureswm42016-12-311-11/+10
| | | | | | | | | | | | | | | This is actually a pretty important fix. eglChooseConfig() might be the first thing that fails when porobing for desktop GL / ES2 / ES3 support, because EGL_RENDERABLE_TYPE is set values specific to the underlying APIs. Not sure how the hell this worked before. EGL 1.4 implementations certainly could fail the call with EGL_BAD_ATTRIBUTE if EGL_RENDERABLE_TYPE has EGL_OPENGL_ES3_BIT set. It's quite possible that many EGL implementations tolerate invalid EGLConfig values steming from uininitialized EGLConfig values (and eglCreateWindowSurface() even is specified to return EGL_BAD_CONFIG error code for "not valid" EGLConfigs).
* vo_opengl: egl: fix depth size parameterwm42016-12-301-1/+0
| | | | | | This was accidentally flipped from 0 to 1 in a previous commit. Actually simply remove it, because 0 is the default value for this parameter anyway.
* vo_opengl: x11egl: fix alpha modewm42016-12-301-2/+32
| | | | | | | | | | | | | | | | | | The way it should (probably) work is that selecting a RGBA framebuffer format will simply make the compositor use the alpha. It works this way on Wayland. On X11, this is... not done. Instead, both GLX and EGL report two FB configs, which are exactly the same, except for the platform-specific visual. Only the latter (non-default) points to a visual that actually has alpha. So you can't make the pure GLX and EGL APIs select alpha mode, and you have to override manually. Or in other words, alpha was hacked violently into X11, in a way that doesn't really make sense for the sake of compatibility, and forces API users to wade through metaphorical cow shit to deal with it. To be fair, some other platforms actually also require you to enable alpha explicitly (rather than looking at the framebuffer type), but they skip the metaphorical cow shit step.
* vo_opengl: x11: move RGBA visual test to x11_common.cwm42016-12-303-12/+25
| | | | | | | | So that the EGL code can use it too. Also print the actual FB config ID, instead of nonsense. (I _think_ once in the past a certain GLX implementation just used numeric config IDs casted to EGLConfig - or at least that would explain this nonsense.)
* vo_opengl: egl_helpers: add a way to override config selectionwm42016-12-302-2/+21
| | | | | | | Preparation for the following commits. Since at least theoretically the config selection depends on the context type (EGL_RENDERABLE_TYPE has separate bits for ES 2, ES 3, and desktop GL), doing it any other way would be too painful.
* vo_opengl: egl_helpers: add a way to pass more optionswm42016-12-302-16/+35
| | | | | | | | | | For X11 garbage we have to pass some annoying parameters to EGL context creation. Add some sort of extensible API, so that adding a new parameter doesn't break all callers. We still want to keep it as a single function, because it's so nice isolating all the EGL nonsense API boilerplate like this. (Did I mention yet that X11 and EGL are garbage?) Also somewhat simplifies the vo_flags mess in the helper internals.
* Prefix libavcodec CODEC_FLAG_ constants with AV_wm42016-12-291-3/+3
| | | | The unprefixed versions are silently deprecated.
* vo_opengl: partially fix rotation for 4:2:2 contentNiklas Haas2016-12-281-1/+6
| | | | | | | | | | | | The chroma alignment renormalization code forgot to account for the fact that the chroma subsampling ratio has to be rotated. Unfortunately, doing it this way seems to have somewhat broken the chroma offset rotation logic for odd-sized subsampled image files. While this is a bug, it's much, much less noticeable, so it's not nearly as important as the bug this change fixes. Either way, a future patch needs to still revise this logic, ideally by redesigning the entire rotation mechanism.
* cocoa: fix build on OS X 10.9Akemi2016-12-261-1/+1
| | | | fixes #3946
* options: deprecate codec family selection in --vd/--adwm42016-12-231-10/+9
| | | | | Useless now, so get rid of it. Also affects some user-visible display things (like reported codec in use).
* vd_lavc: use AVFrame fields directly instead of AVCodecContextwm42016-12-221-4/+4
| | | | | | | | | Conceptually cleaner, although the API claims this is equivalent. Originally, AVCodecContext fields were used, because not all supported libavcodec/libavutil versions had the AVFrame fields. This is not done for chroma_sample_location - it has no AVFrame field.
* video: use demuxer-signaled duration for last video framewm42016-12-213-1/+7
| | | | | | | | | Helps with gif, probably does unwanted things with other formats. This doesn't handle --end quite correctly, but this could be added later. Fixes #3924.
* Fix mistakes in spelling and grammarDario Russo2016-12-211-3/+3
|
* ad_lavc, vd_lavc: don't set AVCodecContext.refcounted_frameswm42016-12-181-1/+0
| | | | | This field is (or should be) deprecated, and there's no need to set it with the new API.
* cocoa: cosmetic fixesAkemi2016-12-164-17/+30
|
* cocoa: fullscreen refactoringAkemi2016-12-155-254/+278
| | | | | | | | | | this replaces the old fullscreen with the native macOS fullscreen. additional the --fs-black-out-screens was removed since the new API doesn't support it in a way the old one did. it can possibly be re-added if done manually. Fixes #2857 #3272 #1352 #2062 #3864
* win32: change the log level of 'move window' msgpavelxdd2016-12-141-1/+1
| | | | It does more harm than good, since it spams terminal a lot
* cocoa: fix dropping of certain urls on the windowAkemi2016-12-141-1/+6
| | | | | | the 'path' of an youtube url (youtube.com/watch?v=x) would just be '/watch'. obviously this fails to load.
* win32: window styles improvementspavelxdd2016-12-121-4/+9
| | | | | | | Allow minimizing the borderless/fullscreen window by clicking on the taskbar button or pressing Win+Down hotkey. Also fixes #2229 and probably fixes #2451
* win32: update winapi functions namespavelxdd2016-12-121-3/+3
| | | | | | According to MSDN, GetWindowLong and SetWindowLong have been superseded by GetWindowLongPtr and SetWindowLongPtr. It's a cosmetic code change in this case.
* client API: allow passing NULL to mpv_opengl_cb_uninit_gl()wm42016-12-091-0/+3
| | | | In which case it does nothing.
* vo_rpi: partially undeprecatewm42016-12-082-6/+3
| | | | Using vo_opengl + MMAL overlay didn't quite work out.
* Remove compatibility thingswm42016-12-077-61/+6
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.