summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* win32: allow multiple windows at the same timewm42015-09-221-6/+1
| | | | | | | | | | | | | | | | Window classes are process-wide (or at least DLL-wide), so you can't have 2 classes with the same name. Our code attempted to do this when for example 2 libmpv instances were created within the same process. This failed, because RegisterWindowEx() fails if the class already exists. Fix this by ignoring RegisterWindowEx() errors. If the class can really not be registered, we will fail on CreateWindowEx() instead. Of course we also can't unregister the class, as another thread might be using it. Windows will free the class automatically if the DLL is unloaded or the process terminates. Fixes #2319 (hopefully).
* vf_yadif: add hack for Libav compatibilitywm42015-09-201-3/+12
| | | | | | Libav accepts slightly different options compared to FFmpeg. Sigh... This was "broken" in 25755f5f. Fixes #2335.
* vf_vdpaurb: query_format is still requiredPhilip Langdale2015-09-181-0/+6
| | | | | | | I took this out because I thought the filter chain would auto-negotiate using nv12 without the explicit hint, and it does in the basic case with no intermediate filter, but once you start adding filters, it can end up negotiating a different format and then failing.
* vf_vdpaurb: Pass through non-hardware-decoded contentPhilip Langdale2015-09-151-9/+8
| | | | | | | | | | Today, vdpaurb will fail if it's used with non-hardware-decoded content. This created work for the user as they have to explicitly add or not add it, depending on the content. As an improvement, we can make vdpaurb pass through any frames that aren't hardware decoded, so that it can always be present in the filter chain, if desired.
* video/filter: remove some vf_lavfi wrapperswm42015-09-115-304/+0
| | | | | | | | | | | | | | | | I see no point in keeping these around. Keeping wrappers for some select libavfilter filters just because MPlayer had these filters is not a good reason. Ultimately, all real filtering work should go to libavfilter, and users should get used to using vf_lavfi directly. We might even not require the awful double-nested syntax for using libavfilter one day. vf_rotate, vf_yadif, vf_stereo3d are kept because mpv uses them internally. (They all extend the lavfi filters or change their defaults.) vf_mirror is kept for symmetry with vf_flip. vf_gradfun and vf_pullup are probably semi-popular, so I'll remove them not yet - only after some more discussion.
* vf_lavfi: cosmetics: fix coding stylewm42015-09-111-11/+11
|
* vf: vf_stereo3d depends on libavfilterwm42015-09-111-1/+1
|
* video: make --field-dominance set interlaced flagKevin Mitchell2015-09-101-4/+6
| | | | fixes #2289
* vo_rpi: fix compilationwm42015-09-111-2/+2
| | | | The recent OpenGL refactor commits forgot to update this file.
* video: do not use deprecated libavutil pixdesc fieldswm42015-09-101-5/+15
| | | | | | These were normalized and are saner now. We want to use the new fields, and also get rid of the deprecation warnings, so use them. There's no release yet which uses these, so some ifdeffery is unfortunately needed.
* vo_opengl: fix shader compilation with debanding and OSX hwdecwm42015-09-103-8/+10
| | | | | | 2 things are being stupid here: Apple for requiring rectangle textures with their IOSurface interop for no reason, and OpenGL having a different sampler type for rectangle textures.
* vo_opengl: move sampler type mapping to a functionwm42015-09-102-7/+14
|
* vo_opengl: fix deband sub-option handlingwm42015-09-091-1/+6
| | | | This all has to be done manually.
* vo_opengl: implement debanding (and remove source-shader)Niklas Haas2015-09-096-84/+195
| | | | | | | | | | The removal of source-shader is a side effect, since this effectively replaces it - and the video-reading code has been significantly restructured to make more sense and be more readable. This means users no longer have to constantly download and maintain a separate deband.glsl installation alongside mpv, which was the only real use case for source-shader that we found either way.
* vo_opengl: move self-contained shader routines to a separate fileNiklas Haas2015-09-094-348/+424
| | | | | | | | | | | This is mostly to cut down somewhat on the amount of code bloat in video.c by moving out helper functions (including scaler kernels and color management routines) to a separate file. It would certainly be possible to move out more functions (eg. dithering or CMS code) with some extra effort/refactoring, but this is a start. Signed-off-by: wm4 <wm4@nowhere>
* vo_opengl: reduce code duplication for scaler optionsNiklas Haas2015-09-091-33/+16
| | | | | This simple refactor cuts down on the immense amount of overhead and duplication across all of the related scale-* options.
* vo_opengl: remove gl_ prefixes from files in video/out/openglNiklas Haas2015-09-0926-40/+40
| | | | | This is a bit redundant with the name of the directory itself, and not in line with existing naming conventions.
* vo_opengl: move gl_* files to their own subdirNiklas Haas2015-09-0926-24/+24
| | | | | This is mainly just to keep things a bit more organized and separated inside the codebase.
* vo_opengl: minor refactorNiklas Haas2015-09-091-5/+5
| | | | | Just making the argument order for pass_load_fbotex more consistent with finish_pass_fbo.
* vo_opengl: filter allowed options in dumb-modewm42015-09-081-14/+14
| | | | | | | Instead of the other way around of disabling disallowed options. This is more robust and also slightly simpler, at least conceptually. If new vo_opengl features are added, they don't need to be explicitly disabled for dumb-mode just to avoid that it accidentally breaks.
* vo_opengl: move gl_video_opts copying code to separate functionwm42015-09-082-15/+22
| | | | | | | | | | Sigh... Hopefully this code will be completely unnecessary one day, as it's only needed due to the sub-option parser craziness. Move dumb_mode to the top of the struct, so the C universal initializer doesn't cause warnings with all those broken compilers.
* vo_opengl: restore single pass optimization as separate code pathwm42015-09-072-30/+78
| | | | | | | | | | | | | | | | | | | | | | The single path optimization, rendering the video in one shader pass and without FBO indirections, was removed soem commits ago. It didn't have a place in this code, and caused considerable complexity and maintenance issues. On the other hand, it still has some worth, such as for use with extremely crappy hardware (GLES only or OpenGL 2.1 without FBO extension). Ideally, these use cases would be handled by a separate VO (say, vo_gles). While cleaner, this would still cause code duplication and other complexity. The third option is making the single-pass optimization a completely separate code path, with most vo_opengl features disabled. While this does duplicate some functionality (such as "unpacking" the video data from textures), it's also relatively unintrusive, and the high quality code path doesn't need to take it into account at all. On another positive node, this "dumb-mode" could be forced in other cases where OpenGL 2.1 is not enough, and where we don't want to care about versions this old.
* vo_opengl: move video source rectangle computation to a functionwm42015-09-071-18/+29
| | | | Needed for the following commit.
* vo_opengl: comsetics: remove unnecessary line breakwm42015-09-071-4/+2
|
* vo_opengl: require FBOs and get rid of the single-pass optimizationNiklas Haas2015-09-071-82/+34
| | | | | | | This change makes vo_opengl slightly less compatible (ancient devices without FBOs will no longer work) and decreases performance in the simplest case (vo=opengl), in exchange for significantly reducing code complexity and making everything easier to reason about.
* vo_opengl: use the correct attribute name for vertex positionwm42015-09-041-2/+2
| | | | | | This didn't seem entirely sane. It probably worked by accident, because "position" is always the first attribute, and thus the default value 0 for the location was always correct.
* vd_lavc: better hwdec log outputwm42015-09-022-4/+17
| | | | | | | | | | | | Often, we don't know whether hardware decoding will work until we've tried. (This used to be different, but API changes and improvements in libavcodec led to this situation.) We will often output that we're going to use hardware decoding, and then print a fallback warning. Instead, print the status once we have decoded a frame. Some of the old messages are turned into verbose messages, which should be helpful for debugging. Also add some new ones.
* vd_lavc: factor all hwdec fallbacks into the same functionwm42015-09-021-24/+19
| | | | | | | | The fallback at initialization time was basically duplicated, maybe for the sake of showing a different error message. This doesn't matter anymore; not much can fail at initialization anymore. Most meaningful and common errors happen either at probing or in get_format (when the actual hw decoder is initialized).
* vo_opengl: improve robustness against PBO failurewm42015-09-021-29/+40
| | | | | | | | | | | | | | If PBO upload fails, disable PBOs and revert to the normal codepath. In theory we should retry PBO upload on failure (because OpenGL specifies that it can sporadically fail), but since it normally doesn't happen, and the fallback will work, I'm not bothering. Some restructuring is needed, since glUnmapBuffer needs to be called earlier. In fact, the old code structure didn't make too much sense, and is a leftover from MPlayer's direct rendering support, which let the decoder decode to a PBO-mapped region. This means the buffer_ptr field can be dropped. Drop buffer_size as well, since it only had 2 possible values (0 or the size required for the current config).
* vo_opengl: enable pbo by default with opengl-hqwm42015-09-021-0/+1
| | | | | | | | | Can significantly help with very large video resolutions on nvidia drivers. It doesn't seem to have negative effects on Intel drivers either. (Although it could have on Intel drivers for older hardware.) For now, this is only for --vo=opengl-hq. Maybe --vo=opengl should use it too, but it's still meant to be the crappy, fail-safe default.
* vo_opengl: slightly simplify plane size determinationwm42015-09-021-2/+5
| | | | | | | | Setup a dummy image for the given image params, and get the plane sizes from that. Admittedly not much of a simplification, but conceptually it's simpler and less error-prone, as the image layout is guaranteed to be the same, rather than essentially duplicating the way it is determined.
* vo_opengl: don't distinguish "real" and texture sizewm42015-09-023-34/+28
| | | | | | | | This is from times when we supported padded/non-NPOT textures. The difference is not useful anymore, and theoretical support for different sizes is most likely buggy and unmaintained. So remove it. Also remove the tex_ prefix wherever it appears.
* vo_opengl: simplify PBO copywm42015-09-021-6/+2
| | | | | | | | Use mp_image_copy() instead of copying manually. (This function checks whether the destination is regarded writeable, which it is not, because the destination is the source image with changed pointers, so refcounting has to be removed from the destination image by resetting mpi->bufs.)
* vo_opengl: rename get_image to map_imagewm42015-09-021-2/+2
|
* vo_opengl: remove redundant statement in PBO codewm42015-09-022-5/+0
| | | | | | | | This shouldn't be needed anymore. Textures are now always allocated with the exact size. Any padding (including non-NPOT support) is gone. The texture sizes will always match the memory plane sizes. Drop the unused and forgotten "npot" field from the option struct too.
* vo_opengl: remove some leftoverswm42015-09-011-4/+0
| | | | Forgotten in the previous commit.
* vo_opengl, vda: return to old statewm42015-09-012-31/+5
| | | | | | | | Undo 292266f2. Reapply 3e12e79b. An additional copy is not really justified, as it could reduce performance. On the other hand, we can force API users to create a GL 3.x context.
* vo_rpi, vo_opengl: do not globally terminate EGL on VO uninitwm42015-08-311-2/+1
| | | | | | | | | eglTerminate() affects the EGLDisplay in all threads. Since the RPI firmware apparently only ever uses EGL_DEFAULT_DISPLAY, this means it will trash all other contexts on other threads in the same process. Thus we don't call eglTerminate() at all, at least on RPI. Call eglReleaseThread() instead (which may or may not be a NOP).
* vo_opengl: fix alpha video in one casewm42015-08-301-0/+2
| | | | | | | | | yuva444p worked, yuva420p didn't. This happened because the chroma pass discards the alpha plane, which is referenced by the alpha blend code later. Add a terrible hack to work this around, actually using the same hack as was used for the Y plane. (A terrible hack for terrible code.)
* video: make container vs. bitstream aspect ratio configurablewm42015-08-302-17/+38
| | | | | | Utterly idiotic bullshit. Fixes #2259.
* w32: shift drag and drop appendsKevin Mitchell2015-08-301-2/+4
| | | | use the append to playlist functionality if shift is pressed while dropping
* x11: drag and drop append with modifierKevin Mitchell2015-08-302-1/+8
| | | | | | | If the drag and drop action is anything other than XdndActionCopy, append the dropped files rather than replacing the existing playlist. With most file managers, this will mean at least pressing shift while dropping.
* input: add append argument to file drop eventKevin Mitchell2015-08-303-4/+5
| | | | | | This puts in place the machinery to merely append dropped file to the playlist instead of replacing the existing playlist. In this commit, all front-ends set this to false preserving the existing behaviour.
* vo_opengl: force redraw when framestepping with interpolationwm42015-08-251-1/+3
| | | | | | | | | | | | | | | | This might fix some problems when framestepping with interpolation enabled. The problem here is that we want to show the non-interpolated frame while paused. Framestepping is like unpausing the video for a frame, and then pausing again. This draws an interpolated frame, and redrawing on pausing is supposed to take care of this. This possibly didn't always work, because vo->want_redraw is not checked by the vo_control() code path. So wake up the VO thread (which takes care of servicing redraw requests, kind of) explicitly. The correct solution is getting rid of the public-writable want_redraw field and replacing it with a new vo_request_redraw() function, but this can come later.
* vd_lavc: bump number of allocated surfaces for hwdec with HEVCwm42015-08-241-1/+4
|
* vaapi: add HEVC profile entrieswm42015-08-241-0/+10
| | | | | | | libavcodec does not support HEVC via VAAPI yet, so this won't work. However, there is ongoing work to add HEVC support to VAAPI, and this change might help with testing. (Or maybe not - but there is no harm in this change.)
* vda, videotoolbox: guard against unexpected pixel formatwm42015-08-231-0/+4
| | | | | | Should not happen, but since we don't control decoder video surface allocation, anything could happen, and the code should be able to deal with it. Untested.
* vda, videotoolbox: fix broken condition in screenshot codewm42015-08-231-1/+1
| | | | Fixes #2237.
* vo_opengl: remove dead codewm42015-08-221-9/+0
| | | | Leftover from 3245bfef.
* gl_wayland: Wait for frame callbacksJari Vetoniemi2015-08-211-0/+5
| | | | | Keep glSwapInterval(0) on to avoid blocking on gl calls, but wait for frame callbacks so we play nice with compositor.
* vo_wayland: Wait for frame callbacksJari Vetoniemi2015-08-213-18/+84
| | | | | | | Privdes small api for vo_wayland where one can request frame callback and then wait for it. This will make vo_wayland play video smoothly.
* gl_wayland: eglSwapInterval(0) to avoid blockingJari Vetoniemi2015-08-213-18/+14
| | | | This makes mesa not wait for frame callback internally.
* vo_opengl: add tscale-clamp optionNiklas Haas2015-08-204-2/+9
| | | | | | | | | | This significantly reduces the amount of noticeable flashing when using tscale kernels with negative lobes, by cutting them off completely. I'm not sure if this has any negative effects. It needs a bit of subjective testing over a period of time, so I just made it an option. Fixes #2155.
* vo_rpi: disable background by defaultwm42015-08-201-6/+13
| | | | And add an option to enable it.
* gl_rpi: destroy the EGLSurface toowm42015-08-201-2/+5
| | | | Most likely doesn't matter much.
* vo_rpi: use correct variable for osd layerwm42015-08-201-1/+1
| | | | | This is a cosmetic change, because the value is exactly the same. (The old code just duplicates the logic, sort of.)
* vo_rpi: fix blackscreen before the first subtitle/OSD is renderedwm42015-08-201-0/+1
| | | | | The OSD overlay wasn't initialized, so it remained solid black until the first time a subtitle line or an OSD element became visible.
* vd_lavc: remove unneeded hwdec parameterswm42015-08-198-25/+16
| | | | | | | All hwdec backends now use a single pixel format, and the format is always checked. Also, the init_decoder callback is now mandatory.
* vo_rpi: redraw subtitles only on changewm42015-08-183-4/+33
| | | | | | | | | | | Since vo_rpi uses MMAL for video output, which is completely independent from the GLES overlay, we can just not redraw the GLES screen if subtitles do not change. (As a furhter optimization, the dispmanx overlay could be removed if nothing is visible. But I'm not sure if adding and removing the overlay frequently is a good idea for performance, so this could just as well go the other way.)
* vo_rpi: use EGL to render subtitleswm42015-08-183-125/+85
| | | | | | | | Slightly faster than using the dispmanx mess (perhaps to a large amount due to the rather stupid C-only unoptimized ASS->RGBA blending code). Do this by reusing vo_opengl's subtitle renderer, and vo_opengl's RPI backend.
* rpi: factor out context creationwm42015-08-182-63/+108
| | | | To be used by vo_rpi.c. No functional changes.
* video: fix VideoToolbox/VDA autodetectionwm42015-08-174-44/+24
| | | | | | | | | | | | | | | This affects vo_opengl_cb in particular: it'll most likely auto-load VDA, and then the VideoToolbox decoder won't work. And everything fails. This is mainly caused by FFmpeg using separate pixfmts for the _same_ thing (CVPixelBuffers), simply because libavcodec's architecture demands that hwaccel backends are selected by pixfmts. (Which makes no sense, but now we have the mess.) So instead of duplicating FFmpeg's misdesign, just change the format to our own canonical one on the image output by the decoder. Now the GL interop code is exactly the same for VDA and VT, and we use the VT name only.
* vo_rpi: fix NULL pointer derefwm42015-08-141-1/+1
| | | | Can happen in obscure situations and with hw decoding disabled.
* vo_rpi: simplify background handlingwm42015-08-131-19/+1
| | | | Apparently this is sufficient.
* vo_rpi: unregister vsync callbackwm42015-08-131-1/+3
| | | | Small bug, much pain.
* vo_rpi: skip OSD rendering when repeating frameswm42015-08-131-4/+8
| | | | It's unnecessary and slow. Doesn't help too much, though.
* vo: fix