add mask color radio btn sel, fix del all mask btn, fix mask dflt kfrm draw name...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / test2.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "guicast.h"
23 #include "vframe.h"
24 #include <sys/time.h>
25
26 class TestWindow : public BC_Window
27 {
28 public:
29         TestWindow() : BC_Window("test",
30                                 0,
31                                 0,
32                                 640,
33                                 480)
34         {
35         }
36 };
37
38
39
40
41 typedef struct
42 {
43         struct timeval start_time;
44         struct timeval last_time;
45         int64_t frames;
46 } status_t;
47
48
49
50 static void init_status(status_t *status)
51 {
52         gettimeofday(&status->start_time, 0);
53         gettimeofday(&status->last_time, 0);
54         status->frames = 0;
55 }
56
57 static void update_status(status_t *status)
58 {
59         struct timeval new_time;
60         gettimeofday(&new_time, 0);
61         if(new_time.tv_sec - status->last_time.tv_sec > 1)
62         {
63                 fprintf(stderr, "%lld frames.  %lld frames/sec      \r",
64                         status->frames,
65                         (int64_t)status->frames /
66                         (int64_t)(new_time.tv_sec - status->start_time.tv_sec));
67                 fflush(stdout);
68                 status->last_time = new_time;
69         };
70 }
71
72 static void stop_status()
73 {
74         fprintf(stderr, "\n\n");
75 }
76
77
78
79 int main(int argc, char *argv[])
80 {
81         TestWindow window;
82         status_t status;
83
84 //      int result = window.accel_available(BC_YUV422);
85 //      printf("accel_available == %d\n", result);
86         window.start_video();
87         BC_Bitmap *bitmap1 = window.new_bitmap(640, 480, BC_BGR8888);
88
89         init_status(&status);
90         while(1)
91         {
92                 window.draw_bitmap(bitmap1, 1);
93                 window.flash();
94                 update_status(&status);
95                 status.frames++;
96         }
97 };