X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.0%2Fguicast%2Fvicon.h;h=6ae0119e547c7718866f4428fee479ee6b5a866e;hb=7150970246a9935d304b1f094c209f69cfd7adb3;hp=fb315289a57aa44dbfb72b63263dae627b4fb8e0;hpb=39d4e483b6daeb2d0eb2a6eec5b2e96552e22c5b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.0/guicast/vicon.h b/cinelerra-5.0/guicast/vicon.h index fb315289..6ae0119e 100644 --- a/cinelerra-5.0/guicast/vicon.h +++ b/cinelerra-5.0/guicast/vicon.h @@ -2,6 +2,7 @@ #define __VICON_H__ #include "arraylist.h" +#include "bccmodels.h" #include "bcpopup.h" #include "bcwindowbase.h" #include "thread.h" @@ -19,25 +20,34 @@ public: ~ViewPopup(); }; +class VIFrame { + unsigned char *img_data; + VFrame *vfrm; +public: + VIFrame(int ww, int hh, int vcmdl) { + int size = BC_CModels::calculate_datasize(ww, hh, -1, vcmdl); + img_data = new unsigned char[size]; + vfrm = new VFrame(img_data, -1, ww, hh, vcmdl, -1); + } + ~VIFrame() { delete vfrm; delete [] img_data; } + + operator VFrame *() { return vfrm; } +}; + class VIcon { public: - int vw, vh, vcmdl, in_use; - ArrayList images; + int vw, vh, in_use; + ArrayList images; int64_t seq_no; - double age, period; + double cycle_start, age, frame_rate; - double frame_rate() { return 1000/period; } - void frame_rate(double r) { period = 1000/r; } int64_t vframes() { return images.size(); } + void reset() { seq_no = 0; cycle_start = 0; age = 0; } void clear_images() { images.remove_all_objects(); } - virtual VFrame *frame() { return images[seq_no]; } - virtual int64_t next_frame(int n) { - age += n * period; - if( (seq_no+=n) >= images.size() ) seq_no = 0; - return seq_no; - } + virtual int64_t set_seq_no(int64_t no) { return seq_no = no; } + virtual VFrame *frame() { return *images[seq_no]; } virtual int get_vx() { return 0; } virtual int get_vy() { return 0; } @@ -45,7 +55,7 @@ public: void draw_vframe(BC_WindowBase *wdw, int x, int y); void dump(const char *dir); - VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=24); + VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=VICON_RATE); virtual ~VIcon(); }; @@ -59,13 +69,12 @@ public: ViewPopup *view_win; VIcon *viewing, *vicon; int view_w, view_h; - int cur_view, new_view; int img_dirty, win_dirty; - int64_t draw_flash; + double refresh_rate; ArrayListt_heap; VIcon *low_vicon(); - void add_vicon(VIcon *vicon, double age=0); + void add_vicon(VIcon *vicon); int del_vicon(VIcon *&vicon); void run(); void flash();