This image format is quite legacy, but uses half as much bandwidth as
the closest XRGB8888, at 16bpp instead of 32bpp, so it is useful to
support on the slowest/oldest display controllers.
update_overlays() uploaded every sub_bitmaps item to its texture on
every call, and draw_frame() calls it unconditionally, so an OSD that
was not changing got re-uploaded at the display refresh rate rather
than at the rate it actually changed.
vo_gpu already avoids this: gen_osd_cb() compares sub_bitmaps.change_id
against a cached copy and skips upload_osd() when they match.
osd_render() computes that change_id for both VOs, so vo_gpu_next had
the information and did not read it. Cache the id next to the texture
and skip pl_tex_upload() when it matches.
Also restrict pl_tex_recreate() to the cases where the size or format
has to change. The cache requires this, because pl_tex_recreate()
invalidates the texture even when it keeps it, and the cached id would
then describe contents that are no longer defined.
DXGI leaves exclusive fullscreen by itself during Present() when the window
loses the focus or a native menu covers it, and the next Present() fails
until the buffers are resized. Check the fullscreen state when Present()
doesn't return S_OK, resize the buffers if DXGI changed it, and enter
exclusive fullscreen again on focus events, which w32_common now also
sends when a menu loop ends.
Load context_menu.lua when --d3d11-exclusive-fs is enabled and open it
instead of the native context menu. Native context menu cannot be
displayed over the exlusive window.
Fixes: #18181
Before this change, autoload would split a directory path into two,
using the parent directory as the autoload directory. This lead to the
addition of unexpected files to the playlist.
Now, the effective behavior when a directory is given falls back to the
configured mpv directory-mode.
recreate_video_proc() sets the output format and colorspace for
nvidia-true-hdr. Allocate the output image and copy out_params after it,
so the first frame has correct params.
Adds a new render API backend that lets libmpv embedders render directly
into an application-owned ID3D11Texture2D.
The backend is selected with MPV_RENDER_API_TYPE_D3D11. The embedder
supplies the ID3D11Device via MPV_RENDER_PARAM_D3D11_INIT_PARAMS at
context creation, and the target texture via MPV_RENDER_PARAM_D3D11_FBO
on each mpv_render_context_render() call. Swapchain creation and
presentation stay entirely on the caller side.
Co-authored-by: dragonflylee <dragonflylee@outlook.com>
LuaJIT is the only relevant target in practice, PUC lua 5.1/5.2 is not
maintained. We should remove support for it at some point, but that's
for another day.
GLES 2.0 contexts with GL_EXT_texture_rg never used single- and
two-component R/RG textures, because the format table only listed
them for GL 3.0/ES 3.0, or for GL 2.1 with texture_rg + texture_float
+ FBOs all present (F_GL2F). Video planes were uploaded as LUMINANCE/
LUMINANCE_ALPHA instead, which needs a swizzle hack and mismatches
the .rg layout produced by dmabuf imports of DRM_FORMAT_R8/GR88
(NV12 via drm-prime), and forced dumb mode due to the have_texrg
check.
Add format classes for ES2 with GL_EXT_texture_rg (unsized internal
formats, as ES2 requires) and for GL 2.1 with ARB/EXT_texture_rg
alone, without the float/FBO requirements of F_GL2F. The entries are
placed before the legacy LUMINANCE ones so format lookups prefer
them; F_GL2RG is suppressed when F_GL2F is active to avoid duplicate
entries.
Some GL 2.1 drivers (e.g. Mesa lima) expose GL_EXT_framebuffer_object
but not GL_ARB_framebuffer_object, leaving MPGL_CAP_FB unset even
though FBOs are usable. Load the EXT entrypoints as an alternative
provider of MPGL_CAP_FB; mpv's FBO usage (Gen'd names, GL_FRAMEBUFFER
target, single color attachment, runtime completeness checks) is
within the subset EXT and ARB share. The section is placed before the
ARB/core one so the latter overwrites the function pointers whenever
it is available.
Querying attachment parameters of the default framebuffer is an
ARB/GL 3.0 addition, so skip that query in ra_gl_ctx_color_depth()
when only the EXT extension is present.
Decrypts a stream that was encrypted as a whole with AES in CTR mode,
with a key of 128, 192 or 256 bits. The counter block is the IV plus
the index of the block as a 128 bit big endian number, so the stream
seeks wherever the inner stream does.
Give the AVIOContext wrapping the stream an AVClass with a child that
carries the location option, as libavformat's own protocols do, so the
hls and dash demuxers resolve relative references against the url the
manifest was received from.
Fixes: #18608
Windows SDK 10.0.22621 inserted a message ID at the end of the D3D11.1
range, which moved CREATE_FENCE and DESTROY_FENCE up by one. The debug
layer uses the numbering of its Windows version, so no fixed value is
right everywhere. Avoid hardcoding them.
Fence creation and destruction are now logged at debug level, a few
messages at init.
init() wraps the ANGLE D3D11 device in an AVBufferRef. Removing the
hwdec entry does not release that reference, so the device survives
render-context teardown.
Unref it before releasing the driver's own device reference, matching
the native D3D11 interop and the fix in 3447463008.
Options like --sub-file are aliases for list actions like
--sub-files-append, which --list-options shows without a type, so
nothing was completed after them. Follow aliases to their target, and
complete typeless list actions like the list option they act on.
This makes --sub-file=, --audio-file=, --glsl-shader=, --script= etc.
complete files, --sub-files-append= etc. complete files when typed
directly, and other aliases like --fs= and --audio= complete the values
of their target.
Fixes#7955.
The cells were taken as twice as tall as wide. Fit the video to the cell
size the terminal reports instead, and keep 2:1 for a terminal that
reports none.
The indexing suppose to be from 1,1, not 0,0. So we were off by one and
clamped by the terminal to the edge, but that left empty row and column,
and also cleared status line.
mp_sws and mp_zimg compared the whole image parameters to decide whether
the scaler could be kept, so dynamic HDR metadata were invalidating the
scaler. This metadata is not used by SWS or ZIMG, except for peak
luminance by the later.
Fixes playback performance of HDR video with software scaling.
ConPTY has no font, GetCurrentConsoleFont() reports 0x16, so the
terminal VOs fell back to a 320 pixel wide canvas and the mouse position
had no horizontal component. Send XTWINOPS 16 and parse it's reply, from
its key events, which carry no virtual key unlike a pressed key.
The terminal VOs only noticed a resize when they drew the next frame, so
a paused image kept its old size. The terminal input thread already
receives resizes, as a window buffer size event on Windows, which the
console reports with ENABLE_WINDOW_INPUT set, and as SIGWINCH on POSIX,
which now goes through the signal pipe like SIGTSTP. It passes them to a
callback the terminal swapchain registers, which wakes the VO thread. VO
then can react to size changes and redraw the image.
Build the whole frame, including the synchronized update sequences, in
a buffer acquired from the terminal swapchain and present it, so it is
written while the next frame is rendered.
The console write of a frame blocks until the terminal has consumed it,
which at large sizes takes as long as encoding the next frame. Present
each frame through the terminal swapchain instead, so the write overlaps
with scaling and encoding the next one.
The terminal VOs write each frame to the terminal from the VO thread,
and the write blocks until the terminal has taken the data, so nothing
is rendered meanwhile. The terminal swapchain writes from a thread of
its own, out of a ring of buffers. A VO acquires the next one, builds
the frame in it and presents it, and the swapchain queues it and writes
it under the terminal output lock, in order, with up to
--swapchain-depth frames in flight before acquiring waits.
Output that belongs with the next frame rather than in a write of its
own, such as clearing the screen after a reconfig, goes into a buffer
that the next acquire prepends.
libsixel encodes on one thread, and a 3810x1020 canvas took about 150 ms
per frame. Split the canvas into slices that start on a cell row and
hold whole sixel bands, encode them on the thread pool with an output
and a dither each, and place every slice with its own cursor move.
The slices take their rows from the scaled image, and a packed copy of
the frame is only kept for the dynamic palette, whose histogram wants
the whole frame in one piece. Its median cut runs once, on the frame:
libsixel sorts the colours with a static variable in its comparator, so
the slices cannot run it at the same time.
A slice's dither is initialized from an image with one pixel per colour
in distinct 5-bit histogram buckets, which libsixel keeps as it is and
which gives the dither the colour cache of its fast lookup, and then
gets the frame's palette set.
A slice dithered on its own would not have a context, so each slice is
dithered together with twelve rows above it and one band below it, taken
from a copy since the diffusion writes into the image, with
sixel_dither_apply_palette(), and only its own rows of the indices are
encoded, through a second dither that takes the indices as they are. A
slice is at least three times as tall as the rows around it.
--vo-sixel-rows and --vo-sixel-cols replaced the terminal's cell counts
while the canvas kept the terminal's pixel size, and --vo-sixel-top and
--vo-sixel-left kept it too, so the image ran past the bottom and
scrolled the terminal. Take the cell size from what the terminal
reports, and size the canvas in those cells from where the image
starts, or as the options say.