aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp10
-rw-r--r--src/VideoPlayer.cpp30
2 files changed, 24 insertions, 16 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index aa14d11..aba9485 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -106,8 +106,9 @@ namespace QuickMedia {
static void usage() {
fprintf(stderr, "usage: QuickMedia <plugin> [--tor]\n");
fprintf(stderr, "OPTIONS:\n");
- fprintf(stderr, "plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, pornhub, youtube or dmenu\n");
- fprintf(stderr, "--tor Use tor. Disabled by default\n");
+ fprintf(stderr, "plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, pornhub, youtube or dmenu\n");
+ fprintf(stderr, "--tor Use tor. Disabled by default\n");
+ fprintf(stderr, "--use-system-mpv-config Use system mpv config instead of no config. Disabled by default\n");
fprintf(stderr, "EXAMPLES:\n");
fprintf(stderr, "QuickMedia manganelo\n");
fprintf(stderr, "QuickMedia youtube --tor\n");
@@ -141,7 +142,6 @@ namespace QuickMedia {
current_plugin = nullptr;
std::string plugin_logo_path;
- bool use_tor = false;
for(int i = 1; i < argc; ++i) {
if(!current_plugin) {
@@ -170,6 +170,8 @@ namespace QuickMedia {
if(strcmp(argv[i], "--tor") == 0) {
use_tor = true;
+ } else if(strcmp(argv[i], "--use-system-mpv-config") == 0) {
+ use_system_mpv_config = true;
}
}
@@ -662,7 +664,7 @@ namespace QuickMedia {
};
bool has_video_started = true;
- video_player = std::make_unique<VideoPlayer>(current_plugin->use_tor, [this, &video_player, &seekable, &load_video_error_check, previous_page, &has_video_started](const char *event_name) mutable {
+ video_player = std::make_unique<VideoPlayer>(current_plugin->use_tor, use_system_mpv_config, [this, &video_player, &seekable, &load_video_error_check, previous_page, &has_video_started](const char *event_name) mutable {
bool end_of_file = false;
if(strcmp(event_name, "pause") == 0) {
double time_remaining = 9999.0;
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;