Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / guicast / test2.C
blob0d43c1e40ff10148050c490dc2c62145b7972570
1 #include "guicast.h"
2 #include "vframe.h"
3 #include <sys/time.h>
5 class TestWindow : public BC_Window
7 public:
8         TestWindow() : BC_Window("test", 
9                                 0,
10                                 0,
11                                 640, 
12                                 480)
13         {
14         }
20 typedef struct
22         struct timeval start_time;
23         struct timeval last_time;
24         int64_t frames;
25 } status_t;
29 static void init_status(status_t *status)
31         gettimeofday(&status->start_time, 0);
32         gettimeofday(&status->last_time, 0);
33         status->frames = 0;
36 static void update_status(status_t *status)
38         struct timeval new_time;
39         gettimeofday(&new_time, 0);
40         if(new_time.tv_sec - status->last_time.tv_sec > 1)
41         {
42                 fprintf(stderr, "%lld frames.  %lld frames/sec      \r", 
43                         status->frames,
44                         (int64_t)status->frames / 
45                         (int64_t)(new_time.tv_sec - status->start_time.tv_sec));
46                 fflush(stdout);
47                 status->last_time = new_time;
48         };
51 static void stop_status()
53         fprintf(stderr, "\n\n");
58 int main(int argc, char *argv[])
60         TestWindow window;
61         status_t status;
62         
63 //      int result = window.accel_available(BC_YUV422);
64 //      printf("accel_available == %d\n", result);
65         window.start_video();
66         BC_Bitmap *bitmap1 = window.new_bitmap(640, 480, BC_BGR8888);
67         
68         init_status(&status);
69         while(1)
70         {
71                 window.draw_bitmap(bitmap1, 1);
72                 window.flash();
73                 update_status(&status);
74                 status.frames++;
75         }
78 //      Local Variables:
79 //      mode: C++
80 //      c-file-style: "linux"
81 //      End: