leaning heavily on the similar structure used for last year's FrOSCon talk regarding video output (by Benny Lyons and myself). However, this time we'll use a process state object (the player) and, furthermore, there is some cross-wiring of components involved...
73 lines
1.3 KiB
C++
73 lines
1.3 KiB
C++
/*
|
||
demo-uring.cpp - async file IO with io_uring
|
||
|
||
Copyright (C)
|
||
2026, Hermann Vosseler <Ichthyostega@web.de>
|
||
|
||
This program is free software; you can redistribute it and/or modify it
|
||
under the terms of the GNU GPL version 2+ See the LICENSE file for details.
|
||
|
||
* ************************************************************************/
|
||
|
||
|
||
#include "commons.hpp"
|
||
#include "egl-display.hpp"
|
||
#include "gtk-uring-app.hpp"
|
||
|
||
#include <iostream>
|
||
#include <memory>
|
||
#include <thread>
|
||
|
||
using std::unique_ptr;
|
||
|
||
//-----------------hard-coded-config--
|
||
//-----------------hard-coded-config--
|
||
|
||
|
||
class UringVideoPlayer
|
||
{
|
||
Glib::Dispatcher dispatchFrame_;
|
||
EglDisplay videoDisplayer_;
|
||
std::thread proactorThread_;
|
||
|
||
public:
|
||
UringVideoPlayer (Gtk::Window& appWindow)
|
||
: videoDisplayer_{appWindow, dispatchFrame_}
|
||
, proactorThread_{[this]{ playVideo(); }}
|
||
{ }
|
||
|
||
private:
|
||
void
|
||
playVideo()
|
||
{
|
||
|
||
}
|
||
};
|
||
|
||
|
||
unique_ptr<UringVideoPlayer>
|
||
launchPlayer (Gtk::Window& appWindow)
|
||
{
|
||
auto player = std::make_unique<UringVideoPlayer> (appWindow);
|
||
|
||
return player;
|
||
}
|
||
|
||
|
||
|
||
void
|
||
cleanUp (UringVideoPlayer& player)
|
||
{
|
||
|
||
}
|
||
|
||
|
||
|
||
int
|
||
main (int, const char*[])
|
||
{
|
||
return GtkUringApp<UringVideoPlayer>{"io-uring-demo"}
|
||
.onClick (launchPlayer)
|
||
.onClose (cleanUp)
|
||
.run();
|
||
}
|