]> git.sesse.net Git - nageru/blobdiff - player.h
Send refresh frames every 100 ms or so, so that the client does not think we are...
[nageru] / player.h
index a10a7cb9671f09924b5eda46266d6a492baccb25..63d4871c8c653ebdbe02bb1ef10259d93ea46b01 100644 (file)
--- a/player.h
+++ b/player.h
@@ -28,6 +28,11 @@ public:
        using done_callback_func = std::function<void()>;
        void set_done_callback(done_callback_func cb) { done_callback = cb; }
 
+       // Not thread-safe to set concurrently with playing.
+       // Will be called back from the player thread.
+       using next_clip_callback_func = std::function<Clip()>;
+       void set_next_clip_callback(next_clip_callback_func cb) { next_clip_callback = cb; }
+
        // Not thread-safe to set concurrently with playing.
        // Will be called back from the player thread.
        using progress_callback_func = std::function<void(double played_this_clip, double total_length)>;
@@ -39,8 +44,13 @@ private:
        static int write_packet2_thunk(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
        int write_packet2(uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
 
+       // Find the frame immediately before and after this point.
+       // Returns false if pts is after the last frame.
+       bool find_surrounding_frames(int64_t pts, int stream_idx, int64_t *pts_lower, int64_t *pts_upper);
+
        JPEGFrameView *destination;
        done_callback_func done_callback;
+       next_clip_callback_func next_clip_callback;
        progress_callback_func progress_callback;
 
        std::mutex mu;