summaryrefslogtreecommitdiffstats
path: root/DOCS/man/input.rst
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-13 19:10:32 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commit17da9071a4a524139e2ef945ed6cde17dd08c99c (patch)
tree66201f387ae33c5f6dbdb283d62066177b0cedf3 /DOCS/man/input.rst
parentef507ad50a0933581f39a0bb86dd85fce9d8f7bc (diff)
downloadmpv-17da9071a4a524139e2ef945ed6cde17dd08c99c.tar.bz2
mpv-17da9071a4a524139e2ef945ed6cde17dd08c99c.tar.xz
demux: add a on-disk cache
Somewhat similar to the old --cache-file, except for the demuxer cache. Instead of keeping packet data in memory, it's written to disk and read back when needed. The idea is to reduce main memory usage, while allowing fast seeking in large cached network streams (especially live streams). Keeping the packet metadata on disk would be rather hard (would use mmap or so, or rewrite the entire demux.c packet queue handling), and since it's relatively small, just keep it in memory. Also for simplicity, the disk cache is append-only. If you're watching really long livestreams, and need pruning, you're probably out of luck. This still could be improved by trying to free unused blocks with fallocate(), but since we're writing multiple streams in an interleaved manner, this is slightly hard. Some rather gross ugliness in packet.h: we want to store the file position of the cached data somewhere, but on 32 bit architectures, we don't have any usable 64 bit members for this, just the buf/len fields, which add up to 64 bit - so the shitty union aliases this memory. Error paths untested. Side data (the complicated part of trying to serialize ffmpeg packets) untested. Stream recording had to be adjusted. Some minor details change due to this, but probably nothing important. The change in attempt_range_joining() is because packets in cache have no valid len field. It was a useful check (heuristically finding broken cases), but not a necessary one. Various other approaches were tried. It would be interesting to list them and to mention the pros and cons, but I don't feel like it.
Diffstat (limited to 'DOCS/man/input.rst')
-rw-r--r--DOCS/man/input.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 814d7a6825..9049bf8c9d 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1462,6 +1462,10 @@ Property list
(may not account correctly for various overhead), and stops at the
demuxer position (it ignores seek ranges after it).
+ ``file-cache-bytes`` is the number of bytes stored in the file cache. This
+ includes all overhead, and possibly unused data (like pruned data). This
+ member is missing if the file cache is not active.
+
When querying the property with the client API using ``MPV_FORMAT_NODE``,
or with Lua ``mp.get_property_native``, this will return a mpv_node with
the following contents:
@@ -1476,6 +1480,7 @@ Property list
"bof-cached" MPV_FORMAT_FLAG
"eof-cached" MPV_FORMAT_FLAG
"fw-bytes" MPV_FORMAT_INT64
+ "file-cache-bytes" MPV_FORMAT_INT64
Other fields (might be changed or removed in the future):