diff options
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r-- | src/QuickMedia.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 4fd76c5..9bcdcca 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -2655,6 +2655,12 @@ namespace QuickMedia { return url.find("yt_live_broadcast") != std::string::npos || url.find("manifest/") != std::string::npos; } + static int video_get_max_height(Display *display) { + if(get_config().video.max_height > 0) + return get_config().video.max_height; + return get_largest_monitor_height(display); + } + #define CLEANMASK(mask) ((mask) & (ShiftMask|ControlMask|Mod1Mask|Mod4Mask|Mod5Mask)) void Program::video_content_page(Page *parent_page, VideoPage *video_page, std::string video_title, bool download_if_streaming_fails, Body *parent_body, int play_index, int *parent_body_page, const std::string &parent_page_search) { @@ -2725,7 +2731,7 @@ namespace QuickMedia { video_player_window = None; bool is_audio_only = no_video; - const int largest_monitor_height = get_largest_monitor_height(disp); + const int video_max_height = video_get_max_height(disp); if(!reuse_media_source) { std::string new_title; @@ -2744,7 +2750,7 @@ namespace QuickMedia { std::string ext; if(!no_video) - video_url = video_page->get_video_url(largest_monitor_height, has_embedded_audio, ext); + video_url = video_page->get_video_url(video_max_height, has_embedded_audio, ext); if(video_url.empty() || no_video) { video_url = video_page->get_audio_url(ext); @@ -2886,7 +2892,7 @@ namespace QuickMedia { } } - video_player = std::make_unique<VideoPlayer>(is_audio_only, get_config().use_system_mpv_config, is_matrix && !is_youtube, video_event_callback, on_window_create, resources_root, largest_monitor_height, plugin_name); + video_player = std::make_unique<VideoPlayer>(is_audio_only, get_config().use_system_mpv_config, is_matrix && !is_youtube, video_event_callback, on_window_create, resources_root, video_max_height, plugin_name); VideoPlayer::Error err = video_player->load_video(v.c_str(), a.c_str(), window.getSystemHandle(), use_youtube_dl, video_title, start_time, media_chapters); if(err != VideoPlayer::Error::OK) { std::string err_msg = "Failed to play url: "; @@ -2966,7 +2972,7 @@ namespace QuickMedia { sf::Clock cursor_hide_timer; auto save_video_url_to_clipboard = [this, video_page]() { - std::string url = video_page->get_download_url(get_largest_monitor_height(disp)); + std::string url = video_page->get_download_url(video_get_max_height(disp)); if(video_url_supports_timestamp(url)) { double time_in_file = 0.0; if(video_player && (video_player->get_time_in_file(&time_in_file) != VideoPlayer::Error::OK)) @@ -3027,7 +3033,7 @@ namespace QuickMedia { } else if(pressed_keysym == XK_f && pressing_ctrl) { window_set_fullscreen(disp, window.getSystemHandle(), WindowFullscreenState::TOGGLE); } else if(pressed_keysym == XK_s && pressing_ctrl) { - video_page_download_video(video_page->get_download_url(get_largest_monitor_height(disp)), video_player_window); + video_page_download_video(video_page->get_download_url(video_get_max_height(disp)), video_player_window); } else if(pressed_keysym == XK_F5) { double resume_start_time = 0.0; video_player->get_time_in_file(&resume_start_time); @@ -7109,7 +7115,7 @@ namespace QuickMedia { youtube_video_page = std::make_unique<YoutubeVideoPage>(this, url); bool cancelled = false; bool load_successful = false; - const int largest_monitor_height = get_largest_monitor_height(disp); + const int video_max_height = video_get_max_height(disp); std::string err_str; for(int i = 0; i < 3; ++i) { @@ -7122,7 +7128,7 @@ namespace QuickMedia { std::string ext; bool has_embedded_audio = true; - video_url = no_video ? "" : youtube_video_page->get_video_url(largest_monitor_height, has_embedded_audio, ext); + video_url = no_video ? "" : youtube_video_page->get_video_url(video_max_height, has_embedded_audio, ext); audio_url.clear(); if(!has_embedded_audio || no_video) |