r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / vedit.C
blob7635e640dced009da44d32386d4e89619140fb68
1 #include "assets.h"
2 #include "bezierauto.h"
3 #include "bezierautos.h"
4 #include "cache.h"
5 #include "edl.h"
6 #include "edlsession.h"
7 #include "file.h"
8 #include "mwindow.h"
9 #include "patch.h"
10 #include "preferences.h"
11 #include "mainsession.h"
12 #include "trackcanvas.h"
13 #include "tracks.h"
14 #include "transportque.h"
15 #include "units.h"
16 #include "vedit.h"
17 #include "vedits.h"
18 #include "vframe.h"
19 #include "vtrack.h"
21 VEdit::VEdit(EDL *edl, Edits *edits)
22  : Edit(edl, edits)
27 VEdit::~VEdit() { }
29 int VEdit::load_properties_derived(FileXML *xml)
31         channel = xml->tag.get_property("CHANNEL", (int64_t)0);
32         return 0;
39 // ================================================== editing
43 int VEdit::read_frame(VFrame *video_out, 
44                         int64_t input_position, 
45                         int direction,
46                         CICache *cache)
48 //printf("VEdit::read_frame 1 %f %d %p %p %s\n", asset->frame_rate, asset->video_length, cache, asset, asset->path);
49         File *file = cache->check_out(asset);
50         int result = 0;
52 //printf("VEdit::read_frame 2\n");
53         if(file)
54         {
56 //printf("VEdit::read_frame 3\n");
57                 input_position = (direction == PLAY_FORWARD) ? input_position : (input_position - 1);
59 //printf("VEdit::read_frame 4\n");
60                 file->set_layer(channel);
62 //printf("VEdit::read_frame 5\n");
63                 file->set_video_position(input_position - startproject + startsource, edl->session->frame_rate);
65 //printf("VEdit::read_frame 6 channel: %d w: %d h: %d video_out: %p\n", channel, asset->width, asset->height, video_out);
66 //asset->dump();
67                 result = file->read_frame(video_out);
69 //printf("VEdit::read_frame 7 %d\n", video_out->get_compressed_size());
70                 cache->check_in(asset);
72 //printf("VEdit::read_frame 8\n");
73         }
74         else
75                 result = 1;
76         
77 //for(int i = 0; i < video_out->get_w() * 3 * 20; i++) video_out->get_rows()[0][i] = 128;
78         return result;
81 int VEdit::copy_properties_derived(FileXML *xml, int64_t length_in_selection)
83         return 0;
86 int VEdit::dump_derived()
88         printf("        VEdit::dump_derived\n");
89         printf("                startproject %ld\n", startproject);
90         printf("                length %ld\n", length);
93 int64_t VEdit::get_source_end(int64_t default_)
95         if(!asset) return default_;   // Infinity
97         return (int64_t)((double)asset->video_length / asset->frame_rate * edl->session->frame_rate + 0.5);