From f126659965425ee5f5a3851fbe83ae532e48c478 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 20 Oct 2020 04:56:06 +0200 Subject: Cache video to temporary file instead of memory --- src/QuickMedia.cpp | 2 +- src/VideoPlayer.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index c47147f..cde8cdb 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -2983,7 +2983,7 @@ namespace QuickMedia { room->has_unread_mention = true; //message->mentions_me = false; // TODO: What if the message or username begins with "-"? also make the notification image be the avatar of the user - if(!is_window_focused || room != current_room) + if(!is_window_focused || room != current_room || is_first_sync) show_notification("QuickMedia matrix - " + matrix->message_get_author_displayname(message.get()) + " (" + room->name + ")", message->body); } } diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index ce2fa82..cbb9634 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -79,6 +79,9 @@ namespace QuickMedia { wid_arg += parent_window_str; std::string input_conf = "--input-conf=" + resource_root + "input.conf"; + Path video_cache_dir = get_cache_dir().join("video"); + create_directory_recursive(video_cache_dir); + std::string cache_dir = "--cache-dir=" + video_cache_dir.data; // TODO: Resume playback if the last video played matches the first video played next time QuickMedia is launched args.insert(args.end(), { @@ -87,6 +90,8 @@ namespace QuickMedia { "--cursor-autohide=no", /* "--no-input-default-bindings", "--input-vo-keyboard=no", "--no-input-cursor", */ "--no-terminal", "--profile=pseudo-gui", // For gui when playing audio, requires a version of mpv that isn't ancient + cache_dir.c_str(), + "--cache-on-disk=yes", "--ytdl-raw-options=sub-lang=\"en,eng,enUS,en-US\",write-sub=", input_conf.c_str(), wid_arg.c_str() -- cgit v1.2.3