aboutsummaryrefslogtreecommitdiff
path: root/src/VideoPlayer.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-29 05:16:57 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-29 05:16:57 +0200
commit43e7de19358f730ee18d690a993e97a5195b80c9 (patch)
treea132a8cf5784d7a62a58dc08acf9a0e062bc5539 /src/VideoPlayer.cpp
parentda9836a92ef69bb93e521985976db0322e2d5316 (diff)
Faster video loading/error when not using xxx plugin (disable ytdl)
Diffstat (limited to 'src/VideoPlayer.cpp')
-rw-r--r--src/VideoPlayer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp
index 98d215d..7f01912 100644
--- a/src/VideoPlayer.cpp
+++ b/src/VideoPlayer.cpp
@@ -70,6 +70,7 @@ namespace QuickMedia {
no_video(no_video),
use_system_mpv_config(use_system_mpv_config),
keep_open(keep_open),
+ use_youtube_dl(true),
video_process_id(-1),
connected_to_ipc(false),
connect_tries(0),
@@ -115,7 +116,7 @@ namespace QuickMedia {
remove(tmp_chapters_filepath);
}
- VideoPlayer::Error VideoPlayer::launch_video_process(const char *path, const char *audio_path, sf::WindowHandle _parent_window, bool is_youtube, const std::string &title, const std::string &start_time) {
+ VideoPlayer::Error VideoPlayer::launch_video_process(const char *path, const char *audio_path, sf::WindowHandle _parent_window, const std::string &title, const std::string &start_time) {
parent_window = _parent_window;
if(!tmpnam(ipc_server_path)) {
@@ -166,7 +167,7 @@ namespace QuickMedia {
else
ytdl_format = "--ytdl-format=bestvideo[height<=?" + std::to_string(monitor_height) + "]+bestaudio/best";
- if(is_youtube)
+ if(!use_youtube_dl)
args.push_back("--no-ytdl");
else
args.push_back(ytdl_format.c_str());
@@ -232,17 +233,18 @@ namespace QuickMedia {
return Error::OK;
}
- VideoPlayer::Error VideoPlayer::load_video(const char *path, const char *audio_path, sf::WindowHandle _parent_window, bool is_youtube, const std::string &title, const std::string &start_time, const std::vector<MediaChapter> &chapters) {
+ VideoPlayer::Error VideoPlayer::load_video(const char *path, const char *audio_path, sf::WindowHandle _parent_window, bool use_youtube_dl, const std::string &title, const std::string &start_time, const std::vector<MediaChapter> &chapters) {
// This check is to make sure we dont change window that the video belongs to. This is not a usecase we will have so
// no need to support it for now at least.
assert(parent_window == 0 || parent_window == _parent_window);
assert(path);
+ this->use_youtube_dl = use_youtube_dl;
if(!create_tmp_file_with_chapters_data(tmp_chapters_filepath, chapters))
fprintf(stderr, "Warning: failed to create chapters file. Chapters will not be displayed\n");
fprintf(stderr, "Playing video: %s, audio: %s\n", path ? path : "", audio_path ? audio_path : "");
if(video_process_id == -1)
- return launch_video_process(path, audio_path, _parent_window, is_youtube, title, start_time);
+ return launch_video_process(path, audio_path, _parent_window, title, start_time);
// TODO: When these are used, add audio_path, title and start_time. Also handle is_youtube
Json::Value command_data(Json::arrayValue);