X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=clip_list.h;h=8dead831106e74783704ad5fab8ea6b9eb9eb675;hb=3795723be95f2fe82f3c8b8b45b1a905b2c811fd;hp=31ddb6cb297965512c5c7a65d26bfc52b485ca9b;hpb=58b5adcca3af1abbf4c69b00853bee037bb7fec7;p=nageru diff --git a/clip_list.h b/clip_list.h index 31ddb6c..8dead83 100644 --- a/clip_list.h +++ b/clip_list.h @@ -1,24 +1,25 @@ #ifndef _CLIP_LIST_H #define _CLIP_LIST_H 1 -#include +#include "defs.h" +#include "state.pb.h" +#include #include - -#include +#include #include - -#include "defs.h" -#include "state.pb.h" +#include struct Clip { int64_t pts_in = -1, pts_out = -1; // pts_in is inclusive, pts_out is exclusive. std::string descriptions[NUM_CAMERAS]; unsigned stream_idx = 0; // For the playlist only. + double fade_time_seconds = 0.5; // For the playlist only. }; class DataChangedReceiver { public: + virtual ~DataChangedReceiver() {} virtual void emit_data_changed(size_t row) = 0; }; @@ -27,7 +28,8 @@ struct ClipProxy { public: ClipProxy(Clip &clip, DataChangedReceiver *clip_list, size_t row) : clip(clip), clip_list(clip_list), row(row) {} - ~ClipProxy() { + ~ClipProxy() + { if (clip_list != nullptr) { clip_list->emit_data_changed(row); } @@ -99,6 +101,7 @@ public: DURATION, CAMERA, DESCRIPTION, + FADE_TIME, NUM_COLUMNS }; @@ -126,9 +129,12 @@ public: ClipProxy mutable_back() { return mutable_clip(size() - 1); } const Clip *back() const { return clip(size() - 1); } + // TODO: Move these out of PlayList. void set_currently_playing(int index, double progress); // -1 = none. int get_currently_playing() const { return currently_playing_index; } + void set_progress(const std::map &progress); + ClipListProto serialize() const; void emit_data_changed(size_t row) override; @@ -140,6 +146,7 @@ private: std::vector clips; int currently_playing_index = -1; double play_progress = 0.0; + std::map current_progress; }; #endif // !defined (_CLIP_LIST_H)