From 08d6c26b6fc06bd7fc80bc168131998f95c12551 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 18 Feb 2022 17:46:28 +0100 Subject: Fix video thumbnail creation --- src/FileAnalyzer.cpp | 6 +++--- src/VideoPlayer.cpp | 2 ++ src/plugins/LocalAnime.cpp | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp index 4e4470e..2ce8250 100644 --- a/src/FileAnalyzer.cpp +++ b/src/FileAnalyzer.cpp @@ -129,7 +129,7 @@ namespace QuickMedia { bool video_get_first_frame(const FileAnalyzer &file, const char *destination_path, int width, int height) { Path destination_path_tmp = destination_path; - destination_path_tmp.append(".ftmp"); + destination_path_tmp.append(".tmp.jpg"); const int middle_seconds = file.get_duration_seconds().value_or(0.0) / 2.0; char middle_seconds_str[32]; @@ -139,13 +139,13 @@ namespace QuickMedia { char framesize[128]; snprintf(framesize, sizeof(framesize), "%dx%d", width, height); - const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-f", "singlejpeg", "-s", framesize, "--", destination_path_tmp.data.c_str(), nullptr }; + const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-s", framesize, "--", destination_path_tmp.data.c_str(), nullptr }; if(exec_program(program_args, nullptr, nullptr) != 0) { fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n"); return false; } } else { - const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-f", "singlejpeg", "--", destination_path_tmp.data.c_str(), nullptr }; + const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "--", destination_path_tmp.data.c_str(), nullptr }; if(exec_program(program_args, nullptr, nullptr) != 0) { fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n"); return false; diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 8fdf9dc..3e336fb 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -234,9 +234,11 @@ namespace QuickMedia { if(startup_args.use_system_mpv_config) { args.push_back("--config=yes"); + args.push_back("--load-scripts=yes"); } else { args.insert(args.end(), { "--config=no", + "--load-scripts=no", "--profile=gpu-hq", "--vo=gpu,vdpau,x11", "--hwdec=auto" diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp index b78772d..318058b 100644 --- a/src/plugins/LocalAnime.cpp +++ b/src/plugins/LocalAnime.cpp @@ -30,13 +30,13 @@ namespace QuickMedia { mgl::Rectangle watch_rect; watch_rect.set_position({ widgets.thumbnail->position.x, widgets.thumbnail->position.y + widgets.thumbnail->size.y - rect_height }); watch_rect.set_size({ floor(widgets.thumbnail->size.x * watch_ratio), rect_height }); - watch_rect.set_color(mgl::Color(255, 0, 0, 255)); + watch_rect.set_color(mgl::Color(150, 0, 0, 255)); render_target.draw(watch_rect); mgl::Rectangle unwatch_rect; unwatch_rect.set_position({ floor(widgets.thumbnail->position.x + widgets.thumbnail->size.x * watch_ratio), widgets.thumbnail->position.y + widgets.thumbnail->size.y - rect_height }); unwatch_rect.set_size({ floor(widgets.thumbnail->size.x * (1.0 - watch_ratio)), rect_height }); - unwatch_rect.set_color(mgl::Color(255, 255, 255, 255)); + unwatch_rect.set_color(mgl::Color(150, 150, 150, 255)); render_target.draw(unwatch_rect); } -- cgit v1.2.3