diff --git a/tools/chatgui/src/streamplayer_window.cpp b/tools/chatgui/src/streamplayer_window.cpp new file mode 100644 index 00000000..4a3df57d --- /dev/null +++ b/tools/chatgui/src/streamplayer_window.cpp @@ -0,0 +1,303 @@ +#include "streamplayer_window.h" +#include "videoplayer_window.h" +#include "sound_manager.h" +#include "../transport/stream_bridge.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include "../../../lib/debug_config.h" +#include "../../../lib/opus_codec.h" +#include "../../../src/stream/stream.h" +#ifdef HAVE_FFMPEG +#include +#include +#endif +} + +namespace { +int64_t nowUs() { + return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); +} +std::atomic nextId{0}; +QString text(const char* value) { return QCoreApplication::translate("ChatGui", value); } +} + +struct StreamPlayerWindow::Playback { + struct Video { QImage image; int64_t pts; }; + struct Audio { std::array pcm; int64_t pts; unsigned offset = 0; }; + uint64_t id = ++nextId, group = 0, source = 0, epoch = 0; + std::atomic running{true}, audioAvailable{false}; + std::atomic volume{1.0f}; + std::thread worker; + std::mutex lock; + std::deque