summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst10
-rw-r--r--player/command.c6
2 files changed, 16 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index f83e72703c..bbfe2b7963 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -456,6 +456,16 @@ Input Commands that are Possibly Subject to Change
random points. Instead, call ``overlay_add`` again (preferably with a
different memory region to prevent tearing).
+ It is also possible to pass a raw memory address for use as bitmap memory
+ by passing a memory address as integer prefixed with a ``&`` character.
+ Passing the wrong thing here will crash the player. The ``offset`` parameter
+ is not used and must be 0. This mode might be useful for use with libmpv.
+
+ On Windows, currently only raw memory addresses work. File mapping is not
+ implemented because a ``mmap`` compatibility layer is missing, and because
+ this kind of shared memory method would perhaps not be overly useful on
+ Windows.
+
``offset`` is the offset of the first pixel in the source file. It is
passed directly to ``mmap`` and is subject to certain restrictions
(see ``man mmap`` for details). In particular, this value has to be a
diff --git a/player/command.c b/player/command.c
index ef75594f7b..1b0a7df0cb 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3326,6 +3326,12 @@ static int overlay_add(struct MPContext *mpctx, int id, int x, int y,
if (!file[1] || end[0])
fd = -1;
close_fd = false;
+ } else if (file[0] == '&') {
+ char *end;
+ unsigned long long addr = strtoull(&file[1], &end, 0);
+ if (!file[1] || end[0])
+ addr = 0;
+ p = (void *)(uintptr_t)addr;
} else {
fd = open(file, O_RDONLY | O_BINARY | O_CLOEXEC);
}