00001 #include "asset.h"
00002 #include "bcsignals.h"
00003 #include "cache.h"
00004 #include "edl.h"
00005 #include "edlsession.h"
00006 #include "file.h"
00007 #include "mwindow.h"
00008 #include "patch.h"
00009 #include "preferences.h"
00010 #include "mainsession.h"
00011 #include "trackcanvas.h"
00012 #include "tracks.h"
00013 #include "transportque.h"
00014 #include "units.h"
00015 #include "vedit.h"
00016 #include "vedits.h"
00017 #include "vframe.h"
00018 #include "vtrack.h"
00019
00020 VEdit::VEdit(EDL *edl, Edits *edits)
00021 : Edit(edl, edits)
00022 {
00023 }
00024
00025
00026 VEdit::~VEdit() { }
00027
00028 int VEdit::load_properties_derived(FileXML *xml)
00029 {
00030 channel = xml->tag.get_property("CHANNEL", (int64_t)0);
00031 return 0;
00032 }
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 int VEdit::read_frame(VFrame *video_out,
00043 int64_t input_position,
00044 int direction,
00045 CICache *cache,
00046 int use_nudge,
00047 int use_cache,
00048 int use_asynchronous)
00049 {
00050 File *file = cache->check_out(asset,
00051 edl);
00052 int result = 0;
00053 if(use_nudge) input_position += track->nudge;
00054
00055 if(file)
00056 {
00057
00058 input_position = (direction == PLAY_FORWARD) ? input_position : (input_position - 1);
00059
00060 if(use_asynchronous)
00061 file->start_video_decode_thread();
00062 else
00063 file->stop_video_thread();
00064
00065 file->set_layer(channel);
00066 file->set_video_position(input_position - startproject + startsource, edl->session->frame_rate);
00067 if(use_cache) file->set_cache_frames(use_cache);
00068 result = file->read_frame(video_out);
00069 if(use_cache) file->set_cache_frames(0);
00070
00071 cache->check_in(asset);
00072 }
00073 else
00074 result = 1;
00075
00076
00077 return result;
00078 }
00079
00080 int VEdit::copy_properties_derived(FileXML *xml, int64_t length_in_selection)
00081 {
00082 return 0;
00083 }
00084
00085 int VEdit::dump_derived()
00086 {
00087 printf(" VEdit::dump_derived\n");
00088 printf(" startproject %ld\n", startproject);
00089 printf(" length %ld\n", length);
00090 }
00091
00092 int64_t VEdit::get_source_end(int64_t default_)
00093 {
00094 if(!asset) return default_;
00095
00096 return (int64_t)((double)asset->video_length / asset->frame_rate * edl->session->frame_rate + 0.5);
00097 }