Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vpluginarray.C

Go to the documentation of this file.
00001 #include "cache.h"
00002 #include "edl.h"
00003 #include "edlsession.h"
00004 #include "file.h"
00005 #include "mwindow.h"
00006 #include "pluginserver.h"
00007 #include "preferences.h"
00008 #include "recordablevtracks.h"
00009 #include "mainsession.h"
00010 #include "vframe.h"
00011 #include "vmodule.h"
00012 #include "vpluginarray.h"
00013 #include "vtrack.h"
00014 
00015 
00016 #define RING_BUFFERS 2
00017 
00018 
00019 
00020 VPluginArray::VPluginArray()
00021  : PluginArray(TRACK_VIDEO)
00022 {
00023         realtime_buffers = 0;
00024 }
00025 
00026 VPluginArray::~VPluginArray()
00027 {
00028         file->stop_video_thread();
00029         for(int i = 0; i < total_tracks(); i++)
00030         {
00031                 delete modules[i];
00032         }
00033         delete tracks;
00034 }
00035 
00036 void VPluginArray::get_recordable_tracks()
00037 {
00038         tracks = new RecordableVTracks(edl->tracks);
00039 }
00040 
00041 int64_t VPluginArray::get_bufsize()
00042 {
00043         return 1;
00044 }
00045 
00046 void VPluginArray::create_buffers()
00047 {
00048         file->start_video_thread(buffer_size,
00049                 edl->session->color_model,
00050                 RING_BUFFERS,
00051                 0);
00052 //      if(!plugin_server->realtime) realtime_buffers = file->get_video_buffer();
00053 }
00054 
00055 void VPluginArray::get_buffers()
00056 {
00057         if(!realtime_buffers) realtime_buffers = file->get_video_buffer();
00058 }
00059 
00060 void VPluginArray::create_modules()
00061 {
00062         modules = new Module*[total_tracks()];
00063         for(int i = 0; i < total_tracks(); i++)
00064         {
00065                 modules[i] = new VModule(0, 0, this, tracks->values[i]);
00066                 modules[i]->cache = cache;
00067                 modules[i]->edl = edl;
00068                 modules[i]->create_objects();
00069                 modules[i]->render_init();
00070         }
00071 }
00072 
00073 
00074 void VPluginArray::process_realtime(int module, 
00075         int64_t input_position, 
00076         int64_t len)
00077 {
00078         values[module]->process_buffer(realtime_buffers[module], 
00079                         input_position, 
00080                         edl->session->frame_rate,
00081                         0,
00082                         PLAY_FORWARD);
00083 }
00084 
00085 int VPluginArray::process_loop(int module, int64_t &write_length)
00086 {
00087         if(!realtime_buffers) realtime_buffers = file->get_video_buffer();
00088 
00089 // Convert from array of frames to array of tracks
00090         VFrame **temp_buffer;
00091         temp_buffer = new VFrame*[total_tracks()];
00092         for(int i = 0; i < total_tracks(); i++)
00093         {
00094                 temp_buffer[i] = realtime_buffers[i][0];
00095         }
00096 
00097         int result = values[module]->process_loop(realtime_buffers[module], write_length);
00098         delete [] temp_buffer;
00099         return result;
00100 }
00101 
00102 int VPluginArray::write_buffers(int64_t len)
00103 {
00104         int result = file->write_video_buffer(len);
00105         realtime_buffers = 0;
00106 
00107 //      if(!plugin_server->realtime && !done && !result) realtime_buffers = file->get_video_buffer();
00108         return result;
00109 }
00110 
00111 
00112 int VPluginArray::total_tracks()
00113 {
00114         return tracks->total;
00115 }
00116 
00117 Track* VPluginArray::track_number(int number)
00118 {
00119         return (Track*)tracks->values[number];
00120 }
00121 
00122 

Generated on Sun Jan 8 13:39:02 2006 for Cinelerra-svn by  doxygen 1.4.4