4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #ifndef RESOURCETHREAD_H
23 #define RESOURCETHREAD_H
25 // This thread tries to draw picons into the timeline, asynchronous
28 // TrackCanvas draws the picons which are in the cache and makes a table of
29 // picons and locations which need to be decompressed. Then ResourceThread
30 // decompresses the picons and draws them one by one, refreshing the
31 // entire trackcanvas in the process.
34 #include "arraylist.h"
36 #include "bctimer.inc"
37 #include "condition.inc"
39 #include "indexable.inc"
40 #include "maxchannels.h"
41 #include "mwindow.inc"
42 #include "renderengine.inc"
43 #include "samples.inc"
48 class ResourceThreadItem : public ListItem<ResourceThreadItem>
51 ResourceThreadItem(ResourcePixmap *pixmap,
56 virtual ~ResourceThreadItem();
58 ResourcePixmap *pixmap;
67 class AResourceThreadItem : public ResourceThreadItem
70 AResourceThreadItem(ResourcePixmap *pixmap,
78 ~AResourceThreadItem();
85 class VResourceThreadItem : public ResourceThreadItem
88 VResourceThreadItem(ResourcePixmap *pixmap,
99 ~VResourceThreadItem();
113 class ResourceThread : public Thread
116 ResourceThread(MWindow *mwindow, MWindowGUI *gui);
120 void create_objects();
121 // reset - delete all picons. Used for index building.
122 void stop_draw(int reset);
125 // Be sure to stop_draw before changing the asset table,
127 void add_picon(ResourcePixmap *pixmap,
136 Indexable *indexable);
138 void add_wave(ResourcePixmap *pixmap,
140 Indexable *indexable,
143 // samples relative to asset rate
144 int64_t source_start,
149 void reset(int pane_number);
151 void do_video(VResourceThreadItem *item);
152 void do_audio(AResourceThreadItem *item);
154 void open_render_engine(EDL *nested_edl,
158 File *get_video_source(Asset *asset);
159 File *get_audio_source(Asset *asset);
163 Condition *draw_lock;
165 List<ResourceThreadItem> items;
170 // Render engine for nested EDL
171 RenderEngine *render_engine;
172 // ID of nested EDL being rendered
173 int render_engine_id;
179 // Current audio buffer for spanning multiple pixels
180 Samples *audio_buffer;
181 // Temporary for nested EDL
182 Samples *temp_buffer[MAX_CHANNELS];
187 // Timer for waveform refreshes
193 // Incremented after every start_draw to prevent overlapping operations