r1053: Add Russian translation.
[cinelerra_cv.git] / cinelerra / vedit.C
blobc02eb3ae3bc93df3915b998e1ded6c275732886e
1 #include "asset.h"
2 #include "bcsignals.h"
3 #include "cache.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "file.h"
7 #include "mwindow.h"
8 #include "patch.h"
9 #include "preferences.h"
10 #include "mainsession.h"
11 #include "trackcanvas.h"
12 #include "tracks.h"
13 #include "transportque.h"
14 #include "units.h"
15 #include "vedit.h"
16 #include "vedits.h"
17 #include "vframe.h"
18 #include "vtrack.h"
20 VEdit::VEdit(EDL *edl, Edits *edits)
21  : Edit(edl, edits)
26 VEdit::~VEdit() { }
28 int VEdit::load_properties_derived(FileXML *xml)
30         channel = xml->tag.get_property("CHANNEL", (int64_t)0);
31         return 0;
38 // ================================================== editing
42 int VEdit::read_frame(VFrame *video_out, 
43         int64_t input_position, 
44         int direction,
45         CICache *cache,
46         int use_nudge,
47         int use_cache,
48         int use_asynchronous)
50         File *file = cache->check_out(asset,
51                 edl);
52         int result = 0;
53         if(use_nudge) input_position += track->nudge;
55         if(file)
56         {
58                 input_position = (direction == PLAY_FORWARD) ? input_position : (input_position - 1);
60                 if(use_asynchronous)
61                         file->start_video_decode_thread();
62                 else
63                         file->stop_video_thread();
65                 file->set_layer(channel);
66                 file->set_video_position(input_position - startproject + startsource, edl->session->frame_rate);
67                 if(use_cache) file->set_cache_frames(use_cache);
68                 result = file->read_frame(video_out);
69                 if(use_cache) file->set_cache_frames(0);
71                 cache->check_in(asset);
72         }
73         else
74                 result = 1;
75         
76 //for(int i = 0; i < video_out->get_w() * 3 * 20; i++) video_out->get_rows()[0][i] = 128;
77         return result;
80 int VEdit::copy_properties_derived(FileXML *xml, int64_t length_in_selection)
82         return 0;
85 int VEdit::dump_derived()
87         printf("        VEdit::dump_derived\n");
88         printf("                startproject %ld\n", startproject);
89         printf("                length %ld\n", length);
92 int64_t VEdit::get_source_end(int64_t default_)
94         if(!asset) return default_;   // Infinity
96         return (int64_t)((double)asset->video_length / asset->frame_rate * edl->session->frame_rate + 0.5);