r1053: Add Russian translation.
[cinelerra_cv.git] / cinelerra / resourcethread.h
blob748d86ae6573cb6913d5a0a00a361ecf0980cd63
1 #ifndef RESOURCETHREAD_H
2 #define RESOURCETHREAD_H
4 // This thread tries to draw picons into the timeline, asynchronous
5 // of the navigation.
7 // TrackCanvas draws the picons which are in the cache and makes a table of
8 // picons and locations which need to be decompressed. Then ResourceThread
9 // decompresses the picons and draws them one by one, refreshing the
10 // entire trackcanvas in the process.
13 #include "arraylist.h"
14 #include "bctimer.inc"
15 #include "condition.inc"
16 #include "mwindow.inc"
17 #include "resourcepixmap.inc"
18 #include "thread.h"
19 #include "vframe.inc"
22 class ResourceThreadItem
24 public:
25 ResourceThreadItem(ResourcePixmap *pixmap,
26 Asset *asset,
27 int data_type,
28 int operation_count);
29 virtual ~ResourceThreadItem();
31 ResourcePixmap *pixmap;
32 Asset *asset;
33 int data_type;
34 int operation_count;
35 int last;
39 class AResourceThreadItem : public ResourceThreadItem
41 public:
42 AResourceThreadItem(ResourcePixmap *pixmap,
43 Asset *asset,
44 int x,
45 int channel,
46 int64_t start,
47 int64_t end,
48 int operation_count);
49 ~AResourceThreadItem();
50 int x;
51 int channel;
52 int64_t start;
53 int64_t end;
56 class VResourceThreadItem : public ResourceThreadItem
58 public:
59 VResourceThreadItem(ResourcePixmap *pixmap,
60 int picon_x,
61 int picon_y,
62 int picon_w,
63 int picon_h,
64 double frame_rate,
65 int64_t position,
66 int layer,
67 Asset *asset,
68 int operation_count);
69 ~VResourceThreadItem();
73 int picon_x;
74 int picon_y;
75 int picon_w;
76 int picon_h;
77 double frame_rate;
78 int64_t position;
79 int layer;
83 class ResourceThread : public Thread
85 public:
86 ResourceThread(MWindow *mwindow);
87 ~ResourceThread();
90 void create_objects();
91 // reset - delete all picons. Used for index building.
92 void stop_draw(int reset);
93 void start_draw();
95 // Be sure to stop_draw before changing the asset table,
96 // closing files.
97 void add_picon(ResourcePixmap *pixmap,
98 int picon_x,
99 int picon_y,
100 int picon_w,
101 int picon_h,
102 double frame_rate,
103 int64_t position,
104 int layer,
105 Asset *asset);
107 void add_wave(ResourcePixmap *pixmap,
108 Asset *asset,
109 int x,
110 int channel,
111 // samples relative to asset rate
112 int64_t source_start,
113 int64_t source_end);
115 void run();
117 void do_video(VResourceThreadItem *item);
118 void do_audio(AResourceThreadItem *item);
120 MWindow *mwindow;
121 Condition *draw_lock;
122 // Condition *interrupted_lock;
123 Mutex *item_lock;
124 ArrayList<ResourceThreadItem*> items;
125 int interrupted;
126 VFrame *temp_picon;
127 VFrame *temp_picon2;
129 // Current audio buffer for spanning multiple pixels
130 double *audio_buffer;
131 int audio_channel;
132 int64_t audio_start;
133 int audio_samples;
134 int audio_asset_id;
135 // Timer for waveform refreshes
136 Timer *timer;
137 // Waveform state
138 int prev_x;
139 double prev_h;
140 double prev_l;
141 // Incremented after every start_draw to prevent overlapping operations
142 int operation_count;
147 #endif