X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_capture.h;h=daf353eec6bdad339dc5e1ddbf87a4d36709726c;hb=321995944e46e187ee515d358f137d94c30f090e;hp=8c75b4f705c25691bb2a967fc68c11b6d6ebeac0;hpb=bcdbb7bdfcfc45b34ccdf36d3950e7e0af6444bd;p=nageru diff --git a/ffmpeg_capture.h b/ffmpeg_capture.h index 8c75b4f..daf353e 100644 --- a/ffmpeg_capture.h +++ b/ffmpeg_capture.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,12 @@ public: return card_index; } + void rewind() + { + std::lock_guard lock(queue_mu); + command_queue.push_back(QueuedCommand { QueuedCommand::REWIND }); + } + // CaptureInterface. void set_video_frame_allocator(bmusb::FrameAllocator *allocator) override { @@ -147,6 +154,12 @@ private: std::atomic producer_thread_should_quit{false}; std::thread producer_thread; + + std::mutex queue_mu; + struct QueuedCommand { + enum Command { REWIND } command; + }; + std::vector command_queue; // Protected by . }; #endif // !defined(_FFMPEG_CAPTURE_H)