From 52d2bcde946b4cc05932db347bce44d2fd518865 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 28 Jun 2020 00:03:27 +0200 Subject: Add --use-system-mpv-config option --- src/VideoPlayer.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/VideoPlayer.cpp') diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 85c0d4d..138f269 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -17,8 +17,9 @@ const int MAX_RETRIES_CONNECT = 20; const int READ_TIMEOUT_MS = 200; namespace QuickMedia { - VideoPlayer::VideoPlayer(bool use_tor, EventCallbackFunc _event_callback, VideoPlayerWindowCreateCallback _window_create_callback) : + VideoPlayer::VideoPlayer(bool use_tor, bool use_system_mpv_config, EventCallbackFunc _event_callback, VideoPlayerWindowCreateCallback _window_create_callback) : use_tor(use_tor), + use_system_mpv_config(use_system_mpv_config), video_process_id(-1), ipc_socket(-1), connected_to_ipc(false), @@ -74,18 +75,23 @@ namespace QuickMedia { wid_arg += parent_window_str; // TODO: Resume playback if the last video played matches the first video played next time QuickMedia is launched - args.insert(args.end(), { "mpv", "--keep-open=yes", /*"--keep-open-pause=no",*/ input_ipc_server_arg.c_str(), - "--no-config", - //"--no-input-default-bindings", "--input-vo-keyboard=no", - "--demuxer-max-bytes=40M", "--demuxer-max-back-bytes=20M", - //"--no-input-terminal", - //"--no-osc", - "--profile=gpu-hq", - "--vo=gpu", - "--hwdec=auto", + args.insert(args.end(), { + "mpv", "--keep-open=yes", input_ipc_server_arg.c_str(), "--no-resume-playback", - /*"--vo=gpu", "--hwdec=auto",*/ - wid_arg.c_str(), "--", path, nullptr }); + wid_arg.c_str() + }); + + if(!use_system_mpv_config) { + args.insert(args.end(), { + "--no-config", "--demuxer-max-bytes=40M", "--demuxer-max-back-bytes=20M", + "--profile=gpu-hq", + "--vo=gpu", + "--hwdec=auto" + }); + } + + args.insert(args.end(), { "--", path, nullptr }); + if(exec_program_async(args.data(), &video_process_id) != 0) return Error::FAIL_TO_LAUNCH_PROCESS; -- cgit v1.2.3