]> git.sesse.net Git - nageru/blobdiff - ffmpeg_capture.h
Add support for changing the playback rate.
[nageru] / ffmpeg_capture.h
index daf353eec6bdad339dc5e1ddbf87a4d36709726c..3787bd7a468408de6a573ed9f91b6d94e260aa9f 100644 (file)
@@ -55,6 +55,12 @@ public:
                command_queue.push_back(QueuedCommand { QueuedCommand::REWIND });
        }
 
+       void change_rate(double new_rate)
+       {
+               std::lock_guard<std::mutex> lock(queue_mu);
+               command_queue.push_back(QueuedCommand { QueuedCommand::CHANGE_RATE, new_rate });
+       }
+
        // CaptureInterface.
        void set_video_frame_allocator(bmusb::FrameAllocator *allocator) override
        {
@@ -157,7 +163,8 @@ private:
 
        std::mutex queue_mu;
        struct QueuedCommand {
-               enum Command { REWIND } command;
+               enum Command { REWIND, CHANGE_RATE } command;
+               double new_rate;  // For CHANGE_RATE.
        };
        std::vector<QueuedCommand> command_queue;  // Protected by <queue_mu>.
 };