From 83e7fac934fd33bc264ff88fa2459cade9749ceb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 1 Jun 2020 02:10:03 +0200 Subject: Make video on 4chan seekable --- src/QuickMedia.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 8fdedb3..197425f 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -628,29 +628,23 @@ namespace QuickMedia { Page previous_page = pop_page_stack(); + bool ui_resize = true; + bool seekable = false; + + std::unique_ptr video_player; + std::unique_ptr video_player_ui_window; - auto on_window_create = [this, &video_player_ui_window](sf::WindowHandle video_player_window) { + auto on_window_create = [this, &video_player_ui_window, &video_player, &seekable](sf::WindowHandle video_player_window) { int screen = DefaultScreen(disp); - Window ui_window = XCreateWindow(disp, RootWindow(disp, screen), - 0, 0, 1, 1, 0, - DefaultDepth(disp, screen), - InputOutput, - DefaultVisual(disp, screen), - 0, NULL); - - XReparentWindow(disp, ui_window, video_player_window, 0, 0); + Window ui_window = XCreateSimpleWindow(disp, video_player_window, 0, 0, 1, 1, 0, 0, BlackPixel(disp, screen)); XMapWindow(disp, ui_window); XFlush(disp); video_player_ui_window = std::make_unique(ui_window); video_player_ui_window->setVerticalSyncEnabled(true); + video_player->is_seekable(&seekable); }; - bool ui_resize = true; - bool seekable = false; - - std::unique_ptr video_player; - auto load_video_error_check = [this, &video_player, previous_page]() { watched_videos.insert(content_url); VideoPlayer::Error err = video_player->load_video(content_url.c_str(), window.getSystemHandle()); -- cgit v1.2.3