summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* player: respect --untimed on last framewm42015-01-161-2/+1
| | | | | | | | | | | | | | The last video frame is another case that has a separate code path, although it's pretty similar to the one in commit 73e5aa87. Fix this in a different way, which also takes care of the last frame case, although without context the code becomes slightly more tricky. As further cleanup, move the decision about framedropping itself to the same place, so the check in vo.c becomes much simpler. The check for the vo->driver->encode flag, which is remvoed completely, was redundant too. Fixes #1480.
* vo_opengl: get rid of approx-gamma and make it the default as per BT.1886Niklas Haas2015-01-163-56/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | After finding out more about how video mastering is done in the real world it dawned upon me why the "hack" we figured out in #534 looks so much better. Since mastering studios have historically been using only CRTs, the practice adopted for backwards compatibility was to simulate CRT responses even on modern digital monitors, a practice so ubiquitous that the ITU-R formalized it in R-Rec BT.1886 to be precisely gamma 2.40. As such, we finally have enough proof to get rid of the option altogether and just always do that. The value 1.961 is a rounded version of my experimentally obtained approximation of the BT.709 curve, which resulted in a value of around 1.9610336. This is the closest average match to the source brightness while preserving the nonlinear response of the BT.1886 ideal monitor. For playback in dark environments, it's expected that the gamma shift should be reproduced by a user controlled setting, up to a maximum of 1.224 (2.4/1.961) for a pitch black environment. More information: https://developer.apple.com/library/mac/technotes/tn2257/_index.html
* vo_opengl: add ewa_lanczos upscaler (aka jinc)Niklas Haas2015-01-154-29/+151
| | | | | This is the polar (elliptic weighted average) version of lanczos. This introduces a general new form of polar filters.
* vo_opengl_cb: initial screenshot supportwm42015-01-151-0/+10
| | | | | | | | | | | Support for taking screenshots when doing hardware decoding needs to be added later. This takes the last image queued to the VO, which is logically the image the player thinks is on screen (so e.g. subtitles will match). forget_frames() does not clear this, because seeking does not remove the current image from the screen (until the next one is drawn).
* image_writer: check for conversion errorswm42015-01-153-11/+17
| | | | | This can happen when e.g. a VO returns a screenshot in an unsupported format.
* vf: make message less confusingwm42015-01-131-1/+1
| | | | | Well, probably still not very good, but now at least accounts for the case the decoder or a filter outputs nonsense values.
* mp_image: reject invalid display aspect ratiowm42015-01-131-1/+1
| | | | | | | | | | Having any of these set to 0 makes no sense. I think some code might still be using 0/0 aspect ratio to signal unset aspect ratio, but I didn't find it. If there is still code like this, it should be fixed instead. Fixes #1467.
* wayland: implement key modifierswm42015-01-121-18/+24
| | | | Includes shift, ctrl, alt, meta.
* wayland: don't compute absurd window sizewm42015-01-121-3/+6
| | | | | | | | | For some reason, schedule_resize() can be called with everything set to 0. The code couldn't handle wl->window.aspect set to 0, converting NaNs to integers. Just work this around. (I have no idea what I'm doing. This is probably a corner case caused by my broken-ish wayland setup.)
* x11: explicitly query map status when waiting for map eventwm42015-01-121-0/+6
| | | | | | | | For some reason, mpv sometimes does not get a MapNotify event with GtkSocket embedding. This happens maybe 1 out of 10 times. I'm not sure how this can happen - it certainly shouldn't. Since I was not able to find the cause, and causes an apparent "deadlock", here's a lazy hack to fix the misbehavior.
* x11: support XEmbedwm42015-01-121-0/+49
| | | | | | | | | | | | Seems to work with GtkSocket and passing the gtk_socket_get_id() value via "wid" option to mpv. One caveat is that using <tab> to move input focus from mpv to GTK does not work. It seems we would have to interpret <tab> ourselves in this case. I'm not sure if we really should do this - it would probably require emulating some other typical conventions too. I'm not sure if an embedder could do something about this on the toolkit level, but in theory it would be possible, so leave it as is for now.
* vo: don't synchronize when seekingwm42015-01-121-1/+7
| | | | | | | | | Don't use vo_control() for sending VOCTRL_RESET when starting a seek. This means vo_seek_reset() won't wait until the VO actually processed VOCTRL_RESET. It happens asynchronously instead. The impact of this change should be minimal, unless the VO is somehow too busy (like blocking on vsync).
* command: change properties added in previous commitwm42015-01-101-1/+3
| | | | | | | | | | | | | Make their meaning more exact, and don't pretend that there's a reasonable definition for "bits-per-pixel". Also make unset fields unavailable. average_depth still might be inconsistent: for example, 10 bit 4:2:0 is identified as 24 bits, but RGB 4:4:4 as 12 bits. So YUV formats seemingly drop the per-component padding, while RGB formats do not. Internally it's consistent though: 10 bit YUV components are read as 16 bit, and the padding must be 0 (it's basically like an odd fixed- point representation, rather than a bitfield).
* video: Add sigmoidal upscaling to avoid ringing artifactsNiklas Haas2015-01-093-1/+56
| | | | | | | | | This avoids issues when upscaling directly in linear light, and is the recommended way to upscale images according to imagemagick. The default slope of 6.5 offers a reasonable compromise between ringing artifacts eliminated and ringing artifacts introduced by sigmoid-upscaling. Same goes for the default center of 0.75.
* vo_opengl_cb: make mpv_opengl_cb_render() return left framesxylosper2015-01-081-2/+3
| | | | | | Instead of error code which was not helpful because it's always 0, mpv_opengl_cb_render() returns the number of left frames in the frame queue now.
* vo_opengl_cb: use vo's drop_count instead of internal counterxylosper2015-01-081-6/+15
| | | | | This commit makes it possible to query dropped frames by opengl-cb through vo-drop-frame-count property.
* vo: add functions to increment drop_countxylosper2015-01-082-0/+8
| | | | | Add two functions which increment drop_count thread-safely. This is for the commit followed.
* vo_opengl_cb: introduce frame queuexylosper2015-01-081-18/+90
| | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation of opengl-cb kept only latest flipped frame. This can cause massive frame drops because rendering is done asynchronously and only the latest frame can be rendered. This commit introduces frame queue and releated options to opengl-cb. frame-queue-size: the maximum size of frame queue (1-100, default: 1) frame-drop-mode: behavior when frame queue is full (pop, clear, default: pop) The frame queue holds delayed frames and drops frames if the frame queue is overflowed with next method: 'pop' mode: drops all the oldest frames overflown. 'clear' mode: drops all frames in queue and clear it. With default options(frame-queue-size=1:frame-drop-mode=pop), opengl-cb behaves in the same way as previous implementation effectively. For frame-queue-size > 1, opengl-cb tries to calls update() without waiting next flip_page() in order to consume queued frames. Signed-off-by: wm4 <wm4@nowhere>
* win32: minor simplificationwm42015-01-081-3/+2
| | | | The events parameter is not needed here and won't ever be.
* vo_opengl: don't crash win32 backend with NULL eventswm42015-01-081-7/+7
| | | | | | | | | vo_opengl was crashing since f811348d because it passed NULL for the events parameter to vo_control. Normally the parameter should not be NULL, so add a hack to account for this. In particular, we should handle the events that are returned. For the call in preinit() we skip this, but it most likely has no meaning anyway, because in this stage no window is visible yet.
* vo_opengl_cb: fix a typowm42015-01-081-2/+2
|
* vo_opengl_cb: allow changing debug option at runtimewm42015-01-081-0/+1
| | | | | | | This was always supposed to work. Just add the option declaration. Normally I'm not a fan of duplicating such things, but in this case it's (still) harmless.
* vo_opengl_cb: fix flipped renderingwm42015-01-081-0/+1
| | | | Oops.
* vo_opengl: gl_lcms: implement change detection for memory profileswm42015-01-083-0/+26
| | | | | | | | | | This affects OSX, where memory profiles are updated e.g. on fullscreen switches. The profile most likely doesn't change, but the LUT will be generated and reloaded anyway. Somewhat of a regression from commit f811348. Fixes #1439.
* vo_opengl: gl_lcms: fix potential dangling pointer issuewm42015-01-081-4/+5
| | | | | | | If icc-path is set, but the thing is replaced with a memory profile, then p->icc_path would point to deallocated memory. Also, the NULL checks are unnecessary.
* vo_direct3d: fix shader colormatrix generationwm42015-01-071-5/+5
| | | | It was accidentally broken in d42d60bc1.
* win32: request UTF-16 API variants, Vista+ APIs, and COM C macroswm42015-01-074-11/+4
| | | | | Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into the build system, instead of defining them over and over in the code.
* x11: always use glXGetProcAddressARB()wm42015-01-071-1/+1
| | | | | | | | | | glXGetProcAddress() is outdated, and as far as I know doesn't give all the guarantees the "new" ARB function gives. Probably doesn't matter too much, because until now it always appeared to work. On the other hand, since this function is (bogusly) used only on the gl3 code path, it could have happened that users hit this, and just reverted to vo_opengl_old instead.
* gl_video.c: invalidate image_params in uninit_video()xylosper2015-01-071-0/+4
| | | | | | | | | | | | | When the given mp_image_params does not match with that of gl_video, gl_video_config() always calls uninit_video() but calls init_video() only if valid format is given. Since uninit_video() does not change image_params of gl_video, when the same params as the previous one is given to gl_video_config() after gl_video is unitialized with invalid format, gl_video_config() never calls init_video(). To prevent this, invalidate image_params of gl_video in uninit_video().
* vo_opengl: add support for in memory icc profilesStefano Pigozzi2015-01-075-172/+132
| | | | | | | | | | | Previously we just forced loading a profile from file, but that has poor integration for querying the OS / display server for an ICC profile, and generating profiles on the fly (which we might use in the future for creating preset 3dluts). Also changed the previous icc-profile-auto code to use this mechanism, and moved gl_lcms to be an opaque type with state instead of just providing pure functions.
* video: Remove some stale CMS code, minor cosmeticsNiklas Haas2015-01-073-17/+6
| | | | This removes an old code path that was disabled in 016bb14.
* dxva2: copy mp_image attributes to sw_imgJames Ross-Gowan2015-01-071-0/+1
|
* mp_image: copy missing attributesJames Ross-Gowan2015-01-071-0/+2
| | | | | This adds a couple of missing fields to mp_image_copy_attributes so things like rotation metadata work.
* vo_opengl_cb: implement equalizer controlswm42015-01-064-18/+49
| | | | | | | | | | | | | | | | This makes vo_opengl_cb respond to controls like "gamma" and "brightness". The commit includes an awkward refactor for vo_opengl to make it easier for vo_opengl_cb. One problem is a logical race condition. The set of supported controls depends on the pixelformat, which in turn is set by reconfig(). But the actual reconfig() call (on the renderer) happens asynchronously on the renderer thread. At the time it happens, the player most likely already tried to set some controls for command line options (see init_vo() in video.c). So setting this command line options will fail most of the time, though it could randomly succeed. This can't be fixed directly, because the player can't wait on the renderer thread, because the renderer thread might already wait on the player.
* csputils: use M_PIwm42015-01-061-1/+1
|
* csputils: replace float[3][4] with a structwm42015-01-065-101/+100
| | | | | Not being able to use the 3x3 part of the matrix was annoying, so split it into a float[3][3] matrix and a separate float[3] constant vector.
* csputils: move image_params -> csp_params into a functionwm42015-01-066-18/+24
| | | | | | | | | Although the line count increases, this is better for making sure everything is handled consistently for all users of the mp_csp_params stuff. This also makes sure mp_csp_params is always initialized with MP_CSP_PARAMS_DEFAULTS (for consistency).
* csputils: get rid of mp_csp_detailswm42015-01-067-34/+26
| | | | It used to be central, but now it's just unneeded.
* csputils: cosmeticswm42015-01-061-137/+112
| | | | Fix some coding style issues, remove doxygen formatting.
* vo_opengl_cb: don't resize when redrawingwm42015-01-061-1/+5
|
* video/out/win_state.c: fix --monitoraspectSoeren D. Schulze2015-01-051-1/+1
|
* vo_opengl_cb: support changing options at runtimewm42015-01-051-10/+66
| | | | | Like vo_opengl, but way messier, because the already messy config handling meets threading.
* vf_vapoursynth: autodetect CPU countwm42015-01-051-3/+8
| | | | | | | | This adds an "auto" choice to the concurrent-frames suboption, and makes it the default. I'm not so sure about making this the default, though. It could lead to excessive buffering with large CPU counts. But we'll see.
* player: print used number of threads in verbose modewm42015-01-051-1/+1
| | | | Also, don't use av_log() for mpv output.
* vo_opengl: remove obsolete comment in shaderwm42015-01-041-1/+1
|
* x11: make display-names property stricterwm42015-01-041-1/+3
| | | | | | | | | | | | | | Returning the property before the window is mapped could lead to confusing behavior, and in particular strange differences between vo_vdpau and vo_opengl. (vo_opengl creates the window right at the start, while vdpau waits until the first reconfigure event.) It might even be possible that for vo_opengl random results were returned, because the hidden window can have different placement than the actual, final one on initial video reconfig. Fix this by returning the property only if the window is considered mapped. command.c handles this case specifically, and makes the property unavailable, instead of returning an empty list.
* video: batch query_format callswm42015-01-032-6/+8
| | | | | | | There are currently 568 pixel formats (actually fewer, but the namespace is this big), and for each format elaborate synchronization was done to call it synchronously on the VO. This is completely unnecessary, and we can do with just a single call.
* vf_vapoursynth: fix Lua backendwm42015-01-031-0/+3
| | | | It couldn't handle the newly added float variable.
* vf_vapoursynth: pass through container FPS valuewm42015-01-032-0/+3
| | | | | | | | This is basically a hack; but apparently a needed one, since many vapoursynth filters insist on having a FPS set. We need to apply the FPS override before creating the filters. Also change some terminal output related to the FPS value.
* x11: make display-names property observablewm42015-01-031-0/+2
| | | | Reuse MP_EVENT_WIN_STATE for this.
* video: better pipelining with vf_vapoursynthwm42015-01-033-8/+73
| | | | | | | | | | Most of this is explained in the code comments. This change should improve performance with vapoursynth, especially if concurrent requests are used. This should change nothing if vf_vapoursynth is not in the filter chain, since non-threaded filters obviously can not asynchronously finish filtering of frames.
* cocoa: fix build on 10.9Stefano Pigozzi2015-01-021-1/+1
| | | | Use -isInFullScreenMode instead of the property introduced with the 10.10 SDK.
* cocoa: fix NSMapGet errorStefano Pigozzi2015-01-021-2/+4
| | | | regression from 64b6b2ea45
* vo_opengl_old: remove ancient ATI-specific YUV conversionswm42015-01-024-231/+5
| | | | | | | | | | While there's no actual need to get rid of these, I want to make sure nobody actually needs this stuff, and removing it is the best way to get to know this. We still can revert this commit if it turns out there is a significant need for this stuff. The final goal is removing vo_opengl_old entirely. Add a warning, which basically announces this intention.
* cocoa: fix uninitialization while in fullscreenStefano Pigozzi2015-01-013-2/+36
| | | | | | | | This is only needed for switching video track with `_`, since Cocoa automatically handles cleaning up the application's presentation options when quitting the process. Fixes #1399
* gl_hwdec_vda: refuse to work with old OpenGL versionswm42014-12-311-0/+5
| | | | | | | | | | | | The way we use rectangle textures (required by VDA for no reason) works onl in OpenGL 3.0 or higher. Below that, the shader will fail to compile. We could add support for older OpenGL versions, but that would be a major pain. This normally doesn't matter; mpv itself always creates OpenGL 3.2 contexts on OSX. But it could matter if a client API user uses vo_opengl_cb, and gives it a 2.1 context (which OSX also allows you to create).
* vo_opengl_cb: simplify API uninitializationwm42014-12-311-6/+30
| | | | | | | | | | | Until now, calling mpv_opengl_cb_uninit_gl() at a "bad moment" could make the whole thing to explode. The API user was asked to avoid such situations by calling it only in "good moments". But this was probably a bit too subtle and could easily be overlooked. Integrate the approach the qml example uses directly into the implementation. If the OpenGL context is to be unitialized, forcefully disable video, and block until this is done.
* vo_opengl_cb: pass context directlywm42014-12-312-59/+42
| | | | | This is simpler than setting the context after VO creation, which requires the code to check for the context on every entrypoint.
* video: pass some VO params as structwm42014-12-312-18/+18
| | | | | Not particularly elegant, but better than adding more and more stuff to the relevant function signatures.
* command: make empty vf-metadata not an errorwm42014-12-301-3/+4
| | | | | | | | If a filter exists, but has no metadata, just return success. This allows the user to distinguish between no metadata available, and filter not inserted. See #1408.
* vf: fix crash if filter doesn't provide control entrypointwm42014-12-301-1/+1
| | | | | | | | This input command crashed: vf add @mf:format=yuv420p ; show_text "${vf-metadata/mf}" Fixes #1408.
* w32_common: allow window resizing with --no-borderJames Ross-Gowan2014-12-291-0/+58
|
* vo_opengl: Ignore approx-gamma for BT.2020-CLNiklas Haas2014-12-291-2/+9
| | | | | | The details of the non-linear transformation from/to BT.2020's constant luminance system don't really make sense with any other gamma curve, since changing the gamma curve completely breaks the chroma channels.
* cocoa: move the gl function loader to gl_cocoa.cStefano Pigozzi2014-12-283-17/+15
|
* screenshots: set AVFrame parameterswm42014-12-281-0/+3
| | | | | | | Currently, libavcodec is rather lenient, but it might get stricter in the future. Fixes #1398.
* vo_opengl: don't use 10 bit video on Intel GPUs