3 #include "edlsession.h"
6 #include "pluginserver.h"
7 #include "preferences.h"
8 #include "recordablevtracks.h"
9 #include "mainsession.h"
12 #include "vpluginarray.h"
16 #define RING_BUFFERS 2
20 VPluginArray::VPluginArray()
21 : PluginArray(TRACK_VIDEO)
26 VPluginArray::~VPluginArray()
28 file->stop_video_thread();
29 for(int i = 0; i < total_tracks(); i++)
36 void VPluginArray::get_recordable_tracks()
38 tracks = new RecordableVTracks(edl->tracks);
41 int64_t VPluginArray::get_bufsize()
46 void VPluginArray::create_buffers()
48 file->start_video_thread(buffer_size,
49 edl->session->color_model,
52 // if(!plugin_server->realtime) realtime_buffers = file->get_video_buffer();
55 void VPluginArray::get_buffers()
57 if(!realtime_buffers) realtime_buffers = file->get_video_buffer();
60 void VPluginArray::create_modules()
62 modules = new Module*[total_tracks()];
63 for(int i = 0; i < total_tracks(); i++)
65 modules[i] = new VModule(0, 0, this, tracks->values[i]);
66 modules[i]->cache = cache;
67 modules[i]->edl = edl;
68 modules[i]->create_objects();
69 modules[i]->render_init();
74 void VPluginArray::process_realtime(int module,
75 int64_t input_position,
78 values[module]->process_buffer(realtime_buffers[module],
80 edl->session->frame_rate,
85 int VPluginArray::process_loop(int module, int64_t &write_length)
87 if(!realtime_buffers) realtime_buffers = file->get_video_buffer();
89 // Convert from array of frames to array of tracks
91 temp_buffer = new VFrame*[total_tracks()];
92 for(int i = 0; i < total_tracks(); i++)
94 temp_buffer[i] = realtime_buffers[i][0];
97 int result = values[module]->process_loop(realtime_buffers[module], write_length);
98 delete [] temp_buffer;
102 int VPluginArray::write_buffers(int64_t len)
104 int result = file->write_video_buffer(len);
105 realtime_buffers = 0;
107 // if(!plugin_server->realtime && !done && !result) realtime_buffers = file->get_video_buffer();
112 int VPluginArray::total_tracks()
114 return tracks->total;
117 Track* VPluginArray::track_number(int number)
119 return (Track*)tracks->values[number];