X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=player.h;h=c7f8e070a71a0ce697e1c21edd14727a3892762f;hb=3795723be95f2fe82f3c8b8b45b1a905b2c811fd;hp=fb9f4a0f01ea6a90544609954191d59148f33683;hpb=5c3d31147e398494e8ea8be386f7d533b2b3baaa;p=nageru diff --git a/player.h b/player.h index fb9f4a0..c7f8e07 100644 --- a/player.h +++ b/player.h @@ -2,6 +2,7 @@ #define _PLAYER_H 1 #include "clip_list.h" +#include "frame_on_disk.h" #include "queue_spot_holder.h" extern "C" { @@ -21,7 +22,7 @@ class Player : public QueueInterface { public: Player(JPEGFrameView *destination, bool also_output_to_stream); - void play_clip(const Clip &clip, unsigned stream_idx); + void play_clip(const Clip &clip, size_t clip_idx, unsigned stream_idx); void override_angle(unsigned stream_idx); // For the current clip only. // Not thread-safe to set concurrently with playing. @@ -31,12 +32,13 @@ public: // Not thread-safe to set concurrently with playing. // Will be called back from the player thread. - using next_clip_callback_func = std::function; + // The second parameter is the clip's position in the play list. + using next_clip_callback_func = std::function()>; 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; + using progress_callback_func = std::function &progress)>; void set_progress_callback(progress_callback_func cb) { progress_callback = cb; } // QueueInterface. @@ -51,7 +53,7 @@ private: // 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); + bool find_surrounding_frames(int64_t pts, int stream_idx, FrameOnDisk *frame_lower, FrameOnDisk *frame_upper); JPEGFrameView *destination; done_callback_func done_callback; @@ -60,6 +62,7 @@ private: std::mutex mu; Clip current_clip; // Under mu. Can have pts_in = -1 for no clip. + size_t current_clip_idx; // Under mu. unsigned current_stream_idx; // Under mu. std::mutex queue_state_mu;