diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-06-01 02:10:03 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-06-01 02:10:03 +0200 |
commit | 83e7fac934fd33bc264ff88fa2459cade9749ceb (patch) | |
tree | a4a3e2a6101cf82abefd7d5db19f104368f889e8 /src | |
parent | c29672befe523b86b347088a755cb91279bf7af4 (diff) |
Make video on 4chan seekable
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 22 |
1 files 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<VideoPlayer> video_player; + std::unique_ptr<sf::RenderWindow> 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<sf::RenderWindow>(ui_window); video_player_ui_window->setVerticalSyncEnabled(true); + video_player->is_seekable(&seekable); }; - bool ui_resize = true; - bool seekable = false; - - std::unique_ptr<VideoPlayer> 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()); |