summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* videotoolbox: make decoder format customizablewm42015-11-176-13/+41
| | | | | | | | | | Because apparently there's no ideal universally working format. The weird OpenGL texture format for kCVPixelFormatType_32BGRA is from: http://stackoverflow.com/questions/22077544/draw-an-iosurface-to-an-opengl-context (Which apparently got it from the linked Apple example code.)
* vo_opengl: osx: error out if there is no IOSurfacewm42015-11-171-0/+4
|
* vo_opengl: force dumb mode if RG textures are not availablewm42015-11-161-3/+3
| | | | | | | Something goes wrong somewhere. Don't bother, it's only needed for compatibility with our absolute baseline (GL 2.1/GLES 2). On the other hand, we can process nv12 formats just fine.
* vo_opengl: attempt to improve GLX vs. EGL backend detectionwm42015-11-163-37/+57
| | | | | | | | | | | | | | | For the sake of vaapi interop, we want to use EGL, but on the other hand, but because driver developers are full of shit, vdpau interop will not work on EGL (even if the driver supports EGL). The latter happens with both nvidia and AMD Mesa drivers. Additionally, EGL vaapi interop support can apparently only detected at runtime by actually using it. While hwdec_vaegl.c already does this, it would require initializing libva on _every_ system, which will cause libav to print an unpreventable bullshit message to the terminal. Try to counter these huge loads of bullshit by adding more fucking bullshit.
* vo_opengl: fix backend autoprobingwm42015-11-161-0/+9
| | | | | | | | | | | | | We want the following behavior: - VO probed, backend probed: only accept non-sw, fail completely otherwise - VO forced, backend probed: use the first non-sw, or if none is found, fall back to the first working sw backend - VO probed, backend forced: (I don't care about this case) - VO forced, backend forced: just use that backend Also, on backend probe failure the vo->probed field was left in its old state.
* win32: support taskbar button progress indicatorMartin Herkt2015-11-152-0/+44
| | | | | | | | | | | This adds support for the progress indicator taskbar extension that was introduced with Windows 7 and Windows Server 2008 R2. I don’t like this solution because it keeps its own state and introduces another VOCTRL, but I couldn’t come up with anything less messy. closes #2399
* vo_opengl: use glBlitFramebuffer to draw repeated frameswm42015-11-153-16/+27
| | | | | | | | | | | | | | | | | | | | | In the display-sync, non-interpolation case, and if the display refresh rate is higher than the video framerate, we duplicate display frames by rendering exactly the same screen again. The redrawing is cached with a FBO to speed up the repeat. Use glBlitFramebuffer() instead of another shader pass. It should be faster. For some reason, post-process was run again on each display refresh. Stop doing this, which should also be slightly faster. The only disadvantage is that temporal dithering will be run only once per video frame, but I can live with this. One aspect is messy: clearing the background is done at the start on the target framebuffer, so to avoid clearing twice and duplicating the code, only copy the part of the framebuffer that contains the rendered video. (Which also gets slightly messy - needs to compensate for coordinate system flipping.)
* vo: fix unpausing with display-syncwm42015-11-151-5/+3
| | | | | | | Currently, vo.c will always continue to render the currently queued frame, which sets last_flip, which in turn confuses vo_get_delay(), which in turn will show a bogus A/V desync message on unpause. So just reset it again on unpause.
* vo: fix dropping frames with display-syncwm42015-11-141-2/+0
| | | | | | I guess the removed code is an old leftover, and makes no sense anymore. Should fix weird A/V diff dropouts when frames are being dropped with display-sync.
* player: account for minor VO underrunswm42015-11-142-10/+16
| | | | | | | | | If the player sends a frame with duration==0 to the VO, it can trivially underrun. Don't panic, but keep the correct time. Also, returning the absolute time from vo_get_next_frame_start_time() just to turn it into a float with relative time was silly. Rename it and make it return what the caller needs.
* command: rename vo-missed-frame-count propertywm42015-11-132-5/+5
| | | | | | | | | "Missed" implies the frame was dropped, but what really happens is that the following frame will be shown later than intended (due to the current frame skipping a vsync). (As of this commit, this property is still inactive and always returns 0. See git blame for details.)
* win32: avoid detection as exclusive fullscreen windowMartin Herkt2015-11-131-1/+1
| | | | | | | | | | | | | | | | | Apparently Windows treats windows that use OpenGL, cover an entire screen and have the WS_POPUP style set or are topmost windows as exclusive fullscreen windows that bypass DWM and cannot be covered by other windows. This means we can’t use dwmflush in fullscreen mode, and it also means that no other window can cover mpv, and it makes the screen flicker when switching to fullscreen mode. This can be avoided by not setting the WS_POPUP flag. Users can still access the old behavior by enabling stay-on-top (which IMO at least makes sense—now we just need to get dwmflush autodetection right to avoid nasty surprises). fixes #2177
* vo_opengl_cb: do not block on flipping when redrawingwm42015-11-121-0/+5
| | | | | Gives slightly better behavior when used with Qt. (Which tends not to flip buffers when the window is not visible.)
* drm: fix setting up connectorsrr-2015-11-111-1/+1
| | | | Fixes regression from 67caea357c23443cf583ad401a38bbaae19e3df8.
* vd_lavc: be more careful with flushing the decoderwm42015-11-102-5/+22
| | | | | | | | | | | | | | | | | Until now, we've relied on the following things: - you can send flush packets to the decoder even if it's fully flushed, - you can send new packets to a flushed decoder, - you can send new packers to a partially flushed decoder. ("flushing" refers to sending flush packets to the decoder until the decoder does not return new pictures, not avcodec_flush_buffers().) All of these are questionable. The libavcodec API probably doesn't guarantee that these work well or at all, even though most decoders have no issue with these. But especially with hardware decoding wrappers (like MMAL), real problems can be expected. Isolate us from these corner cases by handling them explicitly.
* vo_opengl: move the glFlush() call to the rendererwm42015-11-102-5/+5
|
* vo_opengl_cb: better underflow reportingwm42015-11-101-6/+12
| | | | | | | This applies to unexpected freezes or deadlocks, not e.g. normal framedrops. The verbose messages also might remind an API user if the API usage is incorrect, such as not calling mpv_opengl_cb_draw() when a redraw request was issued.
* vo_opengl: limit GLSL to version 3.3wm42015-11-101-0/+2
| | | | | Fixes custom shaders, which define their entrypoint as sample() function.
* vo_opengl: fix 10-bit video prescalingBin Jin2015-11-095-24/+21
| | | | | | | | | | | The nnedi3 prescaler requires a normalized range to work properly, but the original implementation did the range normalization after the first step of the first pass. This could lead to severe quality degradation when debanding is not enabled for NNEDI3. Fix this issue by passing `tex_mul` into the shader code. Fixes #2464
* vo_opengl_cb: make operation more similar to normal VOswm42015-11-091-118/+54
| | | | | | | | | | | | | | | | | | | | | vo_opengl_cb is a special case, because we somehow have to render video asynchronously, all while "trusting" the API user to do it correctly. This didn't quite work, and a while ago a compromise using a timeout to prevent theoretically possible deadlocks was added. Make it even more synchronous. Basically, go all the way, and synchronize rendering between VO and user renderer thread to the full extent possible. This means the silly frame queue is dropped, and we event attempt to synchronize the GL SwapBuffer call (via mpv_opengl_cb_report_flip()). The changes introduced with commit dc33eb56 are effectively dropped. I don't even remember if they mattered. In the future, we might make all VOs fetch asynchronously from a frame queue, which would mostly remove the differences between vo_opengl and vo_opengl_cb, but this will take a while (if it will even be done).
* vo_opengl: handle GL_ARB_uniform_buffer_object with low GLSL versionswm42015-11-095-6/+19
| | | | Why is this stupid crap being so much a pain for no reason.
* vo_opengl: fix extension namewm42015-11-091-1/+1
|
* vo_opengl: simplify GLSL version detectionwm42015-11-091-10/+4
| | | | | | | | | | | Pick the correct GLSL version from the GL_SHADING_LANGUAGE_VERSION string. Might be somewhat questionable, as we expect the minor version number not to have leading 0s. Should help with cases when the reported GLSL version is much higher than the equivalent of the reported GL version. This problem was observed in combination with GL_ARB_uniform_buffer_object, which can't be used if the declared GLSL version is too low.
* vo_opengl: never load vaapi GLX interop by defaultwm42015-11-095-8/+8
| | | | | | | Causes more harm than it helps. Will eventually be removed. Also rename the "reject_emulated" field to "probing" - this is more appropriate now.
* vo_opengl: always preload hwdec interopwm42015-11-091-3/+6
| | | | | | | | | Simplifies some auto detection matters. I _still_ don't want to remove the lazy loading mechanism, because it's still slightly useful for filters using the hwdec APIs. My main motivation for not always preloading them is actually that libva prints random useless crap to the terminal with no way to prevent this.
* vo_opengl: rename "drm_egl" to "drm-egl"wm42015-11-091-1/+1
|
* vo_opengl: disable drm_egl autopickuprr-2015-11-091-0/+4
|
* win32: request MMCSS "Playback" profilewm42015-11-081-0/+10
|
* vo_drm: relicense to LGPLrr-2015-11-083-10/+15
| | | | | Also removed authorship information (as per convention seen in other files)
* vo_drm: use bool rather than integer return valuesrr-2015-11-084-78/+60
| | | | | Since the errors weren't used for anything other than simple success/fail checks, I simplified things a bit.
* vo_opengl: add DRM EGL backendrr-2015-11-082-0/+439
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: - Unfortunately the only way to talk to EGL from within DRM I could find involves linking with GBM (generic buffer management for Mesa.) Because of this, I'm pretty sure it won't work with proprietary NVidia drivers, but then again, last time I checked NVidia didn't offer proper screen resolution for VT. - VT switching doesn't seem to work at all. It's worth mentioning that using vo_drm before introduction of VT switcher had an anomaly where user could switch to another VT and input text to it, while video played on top of that VT. However, that isn't the case with drm_egl: I can't switch to other VT during playback like this. This makes me think that it's either a limitation coming from my firmware or from EGL/KMS itself rather than a bug with my code. Nonetheless, I still left (untestable) VT switching code in place, in case it's useful to someone else. - The mode_id, connector_id and device_path should be configurable for power users and people who wish to watch videos on nonprimary screen. Unfortunately I didn't see anything that would allow OpenGL backends to register their own set of options. At the same time, adding them to global namespace is pointless. - A few dozens of lines could be shared with vo_drm (setting up VT switching, most of code behind page flipping). I don't have any strong opinion on this. - Sometimes I get minor visual glitches. I'm not sure if there's a race condition of some sort, unitialized variable (doubtful), or if it's buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa) - .config and .control are very minimal. Signed-off-by: wm4 <wm4@nowhere>
* vo_drm: move initialization to drm_commonrr-2015-11-083-219/+278
| | | | | Makes KMS initialization procedures reusable so that they can be used by the upcoming DRM EGL adapter.
* vo_opengl: fix typorr-2015-11-071-1/+1
|
* vo_opengl: rename fancy-downscaling to correct-downscalingwm42015-11-072-10/+9
| | | | The old name was stupid. Very stupid.
* vo_opengl: fancy-downscaling: enable also for anamorphic clipsAvi Halachmi (:avih)2015-11-071-4/+9
|
* x11: print Xlib errors in verbose mode if Xlib messages are silencedwm42015-11-071-9/+5
| | | | Follow up to commit b984ec52.
* vo_opengl: x11: silence error messages when using legacy GL contextwm42015-11-063-2/+16
| | | | | | | | glXCreateContextAttribsARB() by design can throw some X11 errors. We ignore these, but we generally still print error messages to the terminal. This was confusing/annoying users, so silence it. The stupid part is that the Xlib error handler is global, so we have to be slightly careful here.
* Remove some VLAswm42015-11-063-14/+16
| | | | | | | | They are evil and should be eradicated. Some of these were pretty dumb anyway. There are probably some more around in platform specific code or other code not enabled by default on Linux.
* w32: use DisplayConfig API to retrieve correct monitor refresh rateJames Ross-Gowan2015-11-063-18/+301
| | | | | | | | | | This is based on an older patch by James Ross-Gowan. It was rebased and cleaned up. Also, the DWM API usage present in the older patch was removed, because DWM reports nonsense rates at least on Windows 8.1 (they are rounded to integers, just like with the old GDI API - except the GDI API had a good excuse, as it could report only integers). Signed-off-by: wm4 <wm4@nowhere>
* w32: always get screenrc from an HMONITORJames Ross-Gowan2015-11-061-21/+41
| | | | | | | | | | | | | | | | This simplifies update_screen_rect a bit. Unless --fs-screen=all is used, it will always get an HMONITOR and call GetMonitorInfo to determine its dimensions. This will make it easier for the next few commits to determine the colour profile and the refresh rate from the HMONITOR. There is a slight change in behaviour. When selecting a screen that is out of range, such as --screen=9 on a machine with only two monitors, the old code would silently select the last existing monitor. The new code prints an error message and falls back to the default screen (same as the Cocoa code.) Signed-off-by: wm4 <wm4@nowhere>
* w32: remove Win95 and NT4 monitor codeJames Ross-Gowan2015-11-061-25/+4
| | | | | | | | | | | | | | The call to EnumDisplaySettings seems to be a relic from when MPlayer ran on systems that didn't have GetMonitorInfo or SM_CX/CYVIRTUALSCREEN. GetMonitorInfo was loaded dynamically, so it was possible for MPlayer to run without it and use the values returned by EnumDisplaySettings. These are always present in modern versions of Windows, so the values returned from EnumDisplaySettings are always overwritten. Remove the call to EnumDisplaySettings and assume SM_CX/CYVIRTUALSCREEN is always present. Signed-off-by: wm4 <wm4@nowhere>
* video: increase avi pts buffer sizewm42015-11-061-1/+1
| | | | | When decoding on RPI/MMAL, the buffering between decoder input and output can be quite excessive.
* vo_opengl: simplify function loader slightlywm42015-11-061-6/+0
| | | | | We don't use any functions that have been deprecated in any later GL or GLES functions. (This is a leftover of vo_opengl_old support.)
* vo_opengl: glBindBufferBase is not part of GL 2.1/GLES 2.0wm42015-11-062-2/+2
| | | | | | | | Commit 27dc834f added it as such. Also remove the check for glUniformBlockBinding() - it's part of an extension, and the check glGetUniformBlockIndex() already checks whether the extension is fully available.
* vo_opengl: implement NNEDI3 prescalerBin Jin2015-11-059-5/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement NNEDI3, a neural network based deinterlacer. The shader is reimplemented in GLSL and supports both 8x4 and 8x6 sampling window now. This allows the shader to be licensed under LGPL2.1 so that it can be used in mpv. The current implementation supports uploading the NN weights (up to 51kb with placebo setting) in two different way, via uniform buffer object or hard coding into shader source. UBO requires OpenGL 3.1, which only guarantee 16kb per block. But I find that 64kb seems to be a default setting for recent card/driver (which nnedi3 is targeting), so I think we're fine here (with default nnedi3 setting the size of weights is 9kb). Hard-coding into shader requires OpenGL 3.3, for the "intBitsToFloat()" built-in function. This is necessary to precisely represent these weights in GLSL. I tried several human readable floating point number format (with really high precision as for single precision float), but for some reason they are not working nicely, bad pixels (with NaN value) could be produced with some weights set. We could also add support to upload these weights with texture, just for compatibility reason (etc. upscaling a still image with a low end graphics card). But as I tested, it's rather slow even with 1D texture (we probably had to use 2D texture due to dimension size limitation). Since there is always better choice to do NNEDI3 upscaling for still image (vapoursynth plugin), it's not implemented in this commit. If this turns out to be a popular demand from the user, it should be easy to add it later. For those who wants to optimize the performance a bit further, the bottleneck seems to be: 1. overhead to upload and access these weights, (in particular, the shader code will be regenerated for each frame, it's on CPU though). 2. "dot()" performance in the main loop. 3. "exp()" performance in the main loop, there are various fast implementation with some bit tricks (probably with the help of the intBitsToFloat function). The code is tested with nvidia card and driver (355.11), on Linux. Closes #2230
* vo_opengl: add Super-xBR filter for upscalingBin Jin2015-11-056-7/+499
| | | | | | | | | | | Add the Super-xBR filter for image doubling, and the prescaling framework to support it. The shader code was ported from MPDN extensions project, with modification to process luma only. This commit is largely inspired by code from #2266, with `gl_transform_trans()` authored by @haasn taken directly.
* vo_opengl: make image size dynamic during renderingBin Jin2015-11-051-24/+33
| | | | | This commit marks the image size variables temporary, and renames them in order to prevent any potential confusion in the future.
* rpi: add support for codecs other than h264wm42015-11-053-7/+20
| | | | FFmpeg now supports h264 and mpeg2. At least vc-1 will probably follow.
* vo_vdpau: check VDP_RGBA_FORMAT_A8 supportwm42015-11-041-2/+6
| | | | | Apparently not all vdpau drivers in the wild support this format (VDPAU SUNXI can't). Revert to RGB in these cases.
* vo_opengl_cb: log some eventswm42015-11-041-0/+4
| | | | | | | | | | The noframe event is logged whenever there is no new frame. This can happen due to normal redraws, but also due to video frame queue underflow. The mpv_opengl_cb_report_flip() API function is currently pretty useless, because blocking on the video frame queue is more reliable and simpler. But at least we can log the actual vsync.
* vo_opengl, vo_opengl_cb: drop unneeded vo_frame fieldswm42015-11-044-28/+6
| | | | | | | | | next_vsync/prev_vsync was only used to retrieve the vsync duration. We can get this in a simpler way. This also removes the vsync duration estimation from vo_opengl_cb.c, which is probably worthless anyway. (And once interpolation is made display-sync only, this won't matter at all.)
* vo: do not go to sleep if there's a new frame queuedwm42015-11-031-3/+3
| | | | | | This affects only the display-sync code path, as for normal timing the wakeup_pts stuff handles proper wakeup. It's probably mostly a theoretical issue.
* vd_lavc: make hwdec fallback more tolerantwm42015-11-032-6/+14
| | | | | | | | | | | | A hw decoder might fail to decode a frame for multiple reasons, and not always just because decoding is impossible. We can't generally distinguish these reasons well. Make it more tolerant by accepting failures of 3 frames, but not more. The threshold can be adjusted by the repurposed --vd-lavc-software-fallback option. (This behavior was suggested much earlier in some PR, but at the time the "proper" hwdec fallback was indistinguishable from decoding error. With the current situation, "proper" fallback is still instantious.)
* vo: fix display-sync frame drop accounting againwm42015-11-031-1/+1
| | | | | Commit acd5816a fixed this, except when vo_opengl interpolation was active. (And again, the old interpolation code path should be removed.)
* vdpau: fix uninit when init failswm42015-11-012-5/+2
| | | | | | | | | | The uninit() function was called twice if the uninit() function failed (once by init(), once by vd_lavc.c code), which caused crashes due to double-free. (This failure is a corner case, and all other hwdec backends appear to handle this case gracefully.) I do not think this code should be able to deal with uninit() being called other than once. Guarantee that it's called exactly once.
* vo_opengl: win32: fix cross-compilationwm42015-11-011-1/+1
| | | | MXE uses an all-lowercase convention for MS headers.
* vo_opengl: win32: always request MMCSS for DWMwm42015-11-011-0/+5
| | | | | | | | | | | | | | | | | | Quoting MSDN: "Notifies the Desktop Window Manager (DWM) to opt in to or out of Multimedia Class Schedule Service (MMCSS) scheduling while the calling process is alive.". Whatever this means. (An application can change the s