r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / virtualvconsole.C
blob3b394c41b4c23b7def20357d99bc8ff8daeed154
1 #include "datatype.h"
2 #include "edl.h"
3 #include "edlsession.h"
4 #include "mwindow.h"
5 #include "playabletracks.h"
6 #include "preferences.h"
7 #include "renderengine.h"
8 #include "tracks.h"
9 #include "transportque.h"
10 #include "vframe.h"
11 #include "videodevice.h"
12 #include "virtualvconsole.h"
13 #include "virtualvnode.h"
14 #include "vmodule.h"
15 #include "vrender.h"
16 #include "vtrack.h"
18 VirtualVConsole::VirtualVConsole(RenderEngine *renderengine, VRender *vrender)
19  : VirtualConsole(renderengine, vrender, TRACK_VIDEO)
21 //printf("VirtualVConsole::VirtualVConsole\n");
22         this->vrender = vrender;
23         buffer_in = 0;
26 VirtualVConsole::~VirtualVConsole()
28 //printf("VirtualVConsole::~VirtualVConsole 1\n");
31 int VirtualVConsole::total_ring_buffers()
33         return 1;
36 void VirtualVConsole::get_playable_tracks()
38 //printf("VirtualVConsole::get_playable_tracks 1\n");
39         if(!playable_tracks)
40                 playable_tracks = new PlayableTracks(renderengine, 
41                         commonrender->current_position, 
42                         TRACK_VIDEO);
45 void VirtualVConsole::new_input_buffer(int ring_buffer)
47         buffer_in = new VFrame*[total_tracks];
48 //printf("VirtualVConsole::new_input_buffer 1\n");
49         for(int i = 0; i < total_tracks; i++)
50         {
51                 buffer_in[i] = new VFrame(0,
52                         playable_tracks->values[i]->track_w,
53                         playable_tracks->values[i]->track_h,
54                         renderengine->edl->session->color_model,
55                         -1);
56         }
59 void VirtualVConsole::delete_input_buffer(int ring_buffer)
61         for(int i = 0; i < total_tracks; i++)
62         {
63                 delete buffer_in[i];
64         }
65         delete [] buffer_in;
68 VirtualNode* VirtualVConsole::new_toplevel_node(Track *track, 
69         Module *module,
70         int track_number)
72         return new VirtualVNode(renderengine, 
73                 this, 
74                 module,
75                 0,
76                 track,
77                 0,
78                 buffer_in[track_number],
79                 buffer_in[track_number],
80                 1,
81                 1,
82                 1,
83                 1);
86 // start of buffer in project if forward / end of buffer if reverse
87 int VirtualVConsole::process_buffer(int64_t input_position)
89         int i, j, k;
90         int result = 0;
92 //printf("VirtualVConsole::process_buffer 1\n");
93 // clear output buffers
94         for(i = 0; i < MAX_CHANNELS; i++)
95         {
96                 if(vrender->video_out[i])
97                         vrender->video_out[i]->clear_frame();
98         }
100 //printf("VirtualVConsole::process_buffer 2 %d\n", total_tracks);
101 // Arm input buffers
102         for(i = 0; i < total_tracks; i++)
103                 result |= ((VModule*)virtual_modules[i]->real_module)->render(buffer_in[i],
104                         input_position,
105                         renderengine->command->get_direction());
106 //return;
108 //printf("VirtualVConsole::process_buffer 3 %d\n", render_list.total);
109 // render nodes in sorted list
110         for(i = 0; i < render_list.total; i++)
111         {
112                 ((VirtualVNode*)render_list.values[i])->render(vrender->video_out, 
113                                 input_position);
114         }
116 //printf("VirtualVConsole::process_buffer 4\n");
117         return result;
136 int VirtualVConsole::init_rendering(int duplicate)
138         return 0;
142 int VirtualVConsole::stop_rendering(int duplicate)
144         return 0;
148 int VirtualVConsole::send_last_output_buffer()
150         return 0;